KernelCAD Documentation

DInsight Home
Skip Navigation Links.
Start page
Quick Start
Installation
Overview of the software
What is new
Collapse KernelCAD ModelsKernelCAD Models
Collapse KernelCAD ComponentsKernelCAD Components
KernelCAD Control
KernelCAD .NET Control
Methods and Properties
Menu
Model Explorer
Birds Eye View
Programming
Direct User Access
Direct Operations
Interface Queries
Printing Support
Data Types
Modes of KernelCAD Control
DIObjectGenerator class
Properties
FlatObjectArray Poperty
Context
64 bit development
Dual Mode
Initialisation Context
Overlay Editor
Memory Management
Input validation
Collapse Advanced functionalityAdvanced functionality
Collapse InterfacesInterfaces
Alphabetical list
I3DGrid
I3DBugger
I3Dpt
IAxiBase
IAxis
IBoolSection
IBoolSectionEx
IBoundary
IColor
IConstraint
IData
IDiffSurface_KC
IDIFont
IDraw
IDrawUtil
IDraw2
IElem
IElement
IKCLine
ILightSource
ILocation
ILocationEx
IMaterial
IMetrics
IMetrics2
IModel
IModel2
IModelEx
IPatch
IKCPathCollisionDetector
IProfiles
IPropertyArray
IPropertyArray2
IStdShape
IStrip
ISurface
IText
ITexture
ITransform
IUnknown
Collapse Open Cascade TechnologyOpen Cascade Technology
Collapse DataData
Collapse MovementMovement
Collapse FramesFrames
Collapse Oriented ObjectsOriented Objects
Collapse SectionsSections
Collapse GeneralGeneral
Collapse Topological InterfacesTopological Interfaces
Collapse Viewing InterfacesViewing Interfaces
Collapse Lines And CurvesLines And Curves
Collapse Symmetry InterfacesSymmetry Interfaces
Collapse Clipping plane interfacesClipping plane interfaces
Collapse AlgorithmsAlgorithms
Collapse 2D Geometry2D Geometry
Collapse Programming Samples and TutorialsProgramming Samples and Tutorials
Collapse OverviewOverview
Collapse DeploymentDeployment
Collapse .NET Samples.NET Samples
Collapse C++ SamplesC++ Samples
Collapse Visual Basic SamplesVisual Basic Samples
Collapse Delphi SamplesDelphi Samples
Collapse 3D Debugger3D Debugger
Collapse DeploymentDeployment
Licensing
Model Viewer
Open C++ Source
Technical Support
Skip Navigation LinksHome Page > KernelCAD Models > Sections > Surface and Solid Sections > Mesh Sections > Mesh
Mesh

Mesh

For rendering and for various calculations most objects in KernelCAD (and nearly all CAD software) are approximated by a triangulated surface called Mesh. Mesh is a set of three dimensional triangles also called Simplexes, joined together by shared edges. Corners of simplexes are called Vertices (vertex singular).

Software Representation

Software objects representing vertices of a mesh (Vertex objects) keep coordinates of the point along with some additional per-vertex information. Vertices also keep external normal to the approximated surface at the point. Note that normal at a vertex does not have to coincide with normal to any adjacent simplex.

A vertex can store several normals, one per each adjacent smooth patch of surface. When a vertex is internal to a smooth patch of the approximated surface it has a single normal. When a vertex belongs to a sharp edge between two patches (middle of an edge of a box) it has two normals. All corner vertices of a box have three normals.

A Simplex object has references to its three vertices and which normal in the vertex is assigned to the corner.

Mesh can be accessed via IMesh interface queried from the relevant ISection..

Meshed Surface Modifications

A mesh can be modified at runtime by the end user via Direct User Access

To modify mesh programmaticaly use Meshing Interfaces. To access these interfaces query

IMesh, IMeshMods or IMeshTopolfrom the relevant ISection.Use query or methods of these to access the rest of meshing interfaces.

Performance optimisation

Mesh modifications performed via calls to IMeshTopol.AddSimplex IVertex.SetVertexCoord automatically recalculate normals at adjacent vertices or modify some internal data. This slows down execution when a large mesh is being built up or massively modified. To improve perfomance in this situation call IMeshMods.Begin() before the series of modification calls and call IMeshMods.End() in the end of the series. See more details in remarks for IMeshMods.End().

The most efficient way to create or modify a large mesh is:

  1. Call IMeshMods.Begin() to notify software about series of changes
  2. Add verticies using IMeshTolpol.AddVertex interface
  3. Add Simplexes using IMeshTolpol.AddSimplex interface
  4. Add and define normals to verticies using IVertex interface
  5. Call IMeshMods.End( eMeshActionNone ) to notify software about the end of modifications. The eMeshActionNone parameter informs software that normals are already set (or will be set by the application later)

Notice that the above describes only the simplest scenario of a smooth surface. When normals are not known instead of steps 4 and 5 call IMeshMods.End() with a more suitable parameter. Mesh with corners or edges also requires defining normal indecies using ISimplex interface

See also Surfaces