CPolygon Struct Reference

#include <c4d_baseobject.h>

Detailed Description

Represents a polygon that can be either a triangle or a quadrangle.

Public Member Functions

 CPolygon ()
 
 CPolygon (Int32 t_a, Int32 t_b, Int32 t_c)
 
 CPolygon (Int32 t_a, Int32 t_b, Int32 t_c, Int32 t_d)
 
Int32operator[] (Int32 index) const
 
Bool IsTriangle (void) const
 
Int32 Find (Int32 index) const
 
Int32 FindEdge (Int32 index1, Int32 index2) const
 
void EdgePoints (Int32 edge, Int32 &p1, Int32 &p2) const
 
Int32GetPoint (Int32 index) const
 

Public Attributes

Int32 a
 
Int32 b
 
Int32 c
 
Int32 d
 

Constructor & Destructor Documentation

◆ CPolygon() [1/3]

CPolygon ( )

Constructs a polygon by default.

◆ CPolygon() [2/3]

CPolygon ( Int32  t_a,
Int32  t_b,
Int32  t_c 
)

Constructs a triangle.

Parameters
[in]t_aIndex of the first point in the polygon.
[in]t_bIndex of the second point in the polygon.
[in]t_cIndex of the third point in the polygon.

◆ CPolygon() [3/3]

CPolygon ( Int32  t_a,
Int32  t_b,
Int32  t_c,
Int32  t_d 
)

Constructs a quadrangle.

Parameters
[in]t_aIndex of the first point in the polygon.
[in]t_bIndex of the second point in the polygon.
[in]t_cIndex of the third point in the polygon.
[in]t_dIndex of the fourth point in the polygon.

Member Function Documentation

◆ operator[]()

Int32& operator[] ( Int32  index) const

Vertex index array operator.
Accesses the polygon's vertex indices through their polygon vertex numbers (0 - 3) instead of a, b, c, d.

Parameters
[in]indexThe vertex index (0 - 3) to retrieve in the polygon.
Returns
The vertex index.

◆ IsTriangle()

Bool IsTriangle ( void  ) const

Checks if the polygon is a triangle.

Returns
true if the polygon is a triangle, otherwise false.

◆ Find()

Int32 Find ( Int32  index) const

Checks if one of the polygon vertex indices is equal to index and returns the found polygon vertex number (0 - 3, equals a - d).

Parameters
[in]indexThe vertex index to check.
Returns
The matching polygon vertex number (0 - 3, equals a - d). NOTOK is returned if there is no match.

◆ FindEdge()

Int32 FindEdge ( Int32  index1,
Int32  index2 
) const

Checks if the vertex indices index1 and index2 form an edge in the polygon. If so the polygon edge number is returned (0 - 3).

Parameters
[in]index1The vertex index of the first edge point.
[in]index2The vertex index of the second edge point.
Returns
The found polygon edge number (0 - 3), or NOTOK if there is no match.

◆ EdgePoints()

void EdgePoints ( Int32  edge,
Int32 p1,
Int32 p2 
) const

Gets the point indices for an edge index.

Parameters
[in]edgeThe edge index.
[out]p1Assigned the index of the first edge point.
[out]p2Assigned the index of the second edge point.

◆ GetPoint()

Int32& GetPoint ( Int32  index) const

Gets the point with modulo for the number of points in the polygon.
If the polygon is a triangle it goes a, b, c, a, b , c etc thus point 3 will be point a again, but with a quad it goes a, b, c, d, a, b, c, d... so point 3 will be d.

Parameters
[in]indexThe point index.
Returns
The point index.

Member Data Documentation

◆ a

Int32 a

Index of the first point in the polygon.

◆ b

Int32 b

Index of the second point in the polygon.

◆ c

Int32 c

Index of the third point in the polygon.

◆ d

Int32 d

Index of the fourth point in the polygon.