EggPolygon

class EggPolygon

Bases: EggPrimitive

A single polygon.

Inheritance diagram

Inheritance diagram of EggPolygon

explicit EggPolygon(std::string const &name = "")
EggPolygon(EggPolygon const &copy)
bool calculate_normal(LNormald &result, CoordinateSystem cs = ::CS_default) const

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 TypeHandle get_class_type(void)
bool is_planar(void) const

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

bool recompute_polygon_normal(CoordinateSystem cs = ::CS_default)

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.

PointerTo<EggPolygon> triangulate_in_place(bool convex_also)

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.

bool triangulate_into(EggGroupNode *container, bool convex_also) const

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.