Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
om::physics::shapes::CapsuleShape Class Reference

A class that represents a 3D capsule shape. More...

#include <omPhysicsCapsuleShape.h>

Inheritance diagram for om::physics::shapes::CapsuleShape:
om::physics::shapes::PhysicsShape

Public Member Functions

 CapsuleShape ()
 Create a capsule shape centered at the origin with a radius and height of 1. More...
 
 CapsuleShape (const Vector3f &newEndpoint1, const Vector3f &newEndpoint2, Float newRadius)
 Create a capsule shape with the specified endpoints and radius. More...
 
 CapsuleShape (const Vector3f &newEndpoint1, const Vector3f &newEndpoint2, Float newRadius1, Float newRadius2)
 Create a capsule shape with the specified endpoints and radii. More...
 
const Vector3f & getEndpoint1 () const
 Return the 3D position of this capsule shape's first endpoint in its local space. More...
 
SIMDFloat4 getEndpoint1SIMD () const
 Return the 4-wide SIMD position of this capsule shape's first endpoint in its local space. More...
 
void setEndpoint1 (const Vector3f &newEndpoint1)
 Set the 3D position of this capsule shape's first endpoint in its local space. More...
 
const Vector3f & getEndpoint2 () const
 Return the 3D position of this capsule shape's second endpoint in its local space. More...
 
SIMDFloat4 getEndpoint2SIMD () const
 Return the 4-wide SIMD position of this capsule shape's second endpoint in its local space. More...
 
void setEndpoint2 (const Vector3f &newEndpoint2)
 Set the 3D position of this capsule shape's second endpoint in its local space. More...
 
Float getRadius1 () const
 Return the radius of this capsule shape's first endpoint sphere in its local space. More...
 
void setRadius1 (Float newRadius1)
 Set the radius of this capsule's first endpoint sphere in its local space. More...
 
Float getRadius2 () const
 Return the radius of this capsule shape's second endpoint sphere in its local space. More...
 
void setRadius2 (Float newRadius2)
 Set the radius of this capsule's second endpoint sphere in its local space. More...
 
const Vector3f & getAxis () const
 Return the normalized axis of this capsule shape in its local space. More...
 
SIMDFloat4 getAxisSIMD () const
 Return the 4-wide SIMD normalized axis of this capsule shape in its local space. More...
 
void setAxis (const Vector3f &newAxis)
 Set the axis of this capsule's shaft. More...
 
Float getHeight () const
 Return the distance from the first endpoint to the second endpoint in local space. More...
 
void setHeight (Float newHeight)
 Set the distance from the first endpoint to the second endpoint in local space. More...
 
PhysicsMaterialgetMaterial () const
 Return a pointer to the physics material that this capsule shape is using. More...
 
void setMaterial (PhysicsMaterial *newMaterial)
 Set a pointer to the physics material that this capsule shape is using. More...
 
virtual void getMassInfo (Float &mass, Vector3f &massCenter, Matrix3f &inertia) const
 Get the mass distribution for this shape in its local space in the output parameters. More...
 
virtual Float getVolume () const
 Return the volume of this shape in distance units cubed (m^3) in its coordinate frame. More...
 
- Public Member Functions inherited from om::physics::shapes::PhysicsShape
virtual ~PhysicsShape ()
 Destroy this physics shape and all resources it has. More...
 
const AABB3f & getBoundingBox () const
 Return a const reference to the local bounding box of this shape in its coordinate frame. More...
 
ShapeFlagsgetFlags ()
 Return a reference to an object that contains boolean parameters of the shape. More...
 
const ShapeFlagsgetFlags () const
 Return an object that contains boolean parameters of the shape. More...
 
void setFlags (const ShapeFlags &newFlags)
 Set an object that contains boolean parameters of the shape. More...
 
Bool flagIsSet (ShapeFlags::Flag flag) const
 Return whether or not the specified boolan flag is set for this shape. More...
 
Bool flagsAreSet (const ShapeFlags &otherFlags) const
 Return whether or not all of the specified boolan flags are set for this shape. More...
 
void setFlag (ShapeFlags::Flag flag, Bool newIsSet=true)
 Set whether or not the specified boolan flag is set for this shape. More...
 
ShapeTypeID getTypeID () const
 Return an integer identifying the type of this collision shape. More...
 
const ShapeTypegetType () const
 Return an object representing the type of this PhysicsShape. More...
 

Static Public Member Functions

static SIMDFloat4 getSupportPoint (const CapsuleShape *capsule, const SIMDFloat4 &direction)
 Return the point on the specified capsule that is farthest in the given normalized direction. More...
 

Static Public Attributes

static const ShapeType TYPE
 A shape type object that represents the type to use for a capsule shape. More...
 
- Static Public Attributes inherited from om::physics::shapes::PhysicsShape
static const ResourceType RESOURCE_TYPE
 The resource type for a physics shape. More...
 

Additional Inherited Members

- Protected Member Functions inherited from om::physics::shapes::PhysicsShape
 PhysicsShape (const ShapeType *newType)
 Create a PhysicsShape object that has the specified subtype. More...
 
void setBoundingBox (const AABB3f &newBoundingBox)
 Set the local-space bounding box to use for this PhysicsShape. More...
 

Detailed Description

A class that represents a 3D capsule shape.

A capsule shape is the convex hull of two spheres, where each sphere can have a different radius and center position.

Constructor & Destructor Documentation

om::physics::shapes::CapsuleShape::CapsuleShape ( )

Create a capsule shape centered at the origin with a radius and height of 1.

om::physics::shapes::CapsuleShape::CapsuleShape ( const Vector3f &  newEndpoint1,
const Vector3f &  newEndpoint2,
Float  newRadius 
)

Create a capsule shape with the specified endpoints and radius.

om::physics::shapes::CapsuleShape::CapsuleShape ( const Vector3f &  newEndpoint1,
const Vector3f &  newEndpoint2,
Float  newRadius1,
Float  newRadius2 
)

Create a capsule shape with the specified endpoints and radii.

Member Function Documentation

const Vector3f& om::physics::shapes::CapsuleShape::getEndpoint1 ( ) const
inline

Return the 3D position of this capsule shape's first endpoint in its local space.

SIMDFloat4 om::physics::shapes::CapsuleShape::getEndpoint1SIMD ( ) const
inline

Return the 4-wide SIMD position of this capsule shape's first endpoint in its local space.

void om::physics::shapes::CapsuleShape::setEndpoint1 ( const Vector3f &  newEndpoint1)
inline

Set the 3D position of this capsule shape's first endpoint in its local space.

This keeps the capsule's 2nd endpoint in the same location and updates all other capsule properties to be consistent with the new first endpoint.

const Vector3f& om::physics::shapes::CapsuleShape::getEndpoint2 ( ) const
inline

Return the 3D position of this capsule shape's second endpoint in its local space.

SIMDFloat4 om::physics::shapes::CapsuleShape::getEndpoint2SIMD ( ) const
inline

Return the 4-wide SIMD position of this capsule shape's second endpoint in its local space.

void om::physics::shapes::CapsuleShape::setEndpoint2 ( const Vector3f &  newEndpoint2)
inline

Set the 3D position of this capsule shape's second endpoint in its local space.

This keeps the capsule's 1st endpoint in the same location and updates all other capsule properties to be consistent with the new second endpoint.

Float om::physics::shapes::CapsuleShape::getRadius1 ( ) const
inline

Return the radius of this capsule shape's first endpoint sphere in its local space.

void om::physics::shapes::CapsuleShape::setRadius1 ( Float  newRadius1)
inline

Set the radius of this capsule's first endpoint sphere in its local space.

This radius value is clamped to the range of [0,+infinity].

Float om::physics::shapes::CapsuleShape::getRadius2 ( ) const
inline

Return the radius of this capsule shape's second endpoint sphere in its local space.

void om::physics::shapes::CapsuleShape::setRadius2 ( Float  newRadius2)
inline

Set the radius of this capsule's second endpoint sphere in its local space.

This radius value is clamped to the range of [0,+infinity].

const Vector3f& om::physics::shapes::CapsuleShape::getAxis ( ) const
inline

Return the normalized axis of this capsule shape in its local space.

SIMDFloat4 om::physics::shapes::CapsuleShape::getAxisSIMD ( ) const
inline

Return the 4-wide SIMD normalized axis of this capsule shape in its local space.

void om::physics::shapes::CapsuleShape::setAxis ( const Vector3f &  newAxis)
inline

Set the axis of this capsule's shaft.

This new axis vector is normalized and then the capsule's 2nd endpoint is recomputed using the new axis vector and the capsule's height and 1st endpoint.

Float om::physics::shapes::CapsuleShape::getHeight ( ) const
inline

Return the distance from the first endpoint to the second endpoint in local space.

void om::physics::shapes::CapsuleShape::setHeight ( Float  newHeight)
inline

Set the distance from the first endpoint to the second endpoint in local space.

This method keeps the capsule's first endpoint at the same location and recomputes the capsule's 2nd endpoint based on the capsule's axis and the new height value.

This height value is clamped to the range of [0,+infinity].

PhysicsMaterial* om::physics::shapes::CapsuleShape::getMaterial ( ) const
inline

Return a pointer to the physics material that this capsule shape is using.

void om::physics::shapes::CapsuleShape::setMaterial ( PhysicsMaterial newMaterial)
inline

Set a pointer to the physics material that this capsule shape is using.

SIMDFloat4 om::physics::shapes::CapsuleShape::getSupportPoint ( const CapsuleShape capsule,
const SIMDFloat4 &  direction 
)
inlinestatic

Return the point on the specified capsule that is farthest in the given normalized direction.

virtual void om::physics::shapes::CapsuleShape::getMassInfo ( Float mass,
Vector3f &  massCenter,
Matrix3f &  inertia 
) const
virtual

Get the mass distribution for this shape in its local space in the output parameters.

Implements om::physics::shapes::PhysicsShape.

virtual Float om::physics::shapes::CapsuleShape::getVolume ( ) const
virtual

Return the volume of this shape in distance units cubed (m^3) in its coordinate frame.

Implements om::physics::shapes::PhysicsShape.

Member Data Documentation

const ShapeType om::physics::shapes::CapsuleShape::TYPE
static

A shape type object that represents the type to use for a capsule shape.


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