#include <c4d_baseobject.h>
Polygon triangulation class.
- Note
- Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
|
Bool | Triangulate (const Vector *pvPoints, Int32 lPointCount, const Int32 *plSegments, Int32 lSegCnt, CPolygon *&pPolys, Int32 &lPolyCount, Int32 lFlags=0, const Int32 *plMap=nullptr, BaseThread *pThread=nullptr, Int32 lConstraints=0, const Int32 *plConstrainedEdges=nullptr) |
|
Bool | TriangulateRelease (const Vector *pvPoints, Int32 lPointCount, const Int32 *plSegments, Int32 lSegCnt, CPolygon *&pPolys, Int32 &lPolyCount, Int32 lFlags=0, const Int32 *plMap=nullptr, BaseThread *pThread=nullptr, Int32 lConstraints=0, const Int32 *plConstrainedEdges=nullptr) |
|
Bool | HasIdentical () |
|
void | SetPolygonMatrix (Matrix64 *m) |
|
UInt32 | GetState () |
|
◆ PolyTriangulate()
◆ ~PolyTriangulate()
◆ Alloc()
Allocates a poly triangulate. Destroy the allocated poly triangulate with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
- Returns
- The allocated poly triangulate, or nullptr if the allocation failed.
◆ Free()
Destructs poly triangulates allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.
- Parameters
-
[in,out] | pTriang | The poly triangulate to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
◆ Triangulate()
Bool Triangulate |
( |
const Vector * |
pvPoints, |
|
|
Int32 |
lPointCount, |
|
|
const Int32 * |
plSegments, |
|
|
Int32 |
lSegCnt, |
|
|
CPolygon *& |
pPolys, |
|
|
Int32 & |
lPolyCount, |
|
|
Int32 |
lFlags = 0 , |
|
|
const Int32 * |
plMap = nullptr , |
|
|
BaseThread * |
pThread = nullptr , |
|
|
Int32 |
lConstraints = 0 , |
|
|
const Int32 * |
plConstrainedEdges = nullptr |
|
) |
| |
Triangulates the points in pvPoints and returns the result in pPolys. The allocated array is freed on the next call to Triangulate() or when the PolyTriangulate instance is freed.
- Warning
- Do not store pPolys for later use. It will get invalid after the next Triangulate() call or when the class instance is destroyed.
- Note
- Use TriangulateRelease() to store pPolys for a later use.
- Parameters
-
[in] | pvPoints | The points to triangulate. The caller owns the pointed points array. |
[in] | lPointCount | The number of points in pvPoints array. |
[in] | plSegments | The segments array, or nullptr. The number of segment points is stored in each element. The caller owns the pointed segments array. |
[in] | lSegCnt | The number of segments in plSegments array. |
[out] | pPolys | Assigned a pointer to the triangulated polygons array. |
[out] | lPolyCount | Assigned the number of triangulated polygons in pPolys. |
[in] | lFlags | The triangulation flags: POLY_TRIANG |
[in] | plMap | An optional point map. The caller owns the pointed point map.
plMap allows to choose which vertices should be used in the triangulation.
Imagine a vector array with 100 elements; to triangulate the points 10, 20, 30, 40 and 50, lPointCount would be 5 and plMap = { 10, 20, 30, 40, 50 }. |
[in] | pThread | A thread for the operation. The caller owns the pointed thread. |
[in] | lConstraints | Reserved for future use. |
[in] | plConstrainedEdges | Reserved for future use. |
- Returns
- true if triangulation was successful, otherwise false.
◆ TriangulateRelease()
Bool TriangulateRelease |
( |
const Vector * |
pvPoints, |
|
|
Int32 |
lPointCount, |
|
|
const Int32 * |
plSegments, |
|
|
Int32 |
lSegCnt, |
|
|
CPolygon *& |
pPolys, |
|
|
Int32 & |
lPolyCount, |
|
|
Int32 |
lFlags = 0 , |
|
|
const Int32 * |
plMap = nullptr , |
|
|
BaseThread * |
pThread = nullptr , |
|
|
Int32 |
lConstraints = 0 , |
|
|
const Int32 * |
plConstrainedEdges = nullptr |
|
) |
| |
Triangulates the points in pvPoints and returns the result in pPolys.
Same as Triangulate(), except that the memory is not freed by the PolyTriangulate instance.
- Warning
- The returned array pPolys needs to be freed with DeleteMem() afterwards.
- Parameters
-
[in] | pvPoints | The points to triangulate. The caller owns the pointed points array. |
[in] | lPointCount | The number of points in pvPoints array. |
[in] | plSegments | The segments array, or nullptr. The number of segment points is stored in each element. The caller owns the pointed segments array. |
[in] | lSegCnt | The number of segments in plSegments array. |
[out] | pPolys | Assigned a pointer to the triangulated polygons array. |
[out] | lPolyCount | Assigned the number of triangulated polygons in pPolys. |
[in] | lFlags | The triangulation flags: POLY_TRIANG |
[in] | plMap | An optional point map. The caller owns the pointed point map.
plMap allows to choose which vertices should be used in the triangulation.
Imagine a vector array with 100 elements; to triangulate the points 10, 20, 30, 40 and 50, lPointCount would be 5 and plMap = { 10, 20, 30, 40, 50 }. |
[in] | pThread | A thread for the operation. The caller owns the pointed thread. |
[in] | lConstraints | Reserved for future use. |
[in] | plConstrainedEdges | Reserved for future use. |
- Returns
- true if triangulation was successful, otherwise false.
◆ HasIdentical()
Checks if there were any identical points in the triangulation, i.e. points with a distance less than 0.0001.
- Returns
- true if there were identical points, otherwise false.
◆ SetPolygonMatrix()
Sets the matrix for the triangulation.
The triangulation usually calculates the normal of the points set and projects the points into a plane that is described by this normal and the point (0, 0, 0).
To speed up the triangulation use this if the matrix is already calculated.
The vector in m->v3 must be the polygon normal. All vectors must be perpendicular to each other.
- Parameters
-
[in] | m | The polygon matrix to use, or nullptr to enable automatic calculation of the polygon normal again.
The pointed matrix must be valid as long as calls to the triangulate methods are made, or until a new matrix or nullptr is set.
The caller owns the pointed matrix. |
◆ GetState()
Gets the state of the triangulation engine.
- Returns
- The error state flags: TRIANGSTATE