Triangle collision volume. More...
#include <decDCollisionTriangle.h>
Public Member Functions | |
Constructors and Destructors | |
| decDCollisionTriangle () | |
| Creates a new collision triangle with all points 0. | |
| decDCollisionTriangle (const decDVector &corner1, const decDVector &corner2, const decDVector &corner3) | |
| Creates a new collision triangle from the given parameters. | |
| decDCollisionTriangle (const decDVector &corner1, const decDVector &corner2, const decDVector &corner3, const decDVector &normal) | |
| Creates a new collision triangle from the given parameters. | |
| virtual | ~decDCollisionTriangle () |
| Cleans up the collision triangle. | |
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. | |
Visiting | |
| virtual void | Visit (decDCollisionVolumeVisitor *visitor) |
| Visits the collision volume. | |
Collision Routines | |
| bool | SphereHitsTriangle (decDCollisionSphere *sphere) |
| Determines if the given sphere hits this triangle. | |
| bool | CylinderHitsTriangle (decDCollisionCylinder *cylinder) |
| Determines if the given cylinder hits this triangle. | |
| bool | CapsuleHitsTriangle (decDCollisionCapsule *capsule) |
| Determines if the given capsule hits this triangle. | |
| bool | BoxHitsTriangle (decDCollisionBox *box) |
| Determines if the given box hits this triangle. | |
| bool | TriangleHitsTriangle (decDCollisionTriangle *triangle) |
| Determines if the given triangle hits this triangle. | |
| double | SphereMoveHitsTriangle (decDCollisionSphere *sphere, const decDVector &displacement, decDVector *normal) |
| Determines the distance of the given sphere to move until colliding with this triangle. | |
| double | CylinderMoveHitsTriangle (decDCollisionCylinder *cylinder, const decDVector &displacement, decDVector *normal) |
| Determines the distance of the given cylinder to move until colliding with this triangle. | |
| double | CapsuleMoveHitsTriangle (decDCollisionCapsule *capsule, const decDVector &displacement, decDVector *normal) |
| Determines the distance of the given capsule to move until colliding with this triangle. | |
| double | BoxMoveHitsTriangle (decDCollisionBox *box, const decDVector &displacement, decDVector *normal) |
| Determines the distance of the given box to move until colliding with this triangle. | |
| double | TriangleMoveHitsTriangle (decDCollisionTriangle *triangle, const decDVector &displacement, decDVector *normal) |
| Determines the distance of the given triangle to move until colliding with this triangle. | |
Management | |
| const decDVector & | GetCorner1 () const |
| const decDVector & | GetCorner2 () const |
| const decDVector & | GetCorner3 () const |
| const decDVector & | GetNormal () const |
| double | GetDistance () const |
| Retrieves the precalculated distance value. | |
| void | SetCorners (const decDVector &corner1, const decDVector &corner2, const decDVector &corner3) |
| Sets the corners of the triangle and calculates the normal and distance. | |
| void | SetCorners (const decDVector &corner1, const decDVector &corner2, const decDVector &corner3, const decDVector &normal) |
| Sets the corners of the triangle and calculates the distance. | |
Triangle collision volume.
Defines a collision volume in the shape of a triangle. The triangle is defined by the three corner points. The points should be oriented in counter clockwise order.
| decDCollisionTriangle::decDCollisionTriangle | ( | ) |
Creates a new collision triangle with all points 0.
| decDCollisionTriangle::decDCollisionTriangle | ( | const decDVector & | corner1, |
| const decDVector & | corner2, | ||
| const decDVector & | corner3 | ||
| ) |
Creates a new collision triangle from the given parameters.
| decDCollisionTriangle::decDCollisionTriangle | ( | const decDVector & | corner1, |
| const decDVector & | corner2, | ||
| const decDVector & | corner3, | ||
| const decDVector & | normal | ||
| ) |
Creates a new collision triangle from the given parameters.
Here you can also specify the normal of the triangle. Do not use this function anymore as it depracted and will be removed soon.
| virtual decDCollisionTriangle::~decDCollisionTriangle | ( | ) | [virtual] |
Cleans up the collision triangle.
| bool decDCollisionTriangle::BoxHitsTriangle | ( | decDCollisionBox * | box ) |
Determines if the given box hits this triangle.
| virtual bool decDCollisionTriangle::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.
| double decDCollisionTriangle::BoxMoveHitsTriangle | ( | decDCollisionBox * | box, |
| const decDVector & | displacement, | ||
| decDVector * | normal | ||
| ) |
Determines the distance of the given box to move until colliding with this triangle.
| virtual double decDCollisionTriangle::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.
| bool decDCollisionTriangle::CapsuleHitsTriangle | ( | decDCollisionCapsule * | capsule ) |
Determines if the given capsule hits this triangle.
| virtual bool decDCollisionTriangle::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.
| double decDCollisionTriangle::CapsuleMoveHitsTriangle | ( | decDCollisionCapsule * | capsule, |
| const decDVector & | displacement, | ||
| decDVector * | normal | ||
| ) |
Determines the distance of the given capsule to move until colliding with this triangle.
| virtual double decDCollisionTriangle::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 decDCollisionTriangle::ClosestPointTo | ( | const decDVector & | point ) | [virtual] |
Retrieves the closest point on the volume.
Implements decDCollisionVolume.
| bool decDCollisionTriangle::CylinderHitsTriangle | ( | decDCollisionCylinder * | cylinder ) |
Determines if the given cylinder hits this triangle.
| virtual bool decDCollisionTriangle::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.
| double decDCollisionTriangle::CylinderMoveHitsTriangle | ( | decDCollisionCylinder * | cylinder, |
| const decDVector & | displacement, | ||
| decDVector * | normal | ||
| ) |
Determines the distance of the given cylinder to move until colliding with this triangle.
| virtual double decDCollisionTriangle::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 decDCollisionTriangle::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 decDCollisionTriangle::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& decDCollisionTriangle::GetCorner1 | ( | ) | const [inline] |
| const decDVector& decDCollisionTriangle::GetCorner2 | ( | ) | const [inline] |
| const decDVector& decDCollisionTriangle::GetCorner3 | ( | ) | const [inline] |
| double decDCollisionTriangle::GetDistance | ( | ) | const [inline] |
Retrieves the precalculated distance value.
The distance is the dot product between the first corner point and the triangle normal.
| virtual void decDCollisionTriangle::GetEnclosingBox | ( | decDCollisionBox * | box ) | [virtual] |
Retrieves the box volume best enclosing this volume.
Implements decDCollisionVolume.
| virtual void decDCollisionTriangle::GetEnclosingSphere | ( | decDCollisionSphere * | sphere ) | [virtual] |
Retrieves the sphere volume best enclosing this volume.
Implements decDCollisionVolume.
| const decDVector& decDCollisionTriangle::GetNormal | ( | ) | const [inline] |
| virtual double decDCollisionTriangle::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.
| void decDCollisionTriangle::SetCorners | ( | const decDVector & | corner1, |
| const decDVector & | corner2, | ||
| const decDVector & | corner3, | ||
| const decDVector & | normal | ||
| ) |
Sets the corners of the triangle and calculates the distance.
Here you can set the normal yourself. Do not use this function anymore as it is depracted and will be removed soon.
| void decDCollisionTriangle::SetCorners | ( | const decDVector & | corner1, |
| const decDVector & | corner2, | ||
| const decDVector & | corner3 | ||
| ) |
Sets the corners of the triangle and calculates the normal and distance.
| bool decDCollisionTriangle::SphereHitsTriangle | ( | decDCollisionSphere * | sphere ) |
Determines if the given sphere hits this triangle.
| virtual bool decDCollisionTriangle::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 decDCollisionTriangle::SphereMoveHitsTriangle | ( | decDCollisionSphere * | sphere, |
| const decDVector & | displacement, | ||
| decDVector * | normal | ||
| ) |
Determines the distance of the given sphere to move until colliding with this triangle.
| virtual double decDCollisionTriangle::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.
| bool decDCollisionTriangle::TriangleHitsTriangle | ( | decDCollisionTriangle * | triangle ) |
Determines if the given triangle hits this triangle.
| virtual bool decDCollisionTriangle::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.
| double decDCollisionTriangle::TriangleMoveHitsTriangle | ( | decDCollisionTriangle * | triangle, |
| const decDVector & | displacement, | ||
| decDVector * | normal | ||
| ) |
Determines the distance of the given triangle to move until colliding with this triangle.
| virtual double decDCollisionTriangle::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 decDCollisionTriangle::Visit | ( | decDCollisionVolumeVisitor * | visitor ) | [virtual] |
Visits the collision volume.
Implements decDCollisionVolume.
| virtual bool decDCollisionTriangle::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 decDCollisionTriangle::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