CPolygon Struct Reference

#include <c4d_baseobject.h>

详细描述

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

公共成员函数

  CPolygon ()
  CPolygon ( Int32 t_a, Int32 t_b, Int32 t_c)
  CPolygon ( Int32 t_a, Int32 t_b, Int32 t_c, Int32 t_d)
Int32 operator[] ( 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
Int32 GetPoint ( Int32 index) const

Public Attributes

Int32   a
Int32   b
Int32   c
Int32   d

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

◆  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.

参数
[in] t_a Index of the first point in the polygon.
[in] t_b Index of the second point in the polygon.
[in] t_c Index 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.

参数
[in] t_a Index of the first point in the polygon.
[in] t_b Index of the second point in the polygon.
[in] t_c Index of the third point in the polygon.
[in] t_d Index of the fourth point in the polygon.

成员函数文档编制

◆  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 .

参数
[in] index The vertex index ( 0 - 3 ) to retrieve in the polygon.
返回
The vertex index.

◆  IsTriangle()

Bool IsTriangle ( void  ) const

Checks if the polygon is a triangle.

返回
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 ).

参数
[in] index The vertex index to check.
返回
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 ).

参数
[in] index1 The vertex index of the first edge point.
[in] index2 The vertex index of the second edge point.
返回
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.

参数
[in] edge The edge index.
[out] p1 Assigned the index of the first edge point.
[out] p2 Assigned 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 .

参数
[in] index The point index.
返回
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.