Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions

CollisionDSSolid Class Reference

A collision volume or object made up of the intersection of two spheres (potentially a lens) and two half-spaces (planes). More...

#include "collisionDSSolid.h"

Inheritance diagram for CollisionDSSolid:
CollisionSolid CopyOnWriteObject CachedTypedWritableReferenceCount TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Member Functions

 CollisionDSSolid (const LPoint3f &center_a, float radius_a, const LPoint3f &center_b, float radius_b, const Planef &plane_a, const Planef &plane_b)
 CollisionDSSolid (float ax, float ay, float az, float radius_a, float bx, float by, float bz, float radius_b, const Planef &plane_a, const Planef &plane_b)
 CollisionDSSolid (const CollisionDSSolid &copy)
float dist_to_plane_a (const LPoint3f &point) const
float dist_to_plane_b (const LPoint3f &point) const
virtual TypeHandle force_init_type ()
const LPoint3fget_center_a () const
const LPoint3fget_center_b () const
virtual LPoint3f get_collision_origin () const
 Returns the point in space deemed to be the "origin" of the solid for collision purposes.
float get_lens_radius () const
LVector3f get_normal_a () const
LVector3f get_normal_b () const
const Planef & get_plane_a () const
const Planef & get_plane_b () const
float get_radius_a () const
float get_radius_b () const
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.
virtual CollisionSolidmake_copy ()
virtual void output (ostream &out) const
virtual PT (CollisionEntry) test_intersection(const CollisionEntry &entry) const
void set_center_a (float x, float y, float z)
void set_center_a (const LPoint3f &center)
void set_center_b (const LPoint3f &center)
void set_center_b (float x, float y, float z)
void set_plane_a (const Planef &plane)
void set_plane_b (const Planef &plane)
void set_radius_a (float radius)
void set_radius_b (float radius)
virtual void write_datagram (BamWriter *manager, Datagram &me)
 Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual void xform (const LMatrix4f &mat)
 Transforms the solid by the indicated matrix.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type CollisionDSSolid.

Protected Member Functions

 CollisionDSSolid ()
 Creates an invalid tube.
Vertexf compute_point (float latitude, float longitude) const
virtual void fill_viz_geom ()
 Fills the _viz_geom GeomNode up with Geoms suitable for rendering this solid.
void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new CollisionDSSolid.
virtual PT (BoundingVolume) compute_internal_bounds() const
virtual PT (CollisionEntry) test_intersection_from_sphere(const CollisionEntry &entry) const
void recalc_internals ()
 Should be called internally to recompute the matrix and length when the properties of the tube have changed.

Static Protected Member Functions

static TypedWritablemake_CollisionSphere (const FactoryParams &params)
static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type CollisionDSSolid is encountered in the Bam file.

Detailed Description

A collision volume or object made up of the intersection of two spheres (potentially a lens) and two half-spaces (planes).

Definition at line 29 of file collisionDSSolid.h.


Constructor & Destructor Documentation

CollisionDSSolid::CollisionDSSolid ( ) [inline, protected]

Creates an invalid tube.

Only used when reading from a bam file.

Definition at line 66 of file collisionDSSolid.I.

Referenced by make_from_bam().


Member Function Documentation

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

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

Reimplemented from CollisionSolid.

Definition at line 342 of file collisionDSSolid.cxx.

References GeomVertexWriter::add_data3f(), GeomVertexFormat::get_v3(), LVecBase3f::length(), and LMatrix4f::set_row().

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

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new CollisionDSSolid.

Reimplemented from CollisionSolid.

Definition at line 618 of file collisionDSSolid.cxx.

References DatagramIterator::get_float32(), LVecBase3f::read_datagram(), and recalc_internals().

Referenced by make_from_bam().

LPoint3f CollisionDSSolid::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.

Implements CollisionSolid.

Definition at line 97 of file collisionDSSolid.cxx.

References LVecBase3f::length(), and LVecBase3f::normalize().

PStatCollector & CollisionDSSolid::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 CollisionSolid.

Definition at line 144 of file collisionDSSolid.cxx.

PStatCollector & CollisionDSSolid::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 CollisionSolid.

Definition at line 132 of file collisionDSSolid.cxx.

TypedWritable * CollisionDSSolid::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type CollisionDSSolid is encountered in the Bam file.

It should create the CollisionDSSolid and extract its information from the file.

Definition at line 599 of file collisionDSSolid.cxx.

References CollisionDSSolid(), and fillin().

Referenced by register_with_read_factory().

void CollisionDSSolid::recalc_internals ( ) [protected]

Should be called internally to recompute the matrix and length when the properties of the tube have changed.

Definition at line 557 of file collisionDSSolid.cxx.

References CollisionSolid::mark_internal_bounds_stale(), and CollisionSolid::mark_viz_stale().

Referenced by fillin(), and xform().

void CollisionDSSolid::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type CollisionDSSolid.

Definition at line 569 of file collisionDSSolid.cxx.

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

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

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from CollisionSolid.

Definition at line 580 of file collisionDSSolid.cxx.

References Datagram::add_float32(), and LVecBase3f::write_datagram().

void CollisionDSSolid::xform ( const LMatrix4f mat) [virtual]

Transforms the solid by the indicated matrix.

Reimplemented from CollisionSolid.

Definition at line 73 of file collisionDSSolid.cxx.

References recalc_internals().


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