#include <boundingSphere.h>
Inheritance diagram for BoundingSphere:
Public Types | |
enum | IntersectionFlags { IF_no_intersection = 0, IF_possible = 0x01, IF_some = 0x02, IF_all = 0x04, IF_dont_understand = 0x08 } |
Public Member Functions | |
INLINE_MATHUTIL | BoundingSphere () |
INLINE_MATHUTIL | BoundingSphere (const LPoint3f ¢er, float radius) |
virtual BoundingVolume * | make_copy () const |
virtual LPoint3f | get_min () const |
virtual LPoint3f | get_max () const |
virtual LPoint3f | get_approx_center () const |
virtual void | xform (const LMatrix4f &mat) |
virtual void | output (ostream &out) const |
INLINE_MATHUTIL const LPoint3f & | get_center () const |
INLINE_MATHUTIL float | get_radius () const |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
INLINE_MATHUTIL bool | extend_by (const GeometricBoundingVolume *vol) |
Increases the size of the volume to include the given volume. | |
INLINE_MATHUTIL bool | extend_by (const LPoint3f &point) |
Increases the size of the volume to include the given point. | |
INLINE_MATHUTIL bool | extend_by (const BoundingVolume *vol) |
Increases the size of the volume to include the given volume. | |
INLINE_MATHUTIL bool | around (const GeometricBoundingVolume **first, const GeometricBoundingVolume **last) |
Resets the volume to enclose only the volumes indicated. | |
INLINE_MATHUTIL bool | around (const LPoint3f *first, const LPoint3f *last) |
Resets the volume to enclose only the points indicated. | |
bool | around (const BoundingVolume **first, const BoundingVolume **last) |
Resets the volume to enclose only the volumes indicated. | |
INLINE_MATHUTIL int | contains (const GeometricBoundingVolume *vol) const |
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated volume. | |
INLINE_MATHUTIL int | contains (const LPoint3f &point) const |
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated point. | |
INLINE_MATHUTIL int | contains (const LPoint3f &a, const LPoint3f &b) const |
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated line segment. | |
INLINE_MATHUTIL int | contains (const BoundingVolume *vol) const |
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated volume. | |
INLINE_MATHUTIL bool | is_empty () const |
Any kind of volume might be empty. | |
INLINE_MATHUTIL bool | is_infinite () const |
The other side of the empty coin is an infinite volume. | |
INLINE_MATHUTIL void | set_infinite () |
Marks the volume as infinite, even if it is normally finite. | |
virtual void | write (ostream &out, int indent_level=0) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
int | get_ref_count () const |
Returns the current reference count. | |
int | ref () const |
Explicitly increments the reference count. | |
int | unref () const |
Explicitly decrements the reference count. | |
void | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
Static Public Member Functions | |
TypeHandle | get_class_type () |
void | init_type () |
Protected Types | |
enum | Flags { F_empty = 0x01, F_infinite = 0x02 } |
Protected Member Functions | |
virtual bool | extend_other (BoundingVolume *other) const |
virtual bool | around_other (BoundingVolume *other, const BoundingVolume **first, const BoundingVolume **last) const |
virtual int | contains_other (const BoundingVolume *other) const |
virtual bool | extend_by_point (const LPoint3f &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_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. | |
bool | extend_by_finite (const FiniteBoundingVolume *volume) |
virtual bool | around_points (const LPoint3f *first, const LPoint3f *last) |
virtual bool | around_spheres (const BoundingVolume **first, const BoundingVolume **last) |
Double-dispatch support: called by around_other() when the type of the first element in the list is known to be a nonempty sphere. | |
virtual bool | around_hexahedrons (const BoundingVolume **first, const BoundingVolume **last) |
Double-dispatch support: called by around_other() when the type of the first element in the list is known to be a nonempty hexahedron. | |
bool | around_finite (const BoundingVolume **first, const BoundingVolume **last) |
virtual int | contains_point (const LPoint3f &point) const |
virtual int | contains_lineseg (const LPoint3f &a, const LPoint3f &b) const |
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_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 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 bool | extend_by_line (const BoundingLine *line) |
Double-dispatch support: called by extend_other() when the type we're extending by is known to be a line. | |
virtual bool | around_lines (const BoundingVolume **first, const BoundingVolume **last) |
Double-dispatch support: called by around_other() when the type of the first element in the list is known to be a nonempty line. | |
Protected Attributes | |
int | _flags |
Private Attributes | |
LPoint3f | _center |
float | _radius |
Static Private Attributes | |
TypeHandle | _type_handle |
Friends | |
class | BoundingHexahedron |
It is always a sphere, and never an ellipsoid or other quadric.
Definition at line 40 of file boundingSphere.h.
|
Definition at line 110 of file boundingVolume.h. |
|
Definition at line 74 of file boundingVolume.h. |
|
Definition at line 23 of file boundingSphere.I. References INLINE_MATHUTIL. |
|
Definition at line 27 of file boundingSphere.I. References _center, BoundingVolume::_flags, and BoundingVolume::F_empty. |
|
Resets the volume to enclose only the volumes indicated. Returns true if successful, false if the volume doesn't know how to do that or can't do that. Definition at line 43 of file boundingVolume.cxx. References BoundingVolume::_flags, and BoundingVolume::F_infinite. Referenced by GeomNode::add_geoms_from(). |
|
Resets the volume to enclose only the points indicated.
Definition at line 91 of file geometricBoundingVolume.I. References GeometricBoundingVolume::contains_point(), BoundingVolume::IF_no_intersection, INLINE_MATHUTIL, and BoundingVolume::is_empty(). |
|
Resets the volume to enclose only the volumes indicated.
Definition at line 74 of file geometricBoundingVolume.I. |
|
Definition at line 297 of file boundingSphere.cxx. |
|
Double-dispatch support: called by around_other() when the type of the first element in the list is known to be a nonempty hexahedron.
Reimplemented from BoundingVolume. Definition at line 291 of file boundingSphere.cxx. |
|
Double-dispatch support: called by around_other() when the type of the first element in the list is known to be a nonempty line.
Definition at line 196 of file boundingVolume.cxx. References BoundingVolume::IF_dont_understand. |
|
Implements BoundingVolume. Definition at line 121 of file boundingSphere.cxx. |
|
Reimplemented from GeometricBoundingVolume. Definition at line 197 of file boundingSphere.cxx. |
|
Double-dispatch support: called by around_other() when the type of the first element in the list is known to be a nonempty sphere.
Reimplemented from BoundingVolume. Definition at line 285 of file boundingSphere.cxx. |
|
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated volume.
Definition at line 145 of file boundingVolume.I. |
|
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated line segment.
Definition at line 151 of file geometricBoundingVolume.I. |
|
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated point.
Definition at line 130 of file geometricBoundingVolume.I. |
|
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated volume.
Definition at line 113 of file geometricBoundingVolume.I. References GeometricBoundingVolume::contains_lineseg(), BoundingVolume::IF_no_intersection, INLINE_MATHUTIL, and BoundingVolume::is_empty(). Referenced by CollisionTraverser::compare_collider_to_node(). |
|
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 469 of file boundingSphere.cxx. References BoundingLine::contains_sphere(), and BoundingVolume::IF_all. |
|
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 474 of file boundingSphere.cxx. |
|
Reimplemented from GeometricBoundingVolume. Definition at line 388 of file boundingSphere.cxx. References contains_point(). |
|
Implements BoundingVolume. Definition at line 128 of file boundingSphere.cxx. References nassertr. |
|
Reimplemented from GeometricBoundingVolume. Definition at line 370 of file boundingSphere.cxx. References BoundingVolume::IF_no_intersection. Referenced by contains_lineseg(). |
|
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 446 of file boundingSphere.cxx. References _center, _radius, BoundingVolume::IF_all, BoundingVolume::IF_possible, and BoundingVolume::IF_some. |
|
Increases the size of the volume to include the given volume.
Definition at line 118 of file boundingVolume.I. Referenced by GeometricBoundingVolume::GeometricBoundingVolume(), and CollisionSphere::get_collision_origin(). |
|
Increases the size of the volume to include the given point.
Definition at line 59 of file geometricBoundingVolume.I. |
|
Increases the size of the volume to include the given volume.
Definition at line 44 of file geometricBoundingVolume.I. References GeometricBoundingVolume::extend_by_point(), and INLINE_MATHUTIL. Referenced by CollisionLevelState::prepare_collider(). |
|
Definition at line 174 of file boundingSphere.cxx. References _center, BoundingVolume::_flags, and _radius. |
|
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 169 of file boundingSphere.cxx. References BoundingVolume::is_empty(), and nassertr. |
|
Double-dispatch support: called by extend_other() when the type we're extending by is known to be a line.
Reimplemented in BoundingLine. Definition at line 142 of file boundingVolume.cxx. References BoundingVolume::_flags, and BoundingVolume::F_infinite. |
|
Reimplemented from GeometricBoundingVolume. Definition at line 134 of file boundingSphere.cxx. References _center, BoundingVolume::_flags, and _radius. |
|
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 152 of file boundingSphere.cxx. References _center, BoundingVolume::_flags, and _radius. |
|
Implements BoundingVolume. Definition at line 116 of file boundingSphere.cxx. |
|
Reimplemented from FiniteBoundingVolume. Definition at line 105 of file boundingSphere.h. |
|
Implements GeometricBoundingVolume. Definition at line 57 of file boundingSphere.cxx. |
|
Definition at line 37 of file boundingSphere.I. References _center. |
|
Reimplemented from FiniteBoundingVolume. Definition at line 94 of file boundingSphere.h. References FiniteBoundingVolume::get_class_type(). |
|
Implements FiniteBoundingVolume. Definition at line 48 of file boundingSphere.cxx. |
|
Implements FiniteBoundingVolume. Definition at line 39 of file boundingSphere.cxx. |
|
Definition at line 44 of file boundingSphere.I. References _radius. |
|
Returns the current reference count.
Definition at line 183 of file referenceCount.I. Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture(). |
|
Reimplemented from FiniteBoundingVolume. Definition at line 102 of file boundingSphere.h. |
|
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). Definition at line 71 of file typedObject.I. References TypeHandle::get_name(), TypedObject::get_type(), and INLINE. |
|
Reimplemented from FiniteBoundingVolume. Definition at line 97 of file boundingSphere.h. References FiniteBoundingVolume::get_class_type(), and FiniteBoundingVolume::init_type(). |
|
Any kind of volume might be empty. This is a degenerate volume that contains no points; it's not the same as, for instance, a sphere with radius zero, since that contains one point (the center). It intersects with no other volumes. Definition at line 51 of file boundingVolume.I. References BoundingVolume::_flags, BoundingVolume::F_infinite, and INLINE_MATHUTIL. Referenced by GeometricBoundingVolume::around(), GeometricBoundingVolume::contains(), BoundingLine::contains_other(), extend_by_hexahedron(), make_copy(), BoundingLine::make_copy(), BoundingHexahedron::make_copy(), and BoundingVolume::set_infinite(). |
|
Returns true if the current object is the indicated type exactly.
Definition at line 101 of file typedObject.I. Referenced by PT(), and CollisionNode::xform(). |
|
The other side of the empty coin is an infinite volume. This is a degenerate state of a normally finite volume that contains all points. (Note that some kinds of infinite bounding volumes, like binary separating planes, do not contain all points and thus correctly return is_infinite() == false, even though they are technically infinite. This is a special case of the word 'infinite' meaning the volume covers all points in space.) It completely intersects with all other volumes except empty volumes. Definition at line 86 of file boundingVolume.I. Referenced by BoundingLine::contains_other(), make_copy(), BoundingLine::make_copy(), BoundingHexahedron::make_copy(), and BoundingVolume::set_infinite(). |
|
|
Implements BoundingVolume. Definition at line 34 of file boundingSphere.cxx. References BoundingVolume::is_empty(), BoundingVolume::is_infinite(), and nassertr. |
|
Implements BoundingVolume. Definition at line 105 of file boundingSphere.cxx. |
|
Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 225 of file referenceCount.I. Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering(). |
|
Marks the volume as infinite, even if it is normally finite. You can think of this as an infinite extend_by() operation. Definition at line 103 of file boundingVolume.I. References BoundingVolume::IF_all, BoundingVolume::IF_no_intersection, BoundingVolume::IF_possible, BoundingVolume::IF_some, INLINE_MATHUTIL, BoundingVolume::is_empty(), and BoundingVolume::is_infinite(). Referenced by OmniBoundingVolume::extend_other(). |
|
Does some easy checks to make sure that the reference count isn't completely bogus.
Definition at line 328 of file referenceCount.I. References INLINE. Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount(). |
|
Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 293 of file referenceCount.I. References INLINE. Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds(). |
|
Reimplemented in BoundingHexahedron. Definition at line 89 of file boundingVolume.cxx. References BoundingVolume::_flags, and BoundingVolume::F_infinite. |
|
Implements GeometricBoundingVolume. Definition at line 64 of file boundingSphere.cxx. |
|
Reimplemented from BoundingVolume. Definition at line 110 of file boundingSphere.h. |
|
Definition at line 89 of file boundingSphere.h. Referenced by BoundingSphere(), contains_sphere(), extend_by_finite(), extend_by_point(), extend_by_sphere(), get_center(), and xform(). |
|
|
Definition at line 90 of file boundingSphere.h. Referenced by contains_sphere(), extend_by_finite(), extend_by_point(), extend_by_sphere(), get_radius(), and xform(). |
|
Reimplemented from FiniteBoundingVolume. Definition at line 31 of file boundingSphere.cxx. |