PolyTriangulate Class Reference

#include <c4d_baseobject.h>

详细描述

Polygon triangulation class.

注意
Has to be created with Alloc() and destroyed with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

公共成员函数

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)

构造函数 & 析构函数文档编制

◆  PolyTriangulate()

PolyTriangulate () private

◆  ~PolyTriangulate()

~ PolyTriangulate () private

成员函数文档编制

◆  Alloc()

static PolyTriangulate * Alloc ( )
static

Allocates a poly triangulate. Destroy the allocated poly triangulate with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

返回
The allocated poly triangulate, or nullptr if the allocation failed.

◆  Free()

static void Free ( PolyTriangulate *&  pTriang )
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.

◆  Triangulate()

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.

警告
Do not store pPolys for later use. It will get invalid after the next Triangulate() call or when the class instance is destroyed.
注意
使用 TriangulateRelease() to store pPolys for a later use.
参数
[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.
返回
true if triangulation was successful, otherwise false .

◆  TriangulateRelease()

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.

警告
The returned array pPolys needs to be freed with DeleteMem() afterwards.
参数
[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.
返回
true if triangulation was successful, otherwise false .

◆  HasIdentical()

Bool HasIdentical ( )

Checks if there were any identical points in the triangulation, i.e. points with a distance less than 0.0001 .

返回
true if there were identical points, otherwise false .

◆  SetPolygonMatrix()

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.

◆  GetState()

UInt32 GetState ( )

Gets the state of the triangulation engine.

返回
The error state flags: TRIANGSTATE