Sphere collision volume. More...
#include <decCollisionSphere.h>
Public Member Functions | |
Constructors and Destructors | |
| decCollisionSphere () | |
| Creates a new collision sphere with no radius located at the origin. | |
| decCollisionSphere (const decVector ¢er, float radius) | |
| Creates a new collision sphere with the given parameters. | |
| ~decCollisionSphere () | |
| Cleans up the collision sphere. | |
First Stage Dispatch | |
| virtual bool | VolumeHitsVolume (decCollisionVolume *volume) |
| Determines if this volume collides with the given one. | |
| virtual float | VolumeMoveHitsVolume (decCollisionVolume *volume, const decVector &displacement, decVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits another one. | |
Second Stage Dispatch | |
| virtual bool | SphereHitsVolume (decCollisionSphere *sphere) |
| Determines if the given sphere collides with this volume. | |
| virtual bool | CylinderHitsVolume (decCollisionCylinder *cylinder) |
| Determines if the given cylinder collides with this volume. | |
| virtual bool | CapsuleHitsVolume (decCollisionCapsule *capsule) |
| Determines if the given capsule collides with this volume. | |
| virtual bool | BoxHitsVolume (decCollisionBox *box) |
| Determines if the given box collides with this volume. | |
| virtual bool | TriangleHitsVolume (decCollisionTriangle *triangle) |
| Determines if the given triangle collides with this volume. | |
| virtual bool | FrustumHitsVolume (decCollisionFrustum *frustum) |
| Determines if the given frustum collides with this volume. | |
| virtual float | SphereMoveHitsVolume (decCollisionSphere *sphere, const decVector &displacement, decVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a sphere. | |
| virtual float | CylinderMoveHitsVolume (decCollisionCylinder *cylinder, const decVector &displacement, decVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a cylinder. | |
| virtual float | CapsuleMoveHitsVolume (decCollisionCapsule *capsule, const decVector &displacement, decVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a capsule. | |
| virtual float | BoxMoveHitsVolume (decCollisionBox *box, const decVector &displacement, decVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a box. | |
| virtual float | TriangleMoveHitsVolume (decCollisionTriangle *triangle, const decVector &displacement, decVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a triangle. | |
| virtual float | FrustumMoveHitsVolume (decCollisionFrustum *frustum, const decVector &displacement, decVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a frustum. | |
| virtual float | PointMoveHitsVolume (const decVector &point, const decVector &displacement, decVector *normal) |
| Retrieves the distance travelled along a given displacement vector until the given point hits this volume. | |
Enclosing Volumes | |
| virtual void | GetEnclosingSphere (decCollisionSphere *sphere) |
| Retrieves the sphere volume best enclosing this volume. | |
| virtual void | GetEnclosingBox (decCollisionBox *box) |
| Retrieves the box volume best enclosing this volume. | |
Miscelanous Functions | |
| virtual decVector | ClosestPointTo (const decVector &point) |
| Retrieves the closest point on the volume. | |
| virtual decVector | NormalAtPoint (const decVector &point) |
| Retrieves the surface normal through the given point. | |
| virtual bool | RayHitsVolume (const decVector &rayOrigin, const decVector &rayDirection, float &hitDistance) |
| Determines if a ray hits the volume. | |
Visiting | |
| virtual void | Visit (decCollisionVolumeVisitor *visitor) |
| Visits the collision volume. | |
Collision Routines | |
| bool | SphereHitsSphere (decCollisionSphere *sphere) |
| Determines if the given sphere collides with this sphere. | |
| float | SphereMoveHitsSphere (decCollisionSphere *sphere, const decVector &displacement, decVector *normal) |
| Determines the distance of the given sphere to move until colliding with this sphere. | |
Parameters | |
| const decVector & | GetCenter () const |
| Retrieves the center point of the sphere. | |
| float | GetRadius () const |
| Retrieves the radius of the sphere. | |
| float | GetSquareRadius () const |
| Retrieves the sqaured radius of the sphere. | |
| void | SetCenter (const decVector ¢er) |
| Sets the center point of the sphere. | |
| void | SetRadius (float radius) |
| Sets the radius of the sphere. | |
| void | SetAll (const decVector ¢er, float radius) |
| Sets all sphere parameters at once. | |
Sphere collision volume.
Defines a collision volume in the shape of a sphere. The sphere is defined by a center point and a radius. The surface of the sphere is considered to be part of the volume.
| decCollisionSphere::decCollisionSphere | ( | ) |
Creates a new collision sphere with no radius located at the origin.
| decCollisionSphere::decCollisionSphere | ( | const decVector & | center, |
| float | radius | ||
| ) |
Creates a new collision sphere with the given parameters.
| center | Center point of sphere |
| radius | Radius of sphere beeing at least 0 |
| decCollisionSphere::~decCollisionSphere | ( | ) |
Cleans up the collision sphere.
| virtual bool decCollisionSphere::BoxHitsVolume | ( | decCollisionBox * | box ) | [virtual] |
Determines if the given box collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual float decCollisionSphere::BoxMoveHitsVolume | ( | decCollisionBox * | box, |
| const decVector & | displacement, | ||
| decVector * | normal | ||
| ) | [virtual] |
Retrieves the distance travelled along a given displacement vector until this volume hits a box.
The returned value is in the range of 0 to 1. If no collision happens 1 is returned. In case of collision 'normal' has to be filled in with a normalized vector designating the plane along which this volume can be moved without colliding the given volume. Set 'normal' to NULL if you are not interested in this information. The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual bool decCollisionSphere::CapsuleHitsVolume | ( | decCollisionCapsule * | capsule ) | [virtual] |
Determines if the given capsule collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual float decCollisionSphere::CapsuleMoveHitsVolume | ( | decCollisionCapsule * | capsule, |
| const decVector & | displacement, | ||
| decVector * | normal | ||
| ) | [virtual] |
Retrieves the distance travelled along a given displacement vector until this volume hits a capsule.
The returned value is in the range of 0 to 1. If no collision happens 1 is returned. In case of collision 'normal' has to be filled in with a normalized vector designating the plane along which this volume can be moved without colliding the given volume. Set 'normal' to NULL if you are not interested in this information. The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
Retrieves the closest point on the volume.
Implements decCollisionVolume.
| virtual bool decCollisionSphere::CylinderHitsVolume | ( | decCollisionCylinder * | cylinder ) | [virtual] |
Determines if the given cylinder collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual float decCollisionSphere::CylinderMoveHitsVolume | ( | decCollisionCylinder * | cylinder, |
| const decVector & | displacement, | ||
| decVector * | normal | ||
| ) | [virtual] |
Retrieves the distance travelled along a given displacement vector until this volume hits a cylinder.
The returned value is in the range of 0 to 1. If no collision happens 1 is returned. In case of collision 'normal' has to be filled in with a normalized vector designating the plane along which this volume can be moved without colliding the given volume. Set 'normal' to NULL if you are not interested in this information. The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual bool decCollisionSphere::FrustumHitsVolume | ( | decCollisionFrustum * | frustum ) | [virtual] |
Determines if the given frustum collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual float decCollisionSphere::FrustumMoveHitsVolume | ( | decCollisionFrustum * | frustum, |
| const decVector & | displacement, | ||
| decVector * | normal | ||
| ) | [virtual] |
Retrieves the distance travelled along a given displacement vector until this volume hits a frustum.
The returned value is in the range of 0 to 1. If no collision happens 1 is returned. In case of collision 'normal' has to be filled in with a normalized vector designating the plane along which this volume can be moved without colliding the given volume. Set 'normal' to NULL if you are not interested in this information. The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| const decVector& decCollisionSphere::GetCenter | ( | ) | const [inline] |
Retrieves the center point of the sphere.
| virtual void decCollisionSphere::GetEnclosingBox | ( | decCollisionBox * | box ) | [virtual] |
Retrieves the box volume best enclosing this volume.
Implements decCollisionVolume.
| virtual void decCollisionSphere::GetEnclosingSphere | ( | decCollisionSphere * | sphere ) | [virtual] |
Retrieves the sphere volume best enclosing this volume.
Implements decCollisionVolume.
| float decCollisionSphere::GetRadius | ( | ) | const [inline] |
Retrieves the radius of the sphere.
| float decCollisionSphere::GetSquareRadius | ( | ) | const [inline] |
Retrieves the sqaured radius of the sphere.
Retrieves the surface normal through the given point.
The point is either right on the surface or near to it. This function is relaxing in this case and tries to calculate the best normal pointing from the volume at the point. For certain points a normal is impossible to determine. The normal in this case is undefined.
| point | Point to determine the normal for. |
Reimplemented from decCollisionVolume.
| virtual float decCollisionSphere::PointMoveHitsVolume | ( | const decVector & | point, |
| const decVector & | displacement, | ||
| decVector * | normal | ||
| ) | [virtual] |
Retrieves the distance travelled along a given displacement vector until the given point hits this volume.
The returned value is in the range of 0 to 1. If no collision happens 1 is returned. In case of collision 'normal' has to be filled in with a normalized vector designating the plane along which this volume can be moved without colliding the given volume. Set 'normal' to NULL if you are not interested in this information. The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual bool decCollisionSphere::RayHitsVolume | ( | const decVector & | rayOrigin, |
| const decVector & | rayDirection, | ||
| float & | hitDistance | ||
| ) | [virtual] |
Determines if a ray hits the volume.
| rayOrigin | Origin of the ray. |
| rayDirection | Normalized direction of the ray. |
| hitDistance | If the ray hits this will be set to the distance from the ray origin to the collision point. |
Reimplemented from decCollisionVolume.
| void decCollisionSphere::SetAll | ( | const decVector & | center, |
| float | radius | ||
| ) |
Sets all sphere parameters at once.
| center | Center point of sphere |
| radius | Radius of sphere beeing at least 0 |
| void decCollisionSphere::SetCenter | ( | const decVector & | center ) |
Sets the center point of the sphere.
| void decCollisionSphere::SetRadius | ( | float | radius ) |
Sets the radius of the sphere.
| radius | Radius of sphere beeing at least 0 |
| bool decCollisionSphere::SphereHitsSphere | ( | decCollisionSphere * | sphere ) |
Determines if the given sphere collides with this sphere.
| virtual bool decCollisionSphere::SphereHitsVolume | ( | decCollisionSphere * | sphere ) | [virtual] |
Determines if the given sphere collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| float decCollisionSphere::SphereMoveHitsSphere | ( | decCollisionSphere * | sphere, |
| const decVector & | displacement, | ||
| decVector * | normal | ||
| ) |
Determines the distance of the given sphere to move until colliding with this sphere.
| virtual float decCollisionSphere::SphereMoveHitsVolume | ( | decCollisionSphere * | sphere, |
| const decVector & | displacement, | ||
| decVector * | normal | ||
| ) | [virtual] |
Retrieves the distance travelled along a given displacement vector until this volume hits a sphere.
The returned value is in the range of 0 to 1. If no collision happens 1 is returned. In case of collision 'normal' has to be filled in with a normalized vector designating the plane along which this volume can be moved without colliding the given volume. Set 'normal' to NULL if you are not interested in this information. The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual bool decCollisionSphere::TriangleHitsVolume | ( | decCollisionTriangle * | triangle ) | [virtual] |
Determines if the given triangle collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual float decCollisionSphere::TriangleMoveHitsVolume | ( | decCollisionTriangle * | triangle, |
| const decVector & | displacement, | ||
| decVector * | normal | ||
| ) | [virtual] |
Retrieves the distance travelled along a given displacement vector until this volume hits a triangle.
The returned value is in the range of 0 to 1. If no collision happens 1 is returned. In case of collision 'normal' has to be filled in with a normalized vector designating the plane along which this volume can be moved without colliding the given volume. Set 'normal' to NULL if you are not interested in this information. The subclass has to dispatch to a collision function here.
Implements decCollisionVolume.
| virtual void decCollisionSphere::Visit | ( | decCollisionVolumeVisitor * | visitor ) | [virtual] |
Visits the collision volume.
Implements decCollisionVolume.
| virtual bool decCollisionSphere::VolumeHitsVolume | ( | decCollisionVolume * | volume ) | [virtual] |
Determines if this volume collides with the given one.
The subclass has to dispatch to a second stage function here.
Implements decCollisionVolume.
| virtual float decCollisionSphere::VolumeMoveHitsVolume | ( | decCollisionVolume * | volume, |
| const decVector & | displacement, | ||
| decVector * | normal | ||
| ) | [virtual] |
Retrieves the distance travelled along a given displacement vector until this volume hits another one.
The returned value is in the range of 0 to 1. If no collision happens 1 is returned. In case of collision 'normal' has to be filled in with a normalized vector designating the plane along which this volume can be moved without colliding the given volume. Set 'normal' to NULL if you are not interested in this information. The subclass has to dispatch to a second stage function here.
Implements decCollisionVolume.
1.7.2