Panda3D
|
This special bounding volume is the intersection of all of its constituent bounding volumes. More...
#include "intersectionBoundingVolume.h"
Public Member Functions | |
IntersectionBoundingVolume () | |
Constructs an empty intersection. | |
IntersectionBoundingVolume (const IntersectionBoundingVolume ©) | |
void | add_component (const GeometricBoundingVolume *component) |
Adds a new component to the volume. | |
void | clear_components () |
Removes all components from the volume. | |
virtual TypeHandle | force_init_type () |
virtual LPoint3 | get_approx_center () const |
const GeometricBoundingVolume * | get_component (int n) const |
Returns the nth component in the intersection. | |
int | get_num_components () const |
Returns the number of components in the intersection. | |
virtual TypeHandle | get_type () const |
virtual BoundingVolume * | make_copy () const |
MAKE_SEQ (get_components, get_num_components, get_component) | |
virtual void | output (ostream &out) const |
virtual void | write (ostream &out, int indent_level) 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_other (BoundingVolume *other, const BoundingVolume **first, const BoundingVolume **last) const |
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_finite (const FiniteBoundingVolume *volume) const |
Generic handler for a FiniteBoundingVolume. | |
virtual int | contains_geometric (const GeometricBoundingVolume *volume) const |
Generic handler for a GeometricBoundingVolume. | |
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_intersection (const IntersectionBoundingVolume *intersection) const |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be an intersection object. | |
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 int | contains_union (const UnionBoundingVolume *unionv) const |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a union object. | |
virtual bool | extend_other (BoundingVolume *other) const |
int | other_contains_intersection (const BoundingVolume *other) const |
Generic reverse-direction comparison. | |
Friends | |
class | BoundingVolume |
This special bounding volume is the intersection of all of its constituent bounding volumes.
A point is defined to be within an IntersectionBoundingVolume if it is within all of its component bounding volumes.
Definition at line 32 of file intersectionBoundingVolume.h.
Constructs an empty intersection.
Definition at line 23 of file intersectionBoundingVolume.I.
void IntersectionBoundingVolume::add_component | ( | const GeometricBoundingVolume * | component | ) |
Adds a new component to the volume.
This does not necessarily increase the total number of components by one, and you may or may not be able to find this component in the volume by a subsequent call to get_component(); certain optimizations may prevent the component from being added, or have other unexpected effects on the total set of components.
Definition at line 149 of file intersectionBoundingVolume.cxx.
References GeometricBoundingVolume::contains(), BoundingVolume::is_empty(), TypedObject::is_exact_type(), and BoundingVolume::is_infinite().
Removes all components from the volume.
Definition at line 132 of file intersectionBoundingVolume.cxx.
int IntersectionBoundingVolume::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 351 of file intersectionBoundingVolume.cxx.
int IntersectionBoundingVolume::contains_finite | ( | const FiniteBoundingVolume * | volume | ) | const [protected, virtual] |
Generic handler for a FiniteBoundingVolume.
Reimplemented from BoundingVolume.
Definition at line 517 of file intersectionBoundingVolume.cxx.
int IntersectionBoundingVolume::contains_geometric | ( | const GeometricBoundingVolume * | volume | ) | const [protected, virtual] |
Generic handler for a GeometricBoundingVolume.
Reimplemented from BoundingVolume.
Definition at line 543 of file intersectionBoundingVolume.cxx.
int IntersectionBoundingVolume::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 379 of file intersectionBoundingVolume.cxx.
int IntersectionBoundingVolume::contains_intersection | ( | const IntersectionBoundingVolume * | intersection | ) | const [protected, virtual] |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be an intersection object.
Reimplemented from BoundingVolume.
Definition at line 491 of file intersectionBoundingVolume.cxx.
int IntersectionBoundingVolume::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 407 of file intersectionBoundingVolume.cxx.
int IntersectionBoundingVolume::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 293 of file intersectionBoundingVolume.cxx.
References LVecBase3f::is_nan().
int IntersectionBoundingVolume::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 435 of file intersectionBoundingVolume.cxx.
int IntersectionBoundingVolume::contains_point | ( | const LPoint3 & | point | ) | const [protected, virtual] |
Tests whether the volume contains the indicated point.
Reimplemented from GeometricBoundingVolume.
Definition at line 265 of file intersectionBoundingVolume.cxx.
References LVecBase3f::is_nan().
int IntersectionBoundingVolume::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 323 of file intersectionBoundingVolume.cxx.
int IntersectionBoundingVolume::contains_union | ( | const UnionBoundingVolume * | unionv | ) | const [protected, virtual] |
Double-dispatch support: called by contains_other() when the type we're testing for intersection is known to be a union object.
Reimplemented from BoundingVolume.
Definition at line 463 of file intersectionBoundingVolume.cxx.
const GeometricBoundingVolume * IntersectionBoundingVolume::get_component | ( | int | n | ) | const [inline] |
Returns the nth component in the intersection.
Definition at line 43 of file intersectionBoundingVolume.I.
int IntersectionBoundingVolume::get_num_components | ( | ) | const [inline] |
Returns the number of components in the intersection.
Definition at line 33 of file intersectionBoundingVolume.I.
static void IntersectionBoundingVolume::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 GeometricBoundingVolume.
Definition at line 85 of file intersectionBoundingVolume.h.
References GeometricBoundingVolume::init_type().
int IntersectionBoundingVolume::other_contains_intersection | ( | const BoundingVolume * | volume | ) | const [protected] |
Generic reverse-direction comparison.
Called by BoundingVolumes that do not implement contains_intersection() explicitly. This returns the test of whether the other volume contains this volume.
Definition at line 573 of file intersectionBoundingVolume.cxx.
References BoundingVolume::contains().
Referenced by BoundingVolume::contains_intersection().