Panda3D
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions

CollisionPolygon Class Reference

Inheritance diagram for CollisionPolygon:
CollisionPlane CollisionSolid CopyOnWriteObject CachedTypedWritableReferenceCount TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase CollisionGeom

List of all members.

Classes

class  PointDef

Public Member Functions

 CollisionPolygon (const LVecBase3 &a, const LVecBase3 &b, const LVecBase3 &c)
 CollisionPolygon (const LVecBase3 &a, const LVecBase3 &b, const LVecBase3 &c, const LVecBase3 &d)
 CollisionPolygon (const CollisionPolygon &copy)
 CollisionPolygon (const LPoint3 *begin, const LPoint3 *end)
virtual TypeHandle force_init_type ()
virtual LPoint3 get_collision_origin () const
 Returns the point in space deemed to be the "origin" of the solid for collision purposes.
int get_num_points () const
 Returns the number of vertices of the CollisionPolygon.
LPoint3 get_point (int n) const
 Returns the nth vertex of the CollisionPolygon, expressed in 3-D space.
virtual PStatCollectorget_test_pcollector ()
 Returns a PStatCollector that is used to count the number of intersection tests made against a solid of this type in a given frame.
virtual TypeHandle get_type () const
virtual PStatCollectorget_volume_pcollector ()
 Returns a PStatCollector that is used to count the number of bounding volume tests made against a solid of this type in a given frame.
bool is_concave () const
 Returns true if the CollisionPolygon appears to be concave, or false if it is safely convex.
bool is_valid () const
 Returns true if the CollisionPolygon is valid (that is, it has at least three vertices), or false otherwise.
virtual CollisionSolidmake_copy ()
 MAKE_SEQ (get_points, get_num_points, get_point)
virtual void output (ostream &out) const
virtual PT (PandaNode) get_viz(const CullTraverser *trav
virtual void write (ostream &out, int indent_level=0) const
virtual void write_datagram (BamWriter *manager, Datagram &me)
 Function to write the important information in the particular object to a Datagram.
virtual void xform (const LMatrix4 &mat)
 Transforms the solid by the indicated matrix.

Static Public Member Functions

static void flush_level ()
 Flushes the PStatCollectors used during traversal.
static TypeHandle get_class_type ()
static void init_type ()
static TypedWritablemake_CollisionPolygon (const FactoryParams &params)
 Factory method to generate a CollisionPolygon object.
static void register_with_read_factory ()
 Factory method to generate a CollisionPolygon object.
static bool verify_points (const LPoint3 &a, const LPoint3 &b, const LPoint3 &c, const LPoint3 &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.
static bool verify_points (const LPoint3 *begin, const LPoint3 *end)
 Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.
static bool verify_points (const LPoint3 &a, const LPoint3 &b, const LPoint3 &c)
 Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.

Public Attributes

virtual const
CullTraverserData bool
bounds_only 
const
virtual const CullTraverserDatadata

Protected Member Functions

virtual void fill_viz_geom ()
 Fills the _viz_geom GeomNode up with Geoms suitable for rendering this solid.
void fillin (DatagramIterator &scan, BamReader *manager)
 Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.
virtual PT (CollisionEntry) test_intersection_from_line(const CollisionEntry &entry) const
virtual PT (CollisionEntry) test_intersection_from_parabola(const CollisionEntry &entry) const
virtual PT (CollisionEntry) test_intersection_from_segment(const CollisionEntry &entry) const
virtual PT (CollisionEntry) test_intersection_from_sphere(const CollisionEntry &entry) const
virtual PT (BoundingVolume) compute_internal_bounds() const
virtual PT (CollisionEntry) test_intersection_from_ray(const CollisionEntry &entry) const

Detailed Description

Definition at line 31 of file collisionPolygon.h.


Member Function Documentation

void CollisionPolygon::fill_viz_geom ( ) [protected, virtual]

Fills the _viz_geom GeomNode up with Geoms suitable for rendering this solid.

Reimplemented from CollisionPlane.

Definition at line 901 of file collisionPolygon.cxx.

void CollisionPolygon::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.

Reimplemented from CollisionPlane.

Definition at line 1473 of file collisionPolygon.cxx.

References BamReader::get_file_minor_ver(), DatagramIterator::get_uint16(), LVecBase2f::read_datagram(), and LVecBase3f::size().

Referenced by make_CollisionPolygon().

void CollisionPolygon::flush_level ( ) [inline, static]

Flushes the PStatCollectors used during traversal.

Reimplemented from CollisionPlane.

Definition at line 134 of file collisionPolygon.I.

LPoint3 CollisionPolygon::get_collision_origin ( ) const [virtual]

Returns the point in space deemed to be the "origin" of the solid for collision purposes.

The closest intersection point to this origin point is considered to be the most significant.

Reimplemented from CollisionPlane.

Definition at line 232 of file collisionPolygon.cxx.

Referenced by CollisionHandlerPusher::handle_entries().

int CollisionPolygon::get_num_points ( ) const [inline]

Returns the number of vertices of the CollisionPolygon.

Definition at line 75 of file collisionPolygon.I.

LPoint3 CollisionPolygon::get_point ( int  n) const [inline]

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

Definition at line 86 of file collisionPolygon.I.

References LPoint3f::zero().

PStatCollector & CollisionPolygon::get_test_pcollector ( ) [virtual]

Returns a PStatCollector that is used to count the number of intersection tests made against a solid of this type in a given frame.

Reimplemented from CollisionPlane.

Reimplemented in CollisionGeom.

Definition at line 318 of file collisionPolygon.cxx.

PStatCollector & CollisionPolygon::get_volume_pcollector ( ) [virtual]

Returns a PStatCollector that is used to count the number of bounding volume tests made against a solid of this type in a given frame.

Reimplemented from CollisionPlane.

Reimplemented in CollisionGeom.

Definition at line 306 of file collisionPolygon.cxx.

bool CollisionPolygon::is_concave ( ) const

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

Definition at line 146 of file collisionPolygon.cxx.

bool CollisionPolygon::is_valid ( ) const

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

Definition at line 135 of file collisionPolygon.cxx.

TypedWritable * CollisionPolygon::make_CollisionPolygon ( const FactoryParams params) [static]

Factory method to generate a CollisionPolygon object.

Definition at line 1515 of file collisionPolygon.cxx.

References fillin().

Referenced by register_with_read_factory().

void CollisionPolygon::register_with_read_factory ( ) [static]

Factory method to generate a CollisionPolygon object.

Reimplemented from CollisionPlane.

Definition at line 1531 of file collisionPolygon.cxx.

References BamReader::get_factory(), make_CollisionPolygon(), and Factory< Type >::register_factory().

bool CollisionPolygon::verify_points ( const LPoint3 a,
const LPoint3 b,
const LPoint3 c,
const LPoint3 d 
) [inline, static]

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

Definition at line 118 of file collisionPolygon.I.

References verify_points().

bool CollisionPolygon::verify_points ( const LPoint3 begin,
const LPoint3 end 
) [static]

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.

Definition at line 83 of file collisionPolygon.cxx.

References LVecBase3f::length().

bool CollisionPolygon::verify_points ( const LPoint3 a,
const LPoint3 b,
const LPoint3 c 
) [inline, static]

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

Definition at line 101 of file collisionPolygon.I.

Referenced by verify_points().

void CollisionPolygon::write_datagram ( BamWriter manager,
Datagram me 
) [virtual]

Function to write the important information in the particular object to a Datagram.

Reimplemented from CollisionPlane.

Definition at line 1454 of file collisionPolygon.cxx.

References Datagram::add_uint16().

void CollisionPolygon::xform ( const LMatrix4 mat) [virtual]

Transforms the solid by the indicated matrix.

Reimplemented from CollisionPlane.

Definition at line 189 of file collisionPolygon.cxx.

References LVecBase3f::size().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations