Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
UnionBoundingVolume Class Reference

This special bounding volume is the union of all of its constituent bounding volumes. More...

#include "unionBoundingVolume.h"

Inheritance diagram for UnionBoundingVolume:
GeometricBoundingVolume BoundingVolume TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

List of all members.

Public Member Functions

 UnionBoundingVolume ()
 Constructs an empty union.
 UnionBoundingVolume (const UnionBoundingVolume &copy)
void add_component (const GeometricBoundingVolume *component)
 Adds a new component to the volume.
void clear_components ()
 Removes all components from the volume.
void filter_intersection (const BoundingVolume *volume)
 Removes from the union any components that have no intersection with the indicated volume.
virtual TypeHandle force_init_type ()
virtual LPoint3 get_approx_center () const
const GeometricBoundingVolumeget_component (int n) const
 Returns the nth component in the union.
int get_num_components () const
 Returns the number of components in the union.
virtual TypeHandle get_type () const
virtual BoundingVolumemake_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_geometric (const BoundingVolume **first, const BoundingVolume **last)
 Generic handler for a GeometricBoundingVolume.
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_by_geometric (const GeometricBoundingVolume *volume)
 Generic handler for a GeometricBoundingVolume.
virtual bool extend_other (BoundingVolume *other) const
int other_contains_union (const BoundingVolume *other) const
 Generic reverse-direction comparison.

Friends

class BoundingVolume

Detailed Description

This special bounding volume is the union of all of its constituent bounding volumes.

A point is defined to be within a UnionBoundingVolume if it is within any one or more of its component bounding volumes.

Definition at line 32 of file unionBoundingVolume.h.


Constructor & Destructor Documentation

Constructs an empty union.

Definition at line 22 of file unionBoundingVolume.I.


Member Function Documentation

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 unionBoundingVolume.cxx.

References GeometricBoundingVolume::contains(), BoundingVolume::is_empty(), and BoundingVolume::is_infinite().

Referenced by around_geometric(), and extend_by_geometric().

bool UnionBoundingVolume::around_geometric ( const BoundingVolume **  first,
const BoundingVolume **  last 
) [protected, virtual]

Generic handler for a GeometricBoundingVolume.

Reimplemented from BoundingVolume.

Definition at line 259 of file unionBoundingVolume.cxx.

References add_component(), clear_components(), and BoundingVolume::set_infinite().

Removes all components from the volume.

Definition at line 132 of file unionBoundingVolume.cxx.

Referenced by around_geometric().

int UnionBoundingVolume::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 360 of file unionBoundingVolume.cxx.

int UnionBoundingVolume::contains_finite ( const FiniteBoundingVolume volume) const [protected, virtual]

Generic handler for a FiniteBoundingVolume.

Reimplemented from BoundingVolume.

Definition at line 496 of file unionBoundingVolume.cxx.

int UnionBoundingVolume::contains_geometric ( const GeometricBoundingVolume volume) const [protected, virtual]

Generic handler for a GeometricBoundingVolume.

Reimplemented from BoundingVolume.

Definition at line 517 of file unionBoundingVolume.cxx.

int UnionBoundingVolume::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 383 of file unionBoundingVolume.cxx.

int UnionBoundingVolume::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 475 of file unionBoundingVolume.cxx.

int UnionBoundingVolume::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 406 of file unionBoundingVolume.cxx.

int UnionBoundingVolume::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 312 of file unionBoundingVolume.cxx.

References LVecBase3f::is_nan().

int UnionBoundingVolume::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 429 of file unionBoundingVolume.cxx.

int UnionBoundingVolume::contains_point ( const LPoint3 point) const [protected, virtual]

Tests whether the volume contains the indicated point.

Reimplemented from GeometricBoundingVolume.

Definition at line 289 of file unionBoundingVolume.cxx.

References LVecBase3f::is_nan().

int UnionBoundingVolume::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 337 of file unionBoundingVolume.cxx.

int UnionBoundingVolume::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 452 of file unionBoundingVolume.cxx.

bool UnionBoundingVolume::extend_by_geometric ( const GeometricBoundingVolume volume) [protected, virtual]

Generic handler for a GeometricBoundingVolume.

Reimplemented from BoundingVolume.

Definition at line 248 of file unionBoundingVolume.cxx.

References add_component().

Removes from the union any components that have no intersection with the indicated volume.

Definition at line 191 of file unionBoundingVolume.cxx.

References BoundingVolume::contains().

Returns the nth component in the union.

Definition at line 41 of file unionBoundingVolume.I.

Returns the number of components in the union.

Definition at line 31 of file unionBoundingVolume.I.

static void UnionBoundingVolume::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 90 of file unionBoundingVolume.h.

References GeometricBoundingVolume::init_type().

int UnionBoundingVolume::other_contains_union ( const BoundingVolume volume) const [protected]

Generic reverse-direction comparison.

Called by BoundingVolumes that do not implement contains_union() explicitly. This returns the test of whether the other volume contains this volume.

Definition at line 541 of file unionBoundingVolume.cxx.

References BoundingVolume::contains().

Referenced by BoundingVolume::contains_union().


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