Panda3D

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
BoundingVolume Class Referenceabstract

This is an abstract class for any volume in any sense which can be said to define the locality of reference of a node in a graph, along with all of its descendants. More...

`#include "boundingVolume.h"`

Inheritance diagram for BoundingVolume:

## Public Types
enum | BoundsType { BT_default , BT_best , BT_sphere , BT_box , BT_fastest }
enum | IntersectionFlags { IF_no_intersection = 0 , IF_possible = 0x01 , IF_some = 0x02 , IF_all = 0x04 , IF_dont_understand = 0x08 }

## Public Member Functions
bool | around (const BoundingVolume **first, const BoundingVolume **last)
| Resets the volume to enclose only the volumes indicated.
virtual const BoundingBox * | as_bounding_box () const
| Virtual downcast method.
virtual const BoundingHexahedron * | as_bounding_hexahedron () const
| Virtual downcast method.
virtual const BoundingLine * | as_bounding_line () const
| Virtual downcast method.
virtual const BoundingPlane * | as_bounding_plane () const
| Virtual downcast method.
virtual const BoundingSphere * | as_bounding_sphere () const
| Virtual downcast method.
virtual const FiniteBoundingVolume * | as_finite_bounding_volume () const
| Virtual downcast method.
virtual GeometricBoundingVolume * | as_geometric_bounding_volume ()
| Virtual downcast method.
virtual const GeometricBoundingVolume * | as_geometric_bounding_volume () const
| Virtual downcast method.
int | contains (const BoundingVolume *vol) const
| Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated volume.
bool | extend_by (const BoundingVolume *vol)
| Increases the size of the volume to include the given volume.
virtual TypeHandle | force_init_type ()
virtual TypeHandle | get_type () const
bool | is_empty () const
| Any kind of volume might be empty.
bool | is_infinite () const
| The other side of the empty coin is an infinite volume.
virtual BoundingVolume * | make_copy () const =0
virtual void | output (std::ostream &out) const =0
void | set_infinite ()
| Marks the volume as infinite, even if it is normally finite.
virtual void | write (std::ostream &out, int indent_level=0) const
Public Member Functions inherited from TypedReferenceCount
| TypedReferenceCount (const TypedReferenceCount &copy)
void | operator= (const TypedReferenceCount &copy)
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
int | get_best_parent_from_Set (const std::set< int > &) 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_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
static BoundsType | string_bounds_type (const std::string &str)
| Returns the BoundsType corresponding to the indicated string.
Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedObject
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.
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()

## Friends
class | BoundingBox
class | BoundingHexahedron
class | BoundingLine
class | BoundingPlane
class | BoundingSphere
class | IntersectionBoundingVolume
class | UnionBoundingVolume

## Additional Inherited Members
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count.

## Detailed Description

This is an abstract class for any volume in any sense which can be said to define the locality of reference of a node in a graph, along with all of its descendants.

It is not necessarily a geometric volume (although see GeometricBoundingVolume); this is simply an abstract interface for bounds of any sort.

Definition at line 41 of file boundingVolume.h.

## Member Enumeration Documentation

## ◆ BoundsType

enum BoundingVolume::BoundsType

Definition at line 100 of file boundingVolume.h.

## ◆ IntersectionFlags

enum BoundingVolume::IntersectionFlags

Definition at line 64 of file boundingVolume.h.

## Constructor & Destructor Documentation

## ◆ BoundingVolume()

BoundingVolume::BoundingVolume | ( |  | ) |
| inline

Definition at line 17 of file boundingVolume.I.

## Member Function Documentation

## ◆ around()

bool BoundingVolume::around | ( | const BoundingVolume ** | first,
|  | const BoundingVolume ** | last )

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 39 of file boundingVolume.cxx.

References is_empty().

Referenced by GeometricBoundingVolume::around().

## ◆ as_bounding_box()

const BoundingBox * BoundingVolume::as_bounding_box | ( |  | ) | 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 in BoundingBox.

Definition at line 125 of file boundingVolume.cxx.

## ◆ as_bounding_hexahedron()

const BoundingHexahedron * BoundingVolume::as_bounding_hexahedron | ( |  | ) | 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 in BoundingHexahedron.

Definition at line 134 of file boundingVolume.cxx.

## ◆ as_bounding_line()

const BoundingLine * BoundingVolume::as_bounding_line | ( |  | ) | 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 in BoundingLine.

Definition at line 143 of file boundingVolume.cxx.

## ◆ as_bounding_plane()

const BoundingPlane * BoundingVolume::as_bounding_plane | ( |  | ) | 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 in BoundingPlane.

Definition at line 152 of file boundingVolume.cxx.

## ◆ as_bounding_sphere()

const BoundingSphere * BoundingVolume::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 in BoundingSphere.

Definition at line 116 of file boundingVolume.cxx.

## ◆ as_finite_bounding_volume()

const FiniteBoundingVolume * BoundingVolume::as_finite_bounding_volume | ( |  | ) | 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 in FiniteBoundingVolume.

Definition at line 107 of file boundingVolume.cxx.

## ◆ as_geometric_bounding_volume() [1/2]

GeometricBoundingVolume * BoundingVolume::as_geometric_bounding_volume | ( |  | ) |
| 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 in GeometricBoundingVolume.

Definition at line 89 of file boundingVolume.cxx.

## ◆ as_geometric_bounding_volume() [2/2]

const GeometricBoundingVolume * BoundingVolume::as_geometric_bounding_volume | ( |  | ) | 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 in GeometricBoundingVolume.

Definition at line 98 of file boundingVolume.cxx.

## ◆ contains()

int BoundingVolume::contains | ( | const BoundingVolume * | vol | ) | const
| inline

Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indicated volume.

Definition at line 79 of file boundingVolume.I.

References is_empty(), and is_infinite().

Referenced by GeometricBoundingVolume::contains(), and UnionBoundingVolume::filter_intersection().

## ◆ extend_by()

bool BoundingVolume::extend_by | ( | const BoundingVolume * | vol | ) |
| inline

Increases the size of the volume to include the given volume.

Definition at line 60 of file boundingVolume.I.

References is_empty(), is_infinite(), and set_infinite().

Referenced by GeometricBoundingVolume::extend_by().

## ◆ force_init_type()

virtual TypeHandle BoundingVolume::force_init_type | ( |  | ) |
| inline virtual

Reimplemented from TypedReferenceCount.

Definition at line 192 of file boundingVolume.h.

## ◆ get_class_type()

static TypeHandle BoundingVolume::get_class_type | ( |  | ) |
| inline static

Definition at line 181 of file boundingVolume.h.

## ◆ get_type()

virtual TypeHandle BoundingVolume::get_type | ( |  | ) | const
| inline virtual

Reimplemented from TypedReferenceCount.

Definition at line 189 of file boundingVolume.h.

## ◆ init_type()

static void BoundingVolume::init_type | ( |  | ) |
| inline static

Definition at line 184 of file boundingVolume.h.

## ◆ is_empty()

bool BoundingVolume::is_empty | ( |  | ) | const
| inline

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 28 of file boundingVolume.I.

Referenced by IntersectionBoundingVolume::add_component(), UnionBoundingVolume::add_component(), around(), contains(), GeometricBoundingVolume::contains(), GeometricBoundingVolume::contains(), extend_by(), BoundingBox::get_maxq(), BoundingBox::get_minq(), BoundingLine::get_point_a(), and BoundingLine::get_point_b().

## ◆ is_infinite()

bool BoundingVolume::is_infinite | ( |  | ) | const
| inline

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 43 of file boundingVolume.I.

Referenced by IntersectionBoundingVolume::add_component(), UnionBoundingVolume::add_component(), contains(), extend_by(), BoundingBox::get_maxq(), BoundingBox::get_minq(), BoundingLine::get_point_a(), and BoundingLine::get_point_b().

## ◆ set_infinite()

void BoundingVolume::set_infinite | ( |  | ) |
| inline

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 52 of file boundingVolume.I.

Referenced by extend_by().

## ◆ string_bounds_type()

BoundingVolume::BoundsType BoundingVolume::string_bounds_type | ( | const std::string & | str | ) |
| static

Returns the BoundsType corresponding to the indicated string.

Definition at line 160 of file boundingVolume.cxx.

## ◆ write()

void BoundingVolume::write | ( | std::ostream & | out,
|  | int | indent_level = 0 ) const
| virtual

Definition at line 80 of file boundingVolume.cxx.

## Friends And Related Symbol Documentation

## ◆ BoundingBox

friend class BoundingBox
| friend

Definition at line 198 of file boundingVolume.h.

## ◆ BoundingHexahedron

friend class BoundingHexahedron
| friend

Definition at line 199 of file boundingVolume.h.

## ◆ BoundingLine

friend class BoundingLine
| friend

Definition at line 200 of file boundingVolume.h.

## ◆ BoundingPlane

friend class BoundingPlane
| friend

Definition at line 201 of file boundingVolume.h.

## ◆ BoundingSphere

friend class BoundingSphere
| friend

Definition at line 197 of file boundingVolume.h.

## ◆ IntersectionBoundingVolume

friend class IntersectionBoundingVolume
| friend

Definition at line 203 of file boundingVolume.h.

## ◆ UnionBoundingVolume

friend class UnionBoundingVolume
| friend

Definition at line 202 of file boundingVolume.h.

The documentation for this class was generated from the following files:

- panda/src/mathutil/boundingVolume.h
- panda/src/mathutil/boundingVolume.cxx
- panda/src/mathutil/boundingVolume.I