PolyInfo Struct Reference

#include <c4d_baseobject.h>

详细描述

Holds polygon neighboring information.

另请参阅
Neighbor::GetPolyInfo

范例:
The following code browses through all available edges:

if (pObj-> GetType () != Opolygon ) return ;
PolygonObject * pPolyObj = ToPoly (pObj); if (pPolyObj == nullptr ) return ; Neighbor neighbor; const CPolygon * pPolyR = pPolyObj-> GetPolygonR (); Int32 pointCount = pPolyObj-> GetPointCount (); Int32 polyCount = pPolyObj-> GetPolygonCount (); if (pPolyR == nullptr ) return ; if (!neighbor. Init (pointCount, pPolyR, polyCount, nullptr )) return ; for ( Int32 polyIdx = 0; polyIdx < polyCount; polyIdx++) { PolyInfo * polyInfo = neighbor. GetPolyInfo (polyIdx); for ( Int32 edgeIdx = 0; edgeIdx < 4; edgeIdx++) // Test all 4 edges of a polygon { // Only proceed if the edge has not already been processed and edge really exists // For triangles edge 2 from c.......d does not exist as c == d // One can also skip the edgeIdx == 2 && pPolyR[polyIdx].c == pPolyR[polyIdx].d test as polyInfo->mark[2] is always true for triangles if (polyInfo-> mark [edgeIdx] || (edgeIdx == 2 && pPolyR[polyIdx].c == pPolyR[polyIdx].d)) continue ; Int32 edgeA = -1, edgeB = -1; switch (edgeIdx) { case 0: edgeA = pPolyR[polyIdx]. a ; edgeB = pPolyR[polyIdx]. b ; break ; case 1: edgeA = pPolyR[polyIdx]. b ; edgeB = pPolyR[polyIdx]. c ; break ; case 2: edgeA = pPolyR[polyIdx]. c ; edgeB = pPolyR[polyIdx]. d ; break ; case 3: edgeA = pPolyR[polyIdx]. d ; edgeB = pPolyR[polyIdx]. a ; break ; } GePrint ( "Triangle " + String::IntToString (polyIdx)); GePrint ( "Edge" + String::IntToString (edgeA) + " ------------ " + String::IntToString (edgeB));

// Do something with the edge a.......b } }

Public Attributes

Int32   face [4]
Int32   edge [4]
Char   mark [4]

Member Data Documentation

◆  face

Int32 face[4]

The neighboring polygons.

注意
NOTOK it then means there is no neighbor.

◆  edge

Int32 edge[4]

The edges of the polygon.

◆  mark

Char mark[4]

false if that polygon "generated" an edge.
For example think of 2 polygons that share an edge, one has set mark = false for the edge because it was the first and "built" the edge and the other(s) will set mark = true as no new edge had to be generated.

Opolygon
#define Opolygon
Polygon - PolygonObject.
定义: ge_prepass.h:975
CPolygon::b
Int32 b
Index of the second point in the polygon.
定义: c4d_baseobject.h:46
PointObject::GetPointCount
Int32 GetPointCount(void) const
定义: c4d_baseobject.h:1439
PolygonObject::GetPolygonR
const CPolygon * GetPolygonR(void) const
定义: c4d_baseobject.h:1738
Neighbor::GetPolyInfo
PolyInfo * GetPolyInfo(Int32 poly)
定义: c4d_baseobject.h:2571
PolyInfo
定义: c4d_baseobject.h:2423
CPolygon
Represents a polygon that can be either a triangle or a quadrangle.
定义: c4d_baseobject.h:43
CPolygon::d
Int32 d
Index of the fourth point in the polygon.
定义: c4d_baseobject.h:48
GePrint
void GePrint(const maxon::String &str)
ToPoly
#define ToPoly(op)
Casts a BaseObject* to a PolygonObject*.
定义: c4d_baseobject.h:2174
String::IntToString
static String IntToString(Int32 v)
定义: c4d_string.h:495
PolygonObject::GetPolygonCount
Int32 GetPolygonCount(void) const
定义: c4d_baseobject.h:1752
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
PolygonObject
定义: c4d_baseobject.h:1597
CPolygon::c
Int32 c
Index of the third point in the polygon.
定义: c4d_baseobject.h:47
PolyInfo::mark
Char mark[4]
定义: c4d_baseobject.h:2427
Neighbor::Init
virtual Bool Init(Int32 pcnt, const CPolygon *vadr, Int32 vcnt, BaseSelect *bs)
Neighbor
定义: c4d_baseobject.h:2464
C4DAtom::GetType
Int32 GetType() const
定义: c4d_baselist.h:1348
CPolygon::a
Int32 a
Index of the first point in the polygon.
定义: c4d_baseobject.h:45