CollisionPolygon

class CollisionPolygon

Bases: CollisionPlane

Inheritance diagram

Inheritance diagram of CollisionPolygon

CollisionPolygon(LVecBase3 const &a, LVecBase3 const &b, LVecBase3 const &c)
CollisionPolygon(LVecBase3 const &a, LVecBase3 const &b, LVecBase3 const &c, LVecBase3 const &d)

Creates an invalid polygon. Only used when reading from a bam file.

static TypeHandle get_class_type(void)
std::size_t get_num_points(void) const

Returns the number of vertices of the CollisionPolygon.

LPoint3 get_point(std::size_t n) const

Returns the nth vertex of the CollisionPolygon, expressed in 3-D space.

bool is_concave(void) const

Returns true if the CollisionPolygon appears to be concave, or false if it is safely convex.

bool is_valid(void) const

Returns true if the CollisionPolygon is valid (that is, it has at least three vertices), or false otherwise.

bool verify_points(LPoint3 const &a, LPoint3 const &b, LPoint3 const &c)
bool verify_points(LPoint3 const &a, LPoint3 const &b, LPoint3 const &c, LPoint3 const &d)

Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.

Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.

Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.

This does not check that the polygon defined is convex; that check is made later, once we have projected the points to 2-d space where the decision is easier.