decCollisionTriangle Class Reference

Triangle collision volume. More...

#include <decCollisionTriangle.h>

Inheritance diagram for decCollisionTriangle:
decCollisionVolume

List of all members.

Public Member Functions

Constructors and Destructors
 decCollisionTriangle ()
 Creates a new collision triangle with all points 0.
 decCollisionTriangle (const decVector &corner1, const decVector &corner2, const decVector &corner3)
 Creates a new collision triangle from the given parameters.
 decCollisionTriangle (const decVector &corner1, const decVector &corner2, const decVector &corner3, const decVector &normal)
 Creates a new collision triangle from the given parameters.
virtual ~decCollisionTriangle ()
 Cleans up the collision triangle.
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.
Visiting
virtual void Visit (decCollisionVolumeVisitor *visitor)
 Visits the collision volume.
Collision Routines
bool SphereHitsTriangle (decCollisionSphere *sphere)
 Determines if the given sphere hits this triangle.
bool CylinderHitsTriangle (decCollisionCylinder *cylinder)
 Determines if the given cylinder hits this triangle.
bool CapsuleHitsTriangle (decCollisionCapsule *capsule)
 Determines if the given capsule hits this triangle.
bool BoxHitsTriangle (decCollisionBox *box)
 Determines if the given box hits this triangle.
bool TriangleHitsTriangle (decCollisionTriangle *triangle)
 Determines if the given triangle hits this triangle.
float SphereMoveHitsTriangle (decCollisionSphere *sphere, const decVector &displacement, decVector *normal)
 Determines the distance of the given sphere to move until colliding with this triangle.
float CylinderMoveHitsTriangle (decCollisionCylinder *cylinder, const decVector &displacement, decVector *normal)
 Determines the distance of the given cylinder to move until colliding with this triangle.
float CapsuleMoveHitsTriangle (decCollisionCapsule *capsule, const decVector &displacement, decVector *normal)
 Determines the distance of the given capsule to move until colliding with this triangle.
float BoxMoveHitsTriangle (decCollisionBox *box, const decVector &displacement, decVector *normal)
 Determines the distance of the given box to move until colliding with this triangle.
float TriangleMoveHitsTriangle (decCollisionTriangle *triangle, const decVector &displacement, decVector *normal)
 Determines the distance of the given triangle to move until colliding with this triangle.
Management
const decVectorGetCorner1 () const
const decVectorGetCorner2 () const
const decVectorGetCorner3 () const
const decVectorGetNormal () const
float GetDistance () const
 Retrieves the precalculated distance value.
void SetCorners (const decVector &corner1, const decVector &corner2, const decVector &corner3)
 Sets the corners of the triangle and calculates the normal and distance.
void SetCorners (const decVector &corner1, const decVector &corner2, const decVector &corner3, const decVector &normal)
 Sets the corners of the triangle and calculates the distance.

Detailed Description

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.

Author:
Plüss Roland
Version:
1.0
Date:
2008
Warning:
This class is partially implemented. See the collision functions for more informations.
Todo:
  • Implementing CylinderHitsTriangle
  • Implementing TriangleHitsTriangle

Constructor & Destructor Documentation

decCollisionTriangle::decCollisionTriangle (  )

Creates a new collision triangle with all points 0.

decCollisionTriangle::decCollisionTriangle ( const decVector corner1,
const decVector corner2,
const decVector corner3 
)

Creates a new collision triangle from the given parameters.

decCollisionTriangle::decCollisionTriangle ( const decVector corner1,
const decVector corner2,
const decVector corner3,
const decVector 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 decCollisionTriangle::~decCollisionTriangle (  ) [virtual]

Cleans up the collision triangle.


Member Function Documentation

bool decCollisionTriangle::BoxHitsTriangle ( decCollisionBox box )

Determines if the given box hits this triangle.

virtual bool decCollisionTriangle::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.

float decCollisionTriangle::BoxMoveHitsTriangle ( decCollisionBox box,
const decVector displacement,
decVector normal 
)

Determines the distance of the given box to move until colliding with this triangle.

virtual float decCollisionTriangle::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.

bool decCollisionTriangle::CapsuleHitsTriangle ( decCollisionCapsule capsule )

Determines if the given capsule hits this triangle.

Warning:
Not implemented yet and returns always false.
virtual bool decCollisionTriangle::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.

float decCollisionTriangle::CapsuleMoveHitsTriangle ( decCollisionCapsule capsule,
const decVector displacement,
decVector normal 
)

Determines the distance of the given capsule to move until colliding with this triangle.

Warning:
Function is not implemented yet and always returns 1.
virtual float decCollisionTriangle::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.

virtual decVector decCollisionTriangle::ClosestPointTo ( const decVector point ) [virtual]

Retrieves the closest point on the volume.

Implements decCollisionVolume.

bool decCollisionTriangle::CylinderHitsTriangle ( decCollisionCylinder cylinder )

Determines if the given cylinder hits this triangle.

Warning:
Not implemented yet and returns always false.
virtual bool decCollisionTriangle::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.

float decCollisionTriangle::CylinderMoveHitsTriangle ( decCollisionCylinder cylinder,
const decVector displacement,
decVector normal 
)

Determines the distance of the given cylinder to move until colliding with this triangle.

Warning:
Function is not implemented yet and always returns 1.
virtual float decCollisionTriangle::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 decCollisionTriangle::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 decCollisionTriangle::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& decCollisionTriangle::GetCorner1 (  ) const [inline]
const decVector& decCollisionTriangle::GetCorner2 (  ) const [inline]
const decVector& decCollisionTriangle::GetCorner3 (  ) const [inline]
float decCollisionTriangle::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 decCollisionTriangle::GetEnclosingBox ( decCollisionBox box ) [virtual]

Retrieves the box volume best enclosing this volume.

Implements decCollisionVolume.

virtual void decCollisionTriangle::GetEnclosingSphere ( decCollisionSphere sphere ) [virtual]

Retrieves the sphere volume best enclosing this volume.

Implements decCollisionVolume.

const decVector& decCollisionTriangle::GetNormal (  ) const [inline]
virtual float decCollisionTriangle::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.

void decCollisionTriangle::SetCorners ( const decVector corner1,
const decVector corner2,
const decVector corner3,
const decVector 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 decCollisionTriangle::SetCorners ( const decVector corner1,
const decVector corner2,
const decVector corner3 
)

Sets the corners of the triangle and calculates the normal and distance.

bool decCollisionTriangle::SphereHitsTriangle ( decCollisionSphere sphere )

Determines if the given sphere hits this triangle.

virtual bool decCollisionTriangle::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 decCollisionTriangle::SphereMoveHitsTriangle ( decCollisionSphere sphere,
const decVector displacement,
decVector normal 
)

Determines the distance of the given sphere to move until colliding with this triangle.

virtual float decCollisionTriangle::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.

bool decCollisionTriangle::TriangleHitsTriangle ( decCollisionTriangle triangle )

Determines if the given triangle hits this triangle.

Warning:
Not implemented yet and returns always false.
virtual bool decCollisionTriangle::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.

float decCollisionTriangle::TriangleMoveHitsTriangle ( decCollisionTriangle triangle,
const decVector displacement,
decVector normal 
)

Determines the distance of the given triangle to move until colliding with this triangle.

Warning:
Function is not implemented yet and always returns 1.
virtual float decCollisionTriangle::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 decCollisionTriangle::Visit ( decCollisionVolumeVisitor visitor ) [virtual]

Visits the collision volume.

Implements decCollisionVolume.

virtual bool decCollisionTriangle::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 decCollisionTriangle::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.


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