Panda3D
|
This defines a bounding sphere, consisting of a center and a radius. More...
#include "boundingSphere.h"
Public Member Functions | |
BoundingSphere () | |
Constructs an empty sphere. | |
BoundingSphere (const LPoint3 ¢er, PN_stdfloat radius) | |
Constructs a specific sphere. | |
virtual const BoundingSphere * | as_bounding_sphere () const |
Virtual downcast method. | |
virtual TypeHandle | force_init_type () |
virtual LPoint3 | get_approx_center () const |
LPoint3 | get_center () const |
virtual LPoint3 | get_max () const |
virtual LPoint3 | get_min () const |
PN_stdfloat | get_radius () const |
virtual TypeHandle | get_type () const |
virtual PN_stdfloat | get_volume () const |
virtual BoundingVolume * | make_copy () const |
virtual void | output (ostream &out) const |
virtual void | xform (const LMatrix4 &mat) |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
Protected Member Functions | |
virtual bool | around_finite (const BoundingVolume **first, const BoundingVolume **last) |
Generic handler for a FiniteBoundingVolume. | |
virtual bool | around_other (BoundingVolume *other, const BoundingVolume **first, const BoundingVolume **last) const |
virtual bool | around_points (const LPoint3 *first, const LPoint3 *last) |
Puts the volume around the indicated list of points, identified by an STL-style begin/end list. | |
virtual int | contains_box (const BoundingBox *box) const |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a box. | |
virtual int | contains_hexahedron (const BoundingHexahedron *hexahedron) const |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a hexahedron. | |
virtual int | contains_line (const BoundingLine *line) const |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a line. | |
virtual int | contains_lineseg (const LPoint3 &a, const LPoint3 &b) const |
Tests whether the volume contains the indicated line segment. | |
virtual int | contains_other (const BoundingVolume *other) const |
virtual int | contains_plane (const BoundingPlane *plane) const |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a plane. | |
virtual int | contains_point (const LPoint3 &point) const |
Tests whether the volume contains the indicated point. | |
virtual int | contains_sphere (const BoundingSphere *sphere) const |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a sphere. | |
virtual bool | extend_by_box (const BoundingBox *box) |
Double-dispatch support: called by extend_other() when the type we're extending by is known to be a box. | |
virtual bool | extend_by_finite (const FiniteBoundingVolume *volume) |
Generic handler for a FiniteBoundingVolume. | |
virtual bool | extend_by_hexahedron (const BoundingHexahedron *hexahedron) |
Double-dispatch support: called by extend_other() when the type we're extending by is known to be a hexahedron. | |
virtual bool | extend_by_point (const LPoint3 &point) |
Extends the volume to include the indicated point. | |
virtual bool | extend_by_sphere (const BoundingSphere *sphere) |
Double-dispatch support: called by extend_other() when the type we're extending by is known to be a sphere. | |
virtual bool | extend_other (BoundingVolume *other) const |
Friends | |
class | BoundingHexahedron |
This defines a bounding sphere, consisting of a center and a radius.
It is always a sphere, and never an ellipsoid or other quadric.
Definition at line 28 of file boundingSphere.h.
BoundingSphere::BoundingSphere | ( | ) | [inline] |
Constructs an empty sphere.
Definition at line 22 of file boundingSphere.I.
BoundingSphere::BoundingSphere | ( | const LPoint3 & | center, |
PN_stdfloat | radius | ||
) | [inline] |
Constructs a specific sphere.
Definition at line 31 of file boundingSphere.I.
References LVecBase3f::is_nan().
bool BoundingSphere::around_finite | ( | const BoundingVolume ** | first, |
const BoundingVolume ** | last | ||
) | [protected, virtual] |
Generic handler for a FiniteBoundingVolume.
Reimplemented from BoundingVolume.
Definition at line 393 of file boundingSphere.cxx.
References as_bounding_sphere(), FiniteBoundingVolume::as_finite_bounding_volume(), ReferenceCount::local_object(), and BoundingVolume::set_infinite().
bool BoundingSphere::around_points | ( | const LPoint3 * | first, |
const LPoint3 * | last | ||
) | [protected, virtual] |
Puts the volume around the indicated list of points, identified by an STL-style begin/end list.
Reimplemented from GeometricBoundingVolume.
Definition at line 300 of file boundingSphere.cxx.
References LVecBase3f::is_nan().
const BoundingSphere * BoundingSphere::as_bounding_sphere | ( | ) | const [virtual] |
Virtual downcast method.
Returns this object as a pointer of the indicated type, if it is in fact that type. Returns NULL if it is not that type.
Reimplemented from BoundingVolume.
Definition at line 152 of file boundingSphere.cxx.
Referenced by around_finite().
int BoundingSphere::contains_box | ( | const BoundingBox * | box | ) | const [protected, virtual] |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a box.
Reimplemented from BoundingVolume.
Definition at line 605 of file boundingSphere.cxx.
References BoundingVolume::contains_sphere().
int BoundingSphere::contains_hexahedron | ( | const BoundingHexahedron * | hexahedron | ) | const [protected, virtual] |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a hexahedron.
Reimplemented from BoundingVolume.
Definition at line 617 of file boundingSphere.cxx.
References BoundingHexahedron::contains_sphere().
int BoundingSphere::contains_line | ( | const BoundingLine * | line | ) | const [protected, virtual] |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a line.
Reimplemented from BoundingVolume.
Definition at line 629 of file boundingSphere.cxx.
References BoundingLine::contains_sphere().
int BoundingSphere::contains_lineseg | ( | const LPoint3 & | a, |
const LPoint3 & | b | ||
) | const [protected, virtual] |
Tests whether the volume contains the indicated line segment.
Reimplemented from GeometricBoundingVolume.
Definition at line 510 of file boundingSphere.cxx.
References contains_point(), BoundingVolume::is_empty(), BoundingVolume::is_infinite(), and LVecBase3f::is_nan().
int BoundingSphere::contains_plane | ( | const BoundingPlane * | plane | ) | const [protected, virtual] |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a plane.
Reimplemented from BoundingVolume.
Definition at line 641 of file boundingSphere.cxx.
References BoundingPlane::contains_sphere().
int BoundingSphere::contains_point | ( | const LPoint3 & | point | ) | const [protected, virtual] |
Tests whether the volume contains the indicated point.
Reimplemented from GeometricBoundingVolume.
Definition at line 487 of file boundingSphere.cxx.
References BoundingVolume::is_empty(), BoundingVolume::is_infinite(), and LVecBase3f::is_nan().
Referenced by contains_lineseg().
int BoundingSphere::contains_sphere | ( | const BoundingSphere * | sphere | ) | const [protected, virtual] |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a sphere.
Reimplemented from BoundingVolume.
Definition at line 575 of file boundingSphere.cxx.
References BoundingVolume::is_empty(), and BoundingVolume::is_infinite().
bool BoundingSphere::extend_by_box | ( | const BoundingBox * | box | ) | [protected, virtual] |
Double-dispatch support: called by extend_other() when the type we're extending by is known to be a box.
Reimplemented from BoundingVolume.
Definition at line 240 of file boundingSphere.cxx.
References BoundingBox::get_maxq(), BoundingBox::get_minq(), BoundingBox::get_point(), and BoundingVolume::is_empty().
Referenced by extend_by_finite(), and extend_by_hexahedron().
bool BoundingSphere::extend_by_finite | ( | const FiniteBoundingVolume * | volume | ) | [protected, virtual] |
Generic handler for a FiniteBoundingVolume.
Reimplemented from BoundingVolume.
Definition at line 286 of file boundingSphere.cxx.
References extend_by_box(), BoundingVolume::is_empty(), and ReferenceCount::local_object().
bool BoundingSphere::extend_by_hexahedron | ( | const BoundingHexahedron * | hexahedron | ) | [protected, virtual] |
Double-dispatch support: called by extend_other() when the type we're extending by is known to be a hexahedron.
Reimplemented from BoundingVolume.
Definition at line 272 of file boundingSphere.cxx.
References extend_by_box(), BoundingVolume::is_empty(), and ReferenceCount::local_object().
bool BoundingSphere::extend_by_point | ( | const LPoint3 & | point | ) | [protected, virtual] |
Extends the volume to include the indicated point.
Returns true if possible, false if not.
Reimplemented from GeometricBoundingVolume.
Definition at line 195 of file boundingSphere.cxx.
References BoundingVolume::is_empty(), BoundingVolume::is_infinite(), and LVecBase3f::is_nan().
bool BoundingSphere::extend_by_sphere | ( | const BoundingSphere * | sphere | ) | [protected, virtual] |
Double-dispatch support: called by extend_other() when the type we're extending by is known to be a sphere.
Reimplemented from BoundingVolume.
Definition at line 218 of file boundingSphere.cxx.
References BoundingVolume::is_empty(), and BoundingVolume::is_infinite().
static void BoundingSphere::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from FiniteBoundingVolume.
Definition at line 89 of file boundingSphere.h.
References FiniteBoundingVolume::init_type().