Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

salt::BoundingSphere Class Reference

BoundingSphere provides a three dimensional sphere. More...

#include <bounds.h>

Collaboration diagram for salt::BoundingSphere:

Collaboration graph
[legend]
List of all members.

Public Member Functions

f_inline BoundingSphere ()
 constructs an empty sphere
f_inline BoundingSphere (const Vector3f &pos, float rad)
 constructs a sphere around pos with the radius rad
f_inline BoundingSphere (const Vector3f &pos, float rad, float radSq)
 Constructs a bounding sphere.
f_inline void EncapsulateFast (const Vector3f &v)
 encapsulates the vector v in the sphere, growing it if neccesary.
f_inline bool Contains (const Vector3f &v)
 returns true if the sphere contains the vector v
f_inline bool Contains (const BoundingSphere &s) const
 returns true if the sphere contains the sphere s
f_inline bool Intersects (const BoundingSphere &s) const
 returns true if this sphere and the sphere s intersect
void Encapsulate (const Vector3f &v)
 encapsulates the vector v in the sphere, growing it if neccesary.
bool Contains (const AABB3 &b) const
 returns true, if the sphere contains the axis aligned bounding box b
bool Intersects (const AABB3 &b) const
 returns true, if the sphere and the axis aligned bounding box b intersect

Public Attributes

Vector3f center
 describes the center of the sphere
float radius
 describes the radius of the sphere
float radiusSq
 the square of the sphere radius.

Detailed Description

BoundingSphere provides a three dimensional sphere.

Definition at line 234 of file bounds.h.


Constructor & Destructor Documentation

f_inline salt::BoundingSphere::BoundingSphere  )  [inline]
 

constructs an empty sphere

Definition at line 240 of file bounds.h.

f_inline salt::BoundingSphere::BoundingSphere const Vector3f pos,
float  rad
[inline]
 

constructs a sphere around pos with the radius rad

Definition at line 244 of file bounds.h.

f_inline salt::BoundingSphere::BoundingSphere const Vector3f pos,
float  rad,
float  radSq
[inline]
 

Constructs a bounding sphere.

Parameters:
pos The position where the sphere is constructed
rad is the radius of the sphere
radSq is the user supplied square of rad

Definition at line 252 of file bounds.h.


Member Function Documentation

bool BoundingSphere::Contains const AABB3 b  )  const
 

returns true, if the sphere contains the axis aligned bounding box b

Definition at line 89 of file bounds.cpp.

References center, salt::AABB3::maxVec, salt::AABB3::minVec, and radiusSq.

f_inline bool salt::BoundingSphere::Contains const BoundingSphere s  )  const [inline]
 

returns true if the sphere contains the sphere s

Definition at line 270 of file bounds.h.

References center, and radius.

f_inline bool salt::BoundingSphere::Contains const Vector3f v  )  [inline]
 

returns true if the sphere contains the vector v

Definition at line 266 of file bounds.h.

References center, and radiusSq.

Referenced by SoccerRuleAspect::ClearPlayers().

void BoundingSphere::Encapsulate const Vector3f v  ) 
 

encapsulates the vector v in the sphere, growing it if neccesary.

this method is accurate but slower than EncapsulateFast

Definition at line 47 of file bounds.cpp.

References center, salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dot(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Length(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Normalized(), radius, and radiusSq.

Here is the call graph for this function:

f_inline void salt::BoundingSphere::EncapsulateFast const Vector3f v  )  [inline]
 

encapsulates the vector v in the sphere, growing it if neccesary.

this method is fast but not accurate

Definition at line 260 of file bounds.h.

References center, salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dot(), salt::gSqrt(), radius, and radiusSq.

Here is the call graph for this function:

bool BoundingSphere::Intersects const AABB3 b  )  const
 

returns true, if the sphere and the axis aligned bounding box b intersect

Definition at line 65 of file bounds.cpp.

References center, salt::AABB3::maxVec, salt::AABB3::minVec, and radiusSq.

f_inline bool salt::BoundingSphere::Intersects const BoundingSphere s  )  const [inline]
 

returns true if this sphere and the sphere s intersect

Definition at line 277 of file bounds.h.

References center, and radius.


Member Data Documentation

Vector3f salt::BoundingSphere::center
 

describes the center of the sphere

Definition at line 297 of file bounds.h.

Referenced by Contains(), Encapsulate(), EncapsulateFast(), and Intersects().

float salt::BoundingSphere::radius
 

describes the radius of the sphere

Definition at line 300 of file bounds.h.

Referenced by Contains(), Encapsulate(), EncapsulateFast(), and Intersects().

float salt::BoundingSphere::radiusSq
 

the square of the sphere radius.

The value ist either accuratly calculated in the constructor or user supplied and may be inaccurate.

Definition at line 305 of file bounds.h.

Referenced by Contains(), Encapsulate(), EncapsulateFast(), and Intersects().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:48:37 2006 for rcssserver3d by  doxygen 1.4.4