panda3d.egg.EggPolygon

from panda3d.egg import EggPolygon
class EggPolygon

Bases: EggPrimitive

A single polygon.

Inheritance diagram

Inheritance diagram of EggPolygon

__init__(copy: EggPolygon) → None
__init__(name: str) → None
assign(copy: EggPolygon) → EggPolygon
Return type

EggPolygon

calculateNormal(result: LNormald, cs: CoordinateSystem) → bool

Calculates the true polygon normal–the vector pointing out of the front of the polygon–based on the vertices. This does not return or change the polygon’s normal as set via set_normal().

The return value is true if the normal is computed correctly, or false if the polygon is degenerate and does not have at least three noncollinear vertices.

static getClassType() → TypeHandle
Return type

TypeHandle

isPlanar() → bool

Returns true if all of the polygon’s vertices lie within the same plane, false otherwise.

recomputePolygonNormal(cs: CoordinateSystem) → bool

Recalculates the normal according to the order of the vertices, and sets it. Returns true if the normal is computed correctly, or false if the polygon is degenerate and does not have a normal.

triangulateInPlace(convex_also: bool) → EggPolygon

Subdivides the polygon into triangles and adds those triangles to the parent group node in place of the original polygon. Returns a pointer to the original polygon, which is likely about to be destructed.

If convex_also is true, both concave and convex polygons will be subdivided into triangles; otherwise, only concave polygons will be subdivided, and convex polygons will be copied unchanged into the container.

Return type

EggPolygon

triangulateInto(container: EggGroupNode, convex_also: bool) → bool

Subdivides the polygon into triangles and adds each one to the indicated container. If the polygon is already a triangle, adds an exact copy of the polygon to the container. Does not remove the polygon from its existing parent or modify it in any way.

Returns true if the triangulation is successful, or false if there was some error (in which case the container may contain some partial triangulation).

If convex_also is true, both concave and convex polygons will be subdivided into triangles; otherwise, only concave polygons will be subdivided, and convex polygons will be copied unchanged into the container.