Panda3D
Public Member Functions | Public Attributes | List of all members
PhysxBounds3 Class Reference

Represention of a axis aligned bounding box. More...

#include "physxBounds3.h"

Public Member Functions

void bounds_of_obb (const LMatrix3f &orientation, const LPoint3f &translation, const LVector3f &half_dims)
 Sets this to the AABB (axis ligned bounding box) of the OBB (oriented bounding box). More...
 
void combine (const PhysxBounds3 &b2)
 Sets this to the union of this and b2. More...
 
bool contain (const LPoint3f &p) const
 Returns TRUE if these bounds contain the point v. More...
 
void fatten (float distance)
 Fattens the AABB in all three dimensions by the given distance. More...
 
LPoint3f get_center () const
 Returns the center of the bounding box. More...
 
LVector3f get_dimensions () const
 Returns the extents of the bounding box. More...
 
LPoint3f get_max () const
 Returns the minimum corner of the bounding box. More...
 
LPoint3f get_min () const
 Returns the maximum corner of the bounding box. More...
 
void include (const LPoint3f &v)
 Expands the volume to include the point v. More...
 
bool intersects (const PhysxBounds3 &b) const
 Returns TRUE if the intersection of this and b is is not empty. More...
 
bool intersects2d (const PhysxBounds3 &b, unsigned axis_to_ignore) const
 Indicates whether the intersection of this and b is empty or not in the plane orthogonal to the axis passed (X = 0, Y = 1 or Z = 2). More...
 
bool is_empty () const
 Returns TRUE if the bounding box is empty. More...
 
void scale (float scale)
 Scales the AABB by the given factor. More...
 
void set (const LPoint3f &min, const LPoint3f &max)
 Setup this AABB from minimum corner and maximum corner. More...
 
void set_center_extents (const LPoint3f &center, const LVector3f &extents)
 Setup this AABB from center point and extents vector. More...
 
void set_empty ()
 Sets empty to TRUE. More...
 
void set_infinite ()
 Sets infinite bounds. More...
 
void set_max (LPoint3f value)
 Sets the maximum corner of the bounding box. More...
 
void set_min (LPoint3f value)
 Sets the minimum corner of the bounding box. More...
 
void transform (const LMatrix3f &orientation, const LPoint3f &translation)
 Transforms this volume as if it was an axis aligned bounding box, and then assigns the results' bounds to this. More...
 

Public Attributes

NxBounds3 _bounds
 

Detailed Description

Represention of a axis aligned bounding box.

The box is stored as minimum and maximum extent corners. Alternate representation would be center and dimensions. May be empty or nonempty. If not empty, min <= max has to hold.

Definition at line 32 of file physxBounds3.h.

Member Function Documentation

◆ bounds_of_obb()

void PhysxBounds3::bounds_of_obb ( const LMatrix3f orientation,
const LPoint3f translation,
const LVector3f half_dims 
)

Sets this to the AABB (axis ligned bounding box) of the OBB (oriented bounding box).

The OBB is described by orientation, translation and half dimensions.

Definition at line 101 of file physxBounds3.cxx.

References combine(), LVecBase3f::is_nan(), LMatrix3f::is_nan(), PhysxManager::mat3_to_nxMat33(), PhysxManager::point3_to_nxVec3(), and PhysxManager::vec3_to_nxVec3().

Referenced by set_min().

◆ combine()

void PhysxBounds3::combine ( const PhysxBounds3 b2)

Sets this to the union of this and b2.

Definition at line 118 of file physxBounds3.cxx.

References contain().

Referenced by bounds_of_obb().

◆ contain()

bool PhysxBounds3::contain ( const LPoint3f p) const

Returns TRUE if these bounds contain the point v.

Definition at line 129 of file physxBounds3.cxx.

References fatten(), LVecBase3f::is_nan(), and PhysxManager::point3_to_nxVec3().

Referenced by combine().

◆ fatten()

void PhysxBounds3::fatten ( float  distance)

Fattens the AABB in all three dimensions by the given distance.

Definition at line 143 of file physxBounds3.cxx.

References include().

Referenced by contain().

◆ get_center()

LPoint3f PhysxBounds3::get_center ( ) const

Returns the center of the bounding box.

Definition at line 46 of file physxBounds3.cxx.

References get_dimensions(), and PhysxManager::nxVec3_to_point3().

Referenced by get_min().

◆ get_dimensions()

LVector3f PhysxBounds3::get_dimensions ( ) const

Returns the extents of the bounding box.

Definition at line 59 of file physxBounds3.cxx.

References PhysxManager::nxVec3_to_vec3(), and set_max().

Referenced by get_center().

◆ get_max()

LPoint3f PhysxBounds3::get_max ( ) const

Returns the minimum corner of the bounding box.

Definition at line 24 of file physxBounds3.cxx.

References get_min(), and PhysxManager::nxVec3_to_point3().

◆ get_min()

LPoint3f PhysxBounds3::get_min ( ) const

Returns the maximum corner of the bounding box.

Definition at line 35 of file physxBounds3.cxx.

References get_center(), and PhysxManager::nxVec3_to_point3().

Referenced by get_max().

◆ include()

void PhysxBounds3::include ( const LPoint3f v)

Expands the volume to include the point v.

Definition at line 154 of file physxBounds3.cxx.

References intersects(), LVecBase3f::is_nan(), and PhysxManager::point3_to_nxVec3().

Referenced by fatten().

◆ intersects()

bool PhysxBounds3::intersects ( const PhysxBounds3 b) const

Returns TRUE if the intersection of this and b is is not empty.

Definition at line 167 of file physxBounds3.cxx.

References intersects2d().

Referenced by include().

◆ intersects2d()

bool PhysxBounds3::intersects2d ( const PhysxBounds3 b,
unsigned  axis_to_ignore 
) const

Indicates whether the intersection of this and b is empty or not in the plane orthogonal to the axis passed (X = 0, Y = 1 or Z = 2).

Definition at line 180 of file physxBounds3.cxx.

References is_empty().

Referenced by intersects().

◆ is_empty()

bool PhysxBounds3::is_empty ( ) const

Returns TRUE if the bounding box is empty.

Definition at line 191 of file physxBounds3.cxx.

References scale().

Referenced by intersects2d().

◆ scale()

void PhysxBounds3::scale ( float  scale)

Scales the AABB by the given factor.

Definition at line 202 of file physxBounds3.cxx.

References set().

Referenced by is_empty().

◆ set()

void PhysxBounds3::set ( const LPoint3f min,
const LPoint3f max 
)

Setup this AABB from minimum corner and maximum corner.

Definition at line 214 of file physxBounds3.cxx.

References LVecBase3f::is_nan(), PhysxManager::point3_to_nxVec3(), and set_center_extents().

Referenced by scale().

◆ set_center_extents()

void PhysxBounds3::set_center_extents ( const LPoint3f center,
const LVector3f extents 
)

Setup this AABB from center point and extents vector.

Definition at line 230 of file physxBounds3.cxx.

References LVecBase3f::is_nan(), PhysxManager::point3_to_nxVec3(), set_empty(), and PhysxManager::vec3_to_nxVec3().

Referenced by set().

◆ set_empty()

void PhysxBounds3::set_empty ( )

Sets empty to TRUE.

Definition at line 245 of file physxBounds3.cxx.

References set_infinite().

Referenced by set_center_extents().

◆ set_infinite()

void PhysxBounds3::set_infinite ( )

Sets infinite bounds.

Definition at line 256 of file physxBounds3.cxx.

References transform().

Referenced by set_empty().

◆ set_max()

void PhysxBounds3::set_max ( LPoint3f  value)

Sets the maximum corner of the bounding box.

Definition at line 72 of file physxBounds3.cxx.

References LVecBase3f::is_nan(), PhysxManager::point3_to_nxVec3(), and set_min().

Referenced by get_dimensions().

◆ set_min()

void PhysxBounds3::set_min ( LPoint3f  value)

Sets the minimum corner of the bounding box.

Definition at line 85 of file physxBounds3.cxx.

References bounds_of_obb(), LVecBase3f::is_nan(), and PhysxManager::point3_to_nxVec3().

Referenced by set_max().

◆ transform()

void PhysxBounds3::transform ( const LMatrix3f orientation,
const LPoint3f translation 
)

Transforms this volume as if it was an axis aligned bounding box, and then assigns the results' bounds to this.

The orientation is applied first, then the translation.

Definition at line 270 of file physxBounds3.cxx.

References LVecBase3f::is_nan(), LMatrix3f::is_nan(), PhysxManager::mat3_to_nxMat33(), and PhysxManager::point3_to_nxVec3().

Referenced by set_infinite().


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