DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Upgrading Native Apps
Licensing
Collapse ModelsModels
Collapse DG Kernel ControlsDG Kernel Controls
Collapse API ReferenceAPI Reference
Interface List
Vector Space
Collapse General GeometryGeneral Geometry
Collapse ModelModel
Collapse ViewView
Collapse General ComputingGeneral Computing
Collapse ViewsViews
Collapse Samples and TutorialsSamples and Tutorials
Collapse GraphicsGraphics
Collapse Math ObjectsMath Objects
Collapse DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation Links Go to DGKC docs Search Documentation


IMeshTopol(64) Interface

AddVertex
RemoveVertex
AddSimplex
RemoveSimplex

This interface allows changing structure of the mesh or even build a whole new meshed surface. 

This interface is available only in Pro or Enterprise level products, where it can be queried from IMesh interface

Methods of this interface requires a call to IModel.Update() or DG Kernel.UpdateSurface() for changes to appear in 3D view

See also Morph sample, IMesh, Interface List


HRESULT AddVertex(POSN* posnResult)

Parameters

posnResult - [out] - position of the newly created vertex in the vertex list of the mesh.

Returns

S_OK in case of success.
Remarks:

This methods creates a new vertex and inserts it into vertex list of the mesh. The position of the vertex is returned in  posnResult. Note: it is wrong to assume that the vertex is added at the end of the vertex list. 


HRESULT RemoveVertex(POSN vertex)

Parameters

vertex - [in] position of the vertex in vertex list of the mesh.

Return Values

S_OK in case of success.
Remarks:

As the result the vertex will be removed from the vertex list. Note that this operation will not remove the adjoined simplexes and normally does not have any visual effect. 


HRESULT AddSimplex(POSN vert0, POSN vert1, POSN vert2, double creaseAngle)

Parameters

vert0, vert1, vert2 - [in] positions of the vertices, which will become corners of the simplex.

creaseAngle - [in] - Crease angle in degrees for automatic handling of normals at vertices of the newly added simplex.

Return Values

S_OK in case of success.
Remarks:

Will add a new simplex at the end of the simplex list. The simplex will have vertices identified by vert0, vert1 and vert2 as its corners. 

creaseAngle (degrees) is used to determine how normal at a corner of the new simplex should be handled. The algorithm is: First the normal vector of the face of the simplex is calculated. Than normal, which has the smallest angle with the face normal is found at the corner vertex. If the smallest angle is less than creaseAngle the nearest normal is averaged with the face normal. In the opposite case the face normal is added as a new normal at the vertex.

Set creaseAngle to a negative number to skip normal modifications

In practice, when creaseAngle is non-negative, it should never be zero and rarely less than 10. It should be less than 180 and rarely greater than 90. Low values of creaseAngle reduce performance and increase memory consumption. It is recommended to experiment with this parameter. Setting creaseAngle too high values causes geometrically sharp edges not to look sharp on the screen.

It is more efficient to add any simplexes after coordinates of all vertices have been calculated. Otherwise calculated normals will be incorrect, which result in incorrect lighting of the object. To recalculate all normals in the mesh call IMeshMods.FixupNormals method.


HRESULT RemoveSimplex(POSN simplex)

Parameters

simplex - [in] position of the simplex in simplex list of the mesh.

Return Values

S_OK in case of success.
Remarks:

Removes a simplex from the mesh. This operation does not remove vertices of the simplex.