Neighbor Class Reference

#include <c4d_baseobject.h>

详细描述

Helper class to get neighboring polygons from edges and points:

注意
This class assumes that the geometry is clean such that an edge is only shared by two polygons.
If this is not the case then the information may not be correct.
警告
The polygon array passed to Init() must not be modified during the use of the class.
For example, if a polygon object is resized or its polygons modified the class may crash if it is used afterwards.

Private Attributes

EnumerateEdges *  ee

Constructor/Destructor

  Neighbor ()
virtual  ~Neighbor ()

Init

virtual Bool   Init ( Int32 pcnt, const CPolygon *vadr, Int32 vcnt, BaseSelect *bs)

Get Neighbor Information

void  GetEdgePolys ( Int32 a, Int32 b, Int32 *first, Int32 *second)
void  GetPointPolys ( Int32 pnt, Int32 **dadr, Int32 *dcnt)
void  GetPointOneRingPoints ( Int32 pnt, Int32 **dadr, Int32 *dcnt)
Int32   GetEdgeCount (void)
PolyInfo GetPolyInfo ( Int32 poly)
Int32   GetNeighbor ( Int32 a, Int32 b, Int32 poly)
Bool   GetNGons ( PolygonObject *op, Int32 &ngoncnt, NgonNeighbor *&ngons)

杂项

void  Flush ()
void  ResetAddress (const CPolygon *a_polyadr)

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

◆  Neighbor()

Neighbor ( )

Default constructor.

◆  ~Neighbor()

virtual ~ Neighbor ( )
virtual

Default destructor.

成员函数文档编制

◆  Init()

virtual Bool Init ( Int32   pcnt ,
const CPolygon vadr ,
Int32   vcnt ,
BaseSelect bs  
)
virtual

Initializes the internal polygon information.

警告
Must be called before the class can be used to get the neighboring polygons.
参数
[in] pcnt The total number of points from the polygon object. This can be obtained calling PointObject::GetPointCount() .
[in] vadr Pointer to the polygons array. This can be obtained calling PolygonObject::GetPolygonR() . The caller owns the pointed polygons array.
[in] vcnt The total number of polygons in the polygons array. This can be obtained calling PolygonObject::GetPolygonCount() .
[in] bs Pointer to the polygon selection used to build the neighbor information. Set nullptr to use all polygons. The caller owns the pointed base select.
返回
true if the initialization was successful, otherwise false .

◆  GetEdgePolys()

void GetEdgePolys ( Int32   a ,
Int32   b ,
Int32 first ,
Int32 second  
)

Gets the polygons that neighbor the given edge.

参数
[in] a The point index that defines the first edge point.
[in] b The point index that defines the second edge point.
[in] first Assigned the first polygon index associated with the edge.
[in] second Assigned the second polygon index associated with the edge.

◆  GetPointPolys()

void GetPointPolys ( Int32   pnt ,
Int32 **  dadr ,
Int32 dcnt  
)

Gets the polygons that are attached to the given point.

注意
No memory allocation/freeing is necessary.

范例:
To get the polygons around say point 137 we would use:

Int32 *dadr = nullptr , dcnt = 0, poly; neighbor. GetPointPolys (137, &dadr, &dcnt);
for ( Int32 i=0; i<dcnt; i++) { poly = dadr[i];

// Do something }

参数
[in] pnt The point index to use to find the associated polygons.
[in] dadr Assigned the address of the returned polygon array.
[in] dcnt Assigned the number of polygons returned in the array daddr .

◆  GetPointOneRingPoints()

void GetPointOneRingPoints ( Int32   pnt ,
Int32 **  dadr ,
Int32 dcnt  
)

Gets the points that are attached through one edge to the given point.

由于
R19
注意
No memory allocation/freeing is necessary.

范例:
To get the points around say point 137 we would use:

Int32 *dadr = nullptr , dcnt = 0, poly; neighbor. GetPointOneRingPoints (137, &dadr, &dcnt); for ( Int32 i=0; i<dcnt; i++) { pointIndex = dadr[i];

// Do something }

参数
[in] pnt The point index to use to find the associated one ring points.
[in] dadr Assigned the address of the returned points array. The caller owns the pointed points array.
[in] dcnt Assigned the number of points returned in daddr .

◆  GetEdgeCount()

Int32 GetEdgeCount ( void  )

Gets the total number of edges found.

返回
The number of edges in the given polygons in Init() .

◆  GetPolyInfo()

PolyInfo * GetPolyInfo ( Int32   poly )

Gets neighbor information about the given polygon.

参数
[in] poly The polygon index to get the neighbor information for.
返回
The neighbor information. The neighbor object owns the pointed polygon information.

◆  GetNeighbor()

Int32 GetNeighbor ( Int32   a ,
Int32   b ,
Int32   poly  
)

Gets the polygon opposite to poly with respect to the edge from point a to b .

参数
[in] a The point index that defines the first edge point.
[in] b The point index that defines the second edge point.
[in] poly The index of the polygon to get the polygon opposite to.
返回
The opposite polygon index, or if formatParam{poly} is not one of the edge polygons, or NOTOK if none exists.

◆  GetNGons()

Bool GetNGons ( PolygonObject op ,
Int32 ngoncnt ,
NgonNeighbor *&  ngons  
)

Gets the N-gon neighbors.

参数
[in] op The polygon object. The caller owns the pointed polygon object.
[out] ngoncnt Assigned the N-gon count.
[out] ngons Assigned a pointer to the N-gon neighbor information.
Free the array afterwards with DeleteMem() (not the segments, points, edges or neighbor members).
返回
true if the N-gon neighbors were successfully retrieved, otherwise false .

◆  Flush()

void Flush ( )

Flushes the neighbor information.

◆  ResetAddress()

void ResetAddress ( const CPolygon a_polyadr )

Allows to set the new pointer to the polygon object if changed.
It is then possible to continue using the Neighbor data.

警告
Use carefully!
The array lengths and orders must not have changed, only the pointer used.
参数
[in] a_polyadr The new polygon address to set.

Member Data Documentation

◆  ee

EnumerateEdges* ee private
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
Neighbor::GetPointOneRingPoints
void GetPointOneRingPoints(Int32 pnt, Int32 **dadr, Int32 *dcnt)
定义: c4d_baseobject.h:2558
Neighbor::GetPointPolys
void GetPointPolys(Int32 pnt, Int32 **dadr, Int32 *dcnt)
定义: c4d_baseobject.h:2534