Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

CollisionModel3D Class Reference

#include <coldet.h>

Inheritance diagram for CollisionModel3D:

CollisionModel3DImpl List of all members.

Public Methods

virtual ~CollisionModel3D ()
virtual void setTriangleNumber (int num) = 0
virtual void addTriangle (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) = 0
virtual void addTriangle (float v1[3], float v2[3], float v3[3]) = 0
virtual void finalize () = 0
virtual void setTransform (float m[16]) = 0
virtual bool collision (CollisionModel3D* other, int AccuracyDepth=-1, int MaxProcessingTime=0, float* other_transform=0) = 0
virtual bool rayCollision (float origin[3], float direction[3], bool closest=false, float segmin=0.0f, float segmax=3.4e+38F) = 0
virtual bool sphereCollision (float origin[3], float radius) = 0
virtual bool getCollidingTriangles (float t1[9], float t2[9], bool ModelSpace=true) = 0
virtual bool getCollidingTriangles (int& t1, int& t2) = 0
virtual bool getCollisionPoint (float p[3], bool ModelSpace=true) = 0

Detailed Description

Collision Model. Will represent the mesh to be tested for collisions. It has to be notified of all triangles, via addTriangle() After all triangles are added, a call to finalize() will process the information and prepare for collision tests. Call collision() to check for a collision

Note: Transformations must not contain scaling.


Constructor & Destructor Documentation

CollisionModel3D::~CollisionModel3D ( ) [inline, virtual]
 


Member Function Documentation

virtual void CollisionModel3D::addTriangle ( float v1[3],
float v2[3],
float v3[3] ) [pure virtual]
 

Reimplemented in CollisionModel3DImpl.

void CollisionModel3D::addTriangle ( float x1,
float y1,
float z1,
float x2,
float y2,
float z2,
float x3,
float y3,
float z3 ) [pure virtual]
 

Use any of the forms of this functions to enter the coordinates of the model's triangles.

Reimplemented in CollisionModel3DImpl.

bool CollisionModel3D::collision ( CollisionModel3D * other,
int AccuracyDepth = -1,
int MaxProcessingTime = 0,
float * other_transform = 0 ) [pure virtual]
 

Check for collision with another model. Do not mix model types here.

MaxProcessingTime determines the maximum time in milliseconds to check for collision. If a rejection is not found by that time, the function will return true.

AccuracyDepth is not yet supported.

other_transform allows overriding the other model's transform, by supplying an alternative one. This can be useful when testing a model against itself with different orientations.

Reimplemented in CollisionModel3DImpl.

void CollisionModel3D::finalize ( ) [pure virtual]
 

All triangles have been added, process model.

Reimplemented in CollisionModel3DImpl.

bool CollisionModel3D::getCollidingTriangles ( int & t1,
int & t2 ) [pure virtual]
 

Retrieve the pair of triangles indices that collided. Only valid after a call to collision() that returned true. t1 belongs to _this_ model, while t2 is in the other one.

Reimplemented in CollisionModel3DImpl.

bool CollisionModel3D::getCollidingTriangles ( float t1[9],
float t2[9],
bool ModelSpace = true ) [pure virtual]
 

Retrieve the pair of triangles that collided. Only valid after a call to collision() that returned true. t1 is this model's triangle and t2 is the other one. In case of ray or sphere collision, only t1 will be valid. The coordinates will be in _this_ model's coordinate space, unless ModelSpace is false, in which case, coordinates will be transformed by the model's current transform to world space.

Reimplemented in CollisionModel3DImpl.

bool CollisionModel3D::getCollisionPoint ( float p[3],
bool ModelSpace = true ) [pure virtual]
 

Retrieve the detected collision point. Only valid after a call to collision() that returned true. The coordinates will be in _this_ model's coordinate space, unless ModelSpace is false, in which case, coordinates will be transformed by the model's current transform to world space.

Reimplemented in CollisionModel3DImpl.

bool CollisionModel3D::rayCollision ( float origin[3],
float direction[3],
bool closest = false,
float segmin = 0.0f,
float segmax = 3.4e+38F ) [pure virtual]
 

Returns true if the ray given in world space coordinates intersects with the object. getCollidingTriangles() and getCollisionPoint() can be used to retrieve information about a collision. If closest if false, the first triangle that collides with the ray is used. Otherwise the closest one will be used. Closest triangle searching will slow the test considerably. The default ray is a standard infinite ray. However, using segmin and segmax you can define a line segment along the ray.

Reimplemented in CollisionModel3DImpl.

void CollisionModel3D::setTransform ( float m[16] ) [pure virtual]
 

The the current affine matrix for the model. See transform.txt for format information

Reimplemented in CollisionModel3DImpl.

void CollisionModel3D::setTriangleNumber ( int num ) [pure virtual]
 

Optional: Optimization for construction speed. If you know the number of triangles.

Reimplemented in CollisionModel3DImpl.

bool CollisionModel3D::sphereCollision ( float origin[3],
float radius ) [pure virtual]
 

Returns true if the given sphere collides with the model. getCollidingTriangles() and getCollisionPoint() can be used to retrieve information about a collision.

Reimplemented in CollisionModel3DImpl.


The documentation for this class was generated from the following file:
Generated at Sat Nov 18 00:15:14 2000 for coldet by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000