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

BoundingSphere Class Reference

This defines a bounding sphere, consisting of a center and a radius. More...

#include "boundingSphere.h"

Inheritance diagram for BoundingSphere:
FiniteBoundingVolume GeometricBoundingVolume BoundingVolume TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

List of all members.

Public Member Functions

 BoundingSphere ()
 Constructs an empty sphere.
 BoundingSphere (const LPoint3f &center, float radius)
 Constructs a specific sphere.
virtual const BoundingSphereas_bounding_sphere () const
 Virtual downcast method.
virtual TypeHandle force_init_type ()
virtual LPoint3f get_approx_center () const
LPoint3f get_center () const
virtual LPoint3f get_max () const
virtual LPoint3f get_min () const
float get_radius () const
virtual TypeHandle get_type () const
virtual float get_volume () const
virtual BoundingVolumemake_copy () const
virtual void output (ostream &out) const
virtual void xform (const LMatrix4f &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_boxes (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 box.
bool around_finite (const BoundingVolume **first, const BoundingVolume **last)
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.
virtual bool around_other (BoundingVolume *other, const BoundingVolume **first, const BoundingVolume **last) const
virtual bool around_points (const LPoint3f *first, const LPoint3f *last)
 Puts the volume around the indicated list of points, identified by an STL-style begin/end list.
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 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 LPoint3f &a, const LPoint3f &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 LPoint3f &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.
bool extend_by_finite (const FiniteBoundingVolume *volume)
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 LPoint3f &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

Detailed Description

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.


Constructor & Destructor Documentation

BoundingSphere::BoundingSphere ( ) [inline]

Constructs an empty sphere.

Definition at line 22 of file boundingSphere.I.

BoundingSphere::BoundingSphere ( const LPoint3f center,
float  radius 
) [inline]

Constructs a specific sphere.

Definition at line 31 of file boundingSphere.I.

References LVecBase3f::is_nan().


Member Function Documentation

bool BoundingSphere::around_boxes ( const BoundingVolume **  first,
const BoundingVolume **  last 
) [protected, virtual]

Double-dispatch support: called by around_other() when the type of the first element in the list is known to be a nonempty box.

Reimplemented from BoundingVolume.

Definition at line 416 of file boundingSphere.cxx.

bool BoundingSphere::around_hexahedrons ( const BoundingVolume **  first,
const BoundingVolume **  last 
) [protected, virtual]

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 427 of file boundingSphere.cxx.

bool BoundingSphere::around_points ( const LPoint3f first,
const LPoint3f 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 312 of file boundingSphere.cxx.

References LVecBase3f::is_nan().

bool BoundingSphere::around_spheres ( const BoundingVolume **  first,
const BoundingVolume **  last 
) [protected, virtual]

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 405 of file boundingSphere.cxx.

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 164 of file boundingSphere.cxx.

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 650 of file boundingSphere.cxx.

References BoundingBox::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 662 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 674 of file boundingSphere.cxx.

References BoundingLine::contains_sphere().

int BoundingSphere::contains_lineseg ( const LPoint3f a,
const LPoint3f b 
) const [protected, virtual]

Tests whether the volume contains the indicated line segment.

Reimplemented from GeometricBoundingVolume.

Definition at line 555 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 686 of file boundingSphere.cxx.

References BoundingPlane::contains_sphere().

int BoundingSphere::contains_point ( const LPoint3f point) const [protected, virtual]

Tests whether the volume contains the indicated point.

Reimplemented from GeometricBoundingVolume.

Definition at line 532 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 620 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 252 of file boundingSphere.cxx.

References BoundingBox::get_maxq(), BoundingBox::get_minq(), BoundingBox::get_point(), and BoundingVolume::is_empty().

Referenced by extend_by_hexahedron().

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 284 of file boundingSphere.cxx.

References extend_by_box(), BoundingVolume::is_empty(), and ReferenceCount::local_object().

bool BoundingSphere::extend_by_point ( const LPoint3f point) [protected, virtual]

Extends the volume to include the indicated point.

Returns true if possible, false if not.

Reimplemented from GeometricBoundingVolume.

Definition at line 207 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 230 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 95 of file boundingSphere.h.

References FiniteBoundingVolume::init_type().


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