IMeshMods(64) Interface
- SetVertexCoord
- SetNormal
- FixupNormals
- Offset
- Clear
- ClearList
- Begin
- End
- SwapSide
- ToLocal
- ToGlobal
This interface allows modification of the meshed surface, which implements
it. Note that these modifications are low- level ones. Special care has to be
taken to ensure that normals are setup and directed correctly. IMeshMods
can be queried from IMesh interface.
Note that in case of a parametric surfaces (See Generic 3D Object)
any modifications of the surface parameters (for example via IElement
) and subsequent call to UpdateSurface
method of DG Kernel control or call for Update method of IModel
interface will remove any modifications performed directly.
Methods of this interface requires a call to IModel.Update() or DG Kernel.UpdateSurface() for changes to appear in 3D view
See more at Meshed Surface Modifications
See also Morph sample, IMesh,
Interface List
HRESULT SetVertexCoord(int vertex, double x, double y, double z )
Parameters
vertex - [in]
position of the vertex in vertex
list of the mesh.
x, y, z - [in] - New coordinates of the vertex.
Returns
- S_OK in case of
success.
-
- Remarks:
This method allows direct manipulation of vertices in the mesh.
HRESULT SetNormal(int vertex, double vx, double vy, double vz )
Parameters
vertex - [in]
position of the vertex in vertex
list of the mesh.
vx, vy, vz- [in] - New coordinates of the normal.
Returns
- S_OK in case of
success.
-
- Remarks:
This method allows direct manipulation or normals in the mesh. Note that when there is a
singularity at the point, the surface can have several normals. In this case the
modification is applied to the first normal. To modify other normals use
IVertex
interface, which can be obtained via path: IMesh->IMeshEx->IMeshEx.GetVertex->IVertex
HRESULT FixupNormals(double creaseDegrees, double tolerDegrees)
Parameters
creaseDegrees - [in]
Crease angle in degrees.
tolerDegrees- [in] - Tolerance Angle in degrees.
Returns
- S_OK in case of
success.
-
- Remarks:
This method recalculates all normals in the mesh. It is useful in Mesh
Entities, which are normally created on import of objects from external formats.
In this case normals are created directly by reading from the file without
relating them to the geometry of the surface. FixupNormals allows correcting
possible problems with supplied normals.
Note that the method should be used judiciously because sometimes problems
with normals are caused by incorrect underlying mesh, in which case the result
may be undesirable or there where some other reasons for supplying that sort of
normals.
The Crease Angle is the angle used to determine whether two adjoin simplexes
form a sharp edge. All neighbor simplexes with angle between their planes under
creaseDegrees will be considered
as a part of smooth surface.
If angle between the old normal and newly recalculated normal is less than
the Tolerance Angle, the normal will be left unchanged. Set tolerDegrees
to a negative or zero to skip performing this test.
Note: for singular vertexes (vertexes with several normals) the method may
change numbering of the normals. See also IVertex.
HRESULT Offset(double dist)
Parameters
dist - [in] Offset distance. Can be
negative
-
- Remarks:
This method translates every vertex in the mesh along its normal by the
specified distance. When a vertex has several normals (edge or corner) an
average direction is used instead. dist can be
negative, in which case the object will appear shrunk, otherwise the surface
will appear expanded.
Note that generally offsetting a surface by large distance can create self
interentitys and sharp edges.
HRESULT Clear()
-
- Remarks:
Deletes all elements form the mesh. As the result the object will not have a
visible surface
HRESULT ClearList(int dim)
Parameters
dim -[in] Identifies type of elements
to delete: 0 - verticies, 1 - segments, 2 - simplexes
-
- Remarks:
-
Deletes relevant elements from the list. Notice often as the result the mesh will
be an invalid state. When mesh is not empty either new elements of dim type have
to be added of elements of the other dimention need to be removed before
rendering or otherwise using the object
HRESULT Begin()
-
- Remarks:
Call this method to notify the software about series of mesh modification calls.
See remarks for the End() method below. Call for this method should be followed
by call to the End() method in the end of the series. This method affects only
performance of mesh manipulation.
HRESULT End(int action)
Parameters
action - [in] Specifies method of
updating normals to to be performed. Valid values are enumerated in EMeshModsAction.
See remarks
-
- Remarks:
-
Mesh modifications performed via calls to IMeshTopol.AddSimplex
and
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
at Meshed Surface Modifications
Valid values for the action parameter are enumerated in EMeshModsAction:
- eMeshActionNone - End the modification series without any additional calculations. Use this option when vertex normals are recalculated
and set using IVertex.SetNormal() or other method by the application itself
- eMeshActionNormalsFastApprox - Recalculate adjacent normals using approximate but fast method. Use this option for very dense mesh
when precise normals are less important
- eMeshActionNormalsMedium - Recalculate adjacent normals using method which is not completely accurate but gives good performance
- eMeshActionNormalsFull - Recalculate adjacent normals using the most accurate calculation. This option is the slowest for large meshes
- eMeshActionNormalsAuto - Automatically select one of the above methods depending on size of the mesh and performance of the computer.
In this case the software estimates time to execute the calculation. If the estimated time is less than
MeshModsAutoUpdateLimit0
eMeshActionNormalsFull algorithm is used. Otherwise if If the estimated time is less than
MeshModsAutoUpdateLimit1
eMeshActionNormalsMedium algorithm is used. Otherwise eMeshActionNormalsFastApprox method is executed. Notice that
MeshModsAutoUpdateLimit* parameters can be tuned in using the component context
The Begin()/End() sequence is not required and does not improve performance of a
single isolated mesh modification call.
HRESULT SwapSide()
Changes positive side of the mesh. Re-orders vertices of every simplex to keep it
in Counter Clock Wise order and changes direction of all normals to the opposite
HRESULT ToLocal(IFrame* frame)
Makes cordinates of all elements in this mesh relative to frame
HRESULT ToGlobal(IFrame* frame)
Assuming this mesh is relative to frame converts all elements to
global axes
|