DG Kernel Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
Overview of the software
What is new
Licensing
Collapse ModelsModels
Expand DG Kernel ComponentsDG Kernel Components
Expand API ReferenceAPI Reference
Expand Samples and TutorialsSamples and Tutorials
Expand GraphicsGraphics
Expand Math ObjectsMath Objects
Expand DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation LinksHome Page > Models > Entities > Geometry > Mesh > Mesh Search Documentation


Mesh

For rendering and for various operations surfaces in DG Kernel (and nearly all CAD software) are often 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 IEntity_DG or IGeometry_DG

Meshed Surface Modifications

To modify mesh programmatically, use Meshing Interfaces. To access these interfaces query IMesh, IMeshMods or IMeshTopol from the relevant IEntity_DG or IGeometry_DG.
Use query or methods of these to access the rest of meshing interfaces.

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

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 performance 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 vertices using IMeshTolpol.AddVertex interface
  3. Add Simplexes using IMeshTolpol.AddSimplex interface
  4. Add and define normals to vertices 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 indices using ISimplex interface

See also Surfaces