Support Forum       G3D Web Page     
Public Member Functions | List of all members
G3D::Capsule Class Reference


A shape formed by extruding a sphere along a line segment. More...

Public Member Functions

 Capsule ()
 Uninitialized. More...
 
 Capsule (class BinaryInput &b)
 
 Capsule (const Vector3 &_p1, const Vector3 &_p2, float _r)
 
float area () const
 
Line axis () const
 The line down the center of the capsule. More...
 
Vector3 center () const
 
bool contains (const Vector3 &p) const
 
Returns true if the point is inside the capsule or on its surface. More...
 
void deserialize (class BinaryInput &b)
 
void getBounds (AABox &out) const
 Get axis aligned bounding box. More...
 
void getRandomSurfacePoint (Vector3 &P, Vector3 &N, Random &rnd=Random::common()) const
 Random world space point with outward facing normal. More...
 
void getReferenceFrame (class CoordinateFrame &cframe) const
 Get a reference frame in which the center of mass is the origin and Y is the axis of the capsule. More...
 
float height () const
 Distance between the sphere centers. More...
 
Vector3 point (int i) const
 Argument may be 0 or 1. More...
 
float radius () const
 
Vector3 randomInteriorPoint (Random &rnd=Random::common()) const
 Point selected uniformly at random over the volume. More...
 
void serialize (class BinaryOutput &b) const
 
float volume () const
 

Detailed Description


A shape formed by extruding a sphere along a line segment.

Constructor & Destructor Documentation

◆ Capsule() [1/3]

G3D::Capsule::Capsule ( )

Uninitialized.

◆ Capsule() [2/3]

G3D::Capsule::Capsule ( class BinaryInput b)

◆ Capsule() [3/3]

G3D::Capsule::Capsule ( const Vector3 _p1,
const Vector3 _p2,
float  _r 
)

Member Function Documentation

◆ area()

float G3D::Capsule::area ( ) const

Referenced by G3D::CapsuleShape::area().

◆ axis()

Line G3D::Capsule::axis ( ) const

The line down the center of the capsule.

◆ center()

Vector3 G3D::Capsule::center ( ) const
inline

◆ contains()

bool G3D::Capsule::contains ( const Vector3 p) const


Returns true if the point is inside the capsule or on its surface.

◆ deserialize()

void G3D::Capsule::deserialize ( class BinaryInput b)

◆ getBounds()

void G3D::Capsule::getBounds ( AABox out) const

Get axis aligned bounding box.

Referenced by G3D::CapsuleShape::boundingAABox().

◆ getRandomSurfacePoint()

void G3D::Capsule::getRandomSurfacePoint ( Vector3 P,
Vector3 N,
Random rnd = Random::common() 
) const

Random world space point with outward facing normal.

Referenced by G3D::CapsuleShape::getRandomSurfacePoint().

◆ getReferenceFrame()

void G3D::Capsule::getReferenceFrame ( class CoordinateFrame cframe) const

Get a reference frame in which the center of mass is the origin and Y is the axis of the capsule.

◆ height()

float G3D::Capsule::height ( ) const
inline

Distance between the sphere centers.

The total extent of the cylinder is 2r + h.

◆ point()

Vector3 G3D::Capsule::point ( int  i) const
inline

Argument may be 0 or 1.

Referenced by G3D::CapsuleShape::boundingSphere().

◆ radius()

float G3D::Capsule::radius ( ) const
inline

◆ randomInteriorPoint()

Vector3 G3D::Capsule::randomInteriorPoint ( Random rnd = Random::common()) const

Point selected uniformly at random over the volume.

Referenced by G3D::CapsuleShape::randomInteriorPoint().

◆ serialize()

void G3D::Capsule::serialize ( class BinaryOutput b) const

◆ volume()

float G3D::Capsule::volume ( ) const

documentation generated on Wed Nov 24 2021 08:01:53 using doxygen 1.8.15