#include <c4d_baseobject.h>
Polygon triangulation class.
公共成员函数 |
|
Bool | Triangulate (const 向量 *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 向量 *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/Free |
|
static PolyTriangulate * | Alloc () |
static void | Free ( PolyTriangulate *&pTriang) |
|
|
|
static |
Allocates a poly triangulate. Destroy the allocated poly triangulate with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.
|
static |
Destructs poly triangulates allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.
[in,out] | pTriang | The poly triangulate to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
Bool Triangulate | ( | const 向量 * | 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.
[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. |
Bool TriangulateRelease | ( | const 向量 * | 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
.
如同
Triangulate()
, except that the memory is not freed by the
PolyTriangulate
instance.
[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. |
Bool HasIdentical | ( | ) |
Checks if there were any identical points in the triangulation, i.e. points with a distance less than 0.0001 .
void SetPolygonMatrix | ( | Matrix64 * | m | ) |
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.
[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. |
UInt32 GetState | ( | ) |
Gets the state of the triangulation engine.