Sphere collision volume. More...
#include <decDCollisionSphere.h>
Public Member Functions | |
Constructors and Destructors | |
| decDCollisionSphere () | |
| Creates a new collision sphere with no radius located at the origin. | |
| decDCollisionSphere (const decDVector ¢er, double radius) | |
| Creates a new collision sphere with the given parameters. | |
| ~decDCollisionSphere () | |
| Cleans up the collision sphere. | |
First Stage Dispatch | |
| virtual bool | VolumeHitsVolume (decDCollisionVolume *volume) |
| Determines if this volume collides with the given one. | |
| virtual double | VolumeMoveHitsVolume (decDCollisionVolume *volume, const decDVector &displacement, decDVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits another one. | |
Second Stage Dispatch | |
| virtual bool | SphereHitsVolume (decDCollisionSphere *sphere) |
| Determines if the given sphere collides with this volume. | |
| virtual bool | CylinderHitsVolume (decDCollisionCylinder *cylinder) |
| Determines if the given cylinder collides with this volume. | |
| virtual bool | CapsuleHitsVolume (decDCollisionCapsule *capsule) |
| Determines if the given capsule collides with this volume. | |
| virtual bool | BoxHitsVolume (decDCollisionBox *box) |
| Determines if the given box collides with this volume. | |
| virtual bool | TriangleHitsVolume (decDCollisionTriangle *triangle) |
| Determines if the given triangle collides with this volume. | |
| virtual bool | FrustumHitsVolume (decDCollisionFrustum *frustum) |
| Determines if the given frustum collides with this volume. | |
| virtual double | SphereMoveHitsVolume (decDCollisionSphere *sphere, const decDVector &displacement, decDVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a sphere. | |
| virtual double | CylinderMoveHitsVolume (decDCollisionCylinder *cylinder, const decDVector &displacement, decDVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a cylinder. | |
| virtual double | CapsuleMoveHitsVolume (decDCollisionCapsule *capsule, const decDVector &displacement, decDVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a capsule. | |
| virtual double | BoxMoveHitsVolume (decDCollisionBox *box, const decDVector &displacement, decDVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a box. | |
| virtual double | TriangleMoveHitsVolume (decDCollisionTriangle *triangle, const decDVector &displacement, decDVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a triangle. | |
| virtual double | FrustumMoveHitsVolume (decDCollisionFrustum *frustum, const decDVector &displacement, decDVector *normal) |
| Retrieves the distance travelled along a given displacement vector until this volume hits a frustum. | |
| virtual double | PointMoveHitsVolume (const decDVector &point, const decDVector &displacement, decDVector *normal) |
| Retrieves the distance travelled along a given displacement vector until the given point hits this volume. | |
Enclosing Volumes | |
| virtual void | GetEnclosingSphere (decDCollisionSphere *sphere) |
| Retrieves the sphere volume best enclosing this volume. | |
| virtual void | GetEnclosingBox (decDCollisionBox *box) |
| Retrieves the box volume best enclosing this volume. | |
Miscelanous Functions | |
| virtual decDVector | ClosestPointTo (const decDVector &point) |
| Retrieves the closest point on the volume. | |
| virtual decDVector | NormalAtPoint (const decDVector &point) |
| Retrieves the surface normal through the given point. | |
| virtual bool | RayHitsVolume (const decDVector &rayOrigin, const decDVector &rayDirection, double &hitDistance) |
| Determines if a ray hits the volume. | |
Visiting | |
| virtual void | Visit (decDCollisionVolumeVisitor *visitor) |
| Visits the collision volume. | |
Collision Routines | |
| bool | SphereHitsSphere (decDCollisionSphere *sphere) |
| Determines if the given sphere collides with this sphere. | |
| double | SphereMoveHitsSphere (decDCollisionSphere *sphere, const decDVector &displacement, decDVector *normal) |
| Determines the distance of the given sphere to move until colliding with this sphere. | |
Parameters | |
| const decDVector & | GetCenter () const |
| Retrieves the center point of the sphere. | |
| double | GetRadius () const |
| Retrieves the radius of the sphere. | |
| double | GetSquareRadius () const |
| Retrieves the sqaured radius of the sphere. | |
| void | SetCenter (const decDVector ¢er) |
| Sets the center point of the sphere. | |
| void | SetRadius (double radius) |
| Sets the radius of the sphere. | |
| void | SetAll (const decDVector ¢er, double 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.
| decDCollisionSphere::decDCollisionSphere | ( | ) |
Creates a new collision sphere with no radius located at the origin.
| decDCollisionSphere::decDCollisionSphere | ( | const decDVector & | center, |
| double | radius | ||
| ) |
Creates a new collision sphere with the given parameters.
| center | Center point of sphere |
| radius | Radius of sphere beeing at least 0 |
| decDCollisionSphere::~decDCollisionSphere | ( | ) |
Cleans up the collision sphere.
| virtual bool decDCollisionSphere::BoxHitsVolume | ( | decDCollisionBox * | box ) | [virtual] |
Determines if the given box collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decDCollisionVolume.
| virtual double decDCollisionSphere::BoxMoveHitsVolume | ( | decDCollisionBox * | box, |
| const decDVector & | displacement, | ||
| decDVector * | 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 decDCollisionVolume.
| virtual bool decDCollisionSphere::CapsuleHitsVolume | ( | decDCollisionCapsule * | capsule ) | [virtual] |
Determines if the given capsule collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decDCollisionVolume.
| virtual double decDCollisionSphere::CapsuleMoveHitsVolume | ( | decDCollisionCapsule * | capsule, |
| const decDVector & | displacement, | ||
| decDVector * | 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 decDCollisionVolume.
| virtual decDVector decDCollisionSphere::ClosestPointTo | ( | const decDVector & | point ) | [virtual] |
Retrieves the closest point on the volume.
Implements decDCollisionVolume.
| virtual bool decDCollisionSphere::CylinderHitsVolume | ( | decDCollisionCylinder * | cylinder ) | [virtual] |
Determines if the given cylinder collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decDCollisionVolume.
| virtual double decDCollisionSphere::CylinderMoveHitsVolume | ( | decDCollisionCylinder * | cylinder, |
| const decDVector & | displacement, | ||
| decDVector * | 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 decDCollisionVolume.
| virtual bool decDCollisionSphere::FrustumHitsVolume | ( | decDCollisionFrustum * | frustum ) | [virtual] |
Determines if the given frustum collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decDCollisionVolume.
| virtual double decDCollisionSphere::FrustumMoveHitsVolume | ( | decDCollisionFrustum * | frustum, |
| const decDVector & | displacement, | ||
| decDVector * | 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 decDCollisionVolume.
| const decDVector& decDCollisionSphere::GetCenter | ( | ) | const [inline] |
Retrieves the center point of the sphere.
| virtual void decDCollisionSphere::GetEnclosingBox | ( | decDCollisionBox * | box ) | [virtual] |
Retrieves the box volume best enclosing this volume.
Implements decDCollisionVolume.
| virtual void decDCollisionSphere::GetEnclosingSphere | ( | decDCollisionSphere * | sphere ) | [virtual] |
Retrieves the sphere volume best enclosing this volume.
Implements decDCollisionVolume.
| double decDCollisionSphere::GetRadius | ( | ) | const [inline] |
Retrieves the radius of the sphere.
| double decDCollisionSphere::GetSquareRadius | ( | ) | const [inline] |
Retrieves the sqaured radius of the sphere.
| virtual decDVector decDCollisionSphere::NormalAtPoint | ( | const decDVector & | point ) | [virtual] |
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 decDCollisionVolume.
| virtual double decDCollisionSphere::PointMoveHitsVolume | ( | const decDVector & | point, |
| const decDVector & | displacement, | ||
| decDVector * | 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 decDCollisionVolume.
| virtual bool decDCollisionSphere::RayHitsVolume | ( | const decDVector & | rayOrigin, |
| const decDVector & | rayDirection, | ||
| double & | 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 decDCollisionVolume.
| void decDCollisionSphere::SetAll | ( | const decDVector & | center, |
| double | radius | ||
| ) |
Sets all sphere parameters at once.
| center | Center point of sphere |
| radius | Radius of sphere beeing at least 0 |
| void decDCollisionSphere::SetCenter | ( | const decDVector & | center ) |
Sets the center point of the sphere.
| void decDCollisionSphere::SetRadius | ( | double | radius ) |
Sets the radius of the sphere.
| radius | Radius of sphere beeing at least 0 |
| bool decDCollisionSphere::SphereHitsSphere | ( | decDCollisionSphere * | sphere ) |
Determines if the given sphere collides with this sphere.
| virtual bool decDCollisionSphere::SphereHitsVolume | ( | decDCollisionSphere * | sphere ) | [virtual] |
Determines if the given sphere collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decDCollisionVolume.
| double decDCollisionSphere::SphereMoveHitsSphere | ( | decDCollisionSphere * | sphere, |
| const decDVector & | displacement, | ||
| decDVector * | normal | ||
| ) |
Determines the distance of the given sphere to move until colliding with this sphere.
| virtual double decDCollisionSphere::SphereMoveHitsVolume | ( | decDCollisionSphere * | sphere, |
| const decDVector & | displacement, | ||
| decDVector * | 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 decDCollisionVolume.
| virtual bool decDCollisionSphere::TriangleHitsVolume | ( | decDCollisionTriangle * | triangle ) | [virtual] |
Determines if the given triangle collides with this volume.
The subclass has to dispatch to a collision function here.
Implements decDCollisionVolume.
| virtual double decDCollisionSphere::TriangleMoveHitsVolume | ( | decDCollisionTriangle * | triangle, |
| const decDVector & | displacement, | ||
| decDVector * | 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 decDCollisionVolume.
| virtual void decDCollisionSphere::Visit | ( | decDCollisionVolumeVisitor * | visitor ) | [virtual] |
Visits the collision volume.
Implements decDCollisionVolume.
| virtual bool decDCollisionSphere::VolumeHitsVolume | ( | decDCollisionVolume * | volume ) | [virtual] |
Determines if this volume collides with the given one.
The subclass has to dispatch to a second stage function here.
Implements decDCollisionVolume.
| virtual double decDCollisionSphere::VolumeMoveHitsVolume | ( | decDCollisionVolume * | volume, |
| const decDVector & | displacement, | ||
| decDVector * | 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 decDCollisionVolume.
1.7.2