DGKC Control Documentation

Skip Navigation Links.
Skip Navigation LinksHome Page > Models > Entities > Geometry > Mesh > Mesh Go to ActiveX docs Search Documentation


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_DG 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_DG from the relevant IEntity_DG or IGeometry_DG.
Use query or methods of these to access the rest of meshing interfaces.

Performance optimisation

Mesh modifications performed via calls to IMesh_DG.AddSimplex IVertex_DG.SetPosition 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 IMesh_DG.Begin() before the series of modification calls and call IMesh_DG.End() in the end of the series. See more details in remarks for IMesh_DG.End().

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

  1. Call IMesh_DG.Begin() to notify software about series of changes
  2. Add vertices using IMesh_DG.AddVertex interface
  3. Add Simplexes using IMesh_DG.AddSimplex interface
  4. Add and define normals to vertices using IVertex_DG interface
  5. Call IMesh_DG.End( MeshModsAction.None ) to notify software about the end of modifications. The MeshModsAction.None 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 IMesh_DG.End() with a more suitable parameter. Mesh with corners or edges also requires defining normal indices using ISimplex_DG interface

See also Surfaces