c4d.CPolygon

class c4d.CPolygon

Represents a polygon.

Attributes

CPolygon.a

Index of first point in the polygon.

Type: int

CPolygon.b

Index of second point in the polygon.

Type: int

CPolygon.c

Index of third point in the polygon.

Type: int

CPolygon.d

Index of optional fourth point in the polygon.

Methods Signatures

CPolygon.__init__()

type t_a

int

CPolygon.__str__()

Returns a string representation of the polygon object.

CPolygon.IsTriangle()

Checks if the polygon is a triangle.

CPolygon.Find()

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

CPolygon.FindEdge()

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

CPolygon.EdgePoints()

Retrieves the point indices for edge.

Methods Documentation

CPolygon.__init__(self, t_a, t_b, t_c, t_d)
Parameters
  • t_a (int) – Index of first point in the polygon.

  • t_b (int) – Index of second point in the polygon.

  • t_c (int) – Index of third point in the polygon.

  • t_d (int) – Index of optional fourth point in the polygon.

CPolygon.__str__(self)
Returns a string representation of the polygon object.

Called if str() is invoked on a CPolygon object. See object.__str__() for more information on Python’s data model.
Return type

str

Returns

The string representation of the polygon.

CPolygon.IsTriangle(self)

Checks if the polygon is a triangle.

New in version R16.021.

Return type

bool

Returns

True if the polygon is a triangle, otherwise False.

CPolygon.Find(self, index)

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

New in version R16.021.

Parameters

index (int) – The vertex index to check.

Return type

int

Returns

The matching polygon vertex number (0-3, equals a - d). NOTOK is returned if there is no match.

CPolygon.FindEdge(self, index1, index2)

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

New in version R16.021.

Parameters
  • index1 (int) – The vertex index of the first edge point.

  • index2 (int) – The vertex index of the second edge point.

Return type

int

Returns

The found polygon edge number (0-3). NOTOK is returned if there is no match.

CPolygon.EdgePoints(self, edge)

Retrieves the point indices for edge.

New in version R16.021.

Parameters

edge (int) – The edge index (0-3).

Return type

Tuple[int, int]

Returns

The index of the first and second edge point.