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

CollisionModel3DImpl Class Reference

#include <coldetimpl.h>

Inheritance diagram for CollisionModel3DImpl:

CollisionModel3D List of all members.

Public Types

enum  { Models, Ray, Sphere }

Public Methods

 CollisionModel3DImpl (bool Static)
void setTriangleNumber (int num)
void addTriangle (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
void addTriangle (float v1[3], float v2[3], float v3[3])
void addTriangle (const Vector3D& v1, const Vector3D& v2, const Vector3D& v3)
void finalize ()
void setTransform (float m[16])
void setTransform (const Matrix3D& m)
bool collision (CollisionModel3D* other, int AccuracyDepth, int MaxProcessingTime, float* other_transform)
bool rayCollision (float origin[3], float direction[3], bool closest, float segmin, float segmax)
bool sphereCollision (float origin[3], float radius)
bool getCollidingTriangles (float t1[9], float t2[9], bool ModelSpace)
bool getCollidingTriangles (int& t1, int& t2)
bool getCollisionPoint (float p[3], bool ModelSpace)
int getTriangleIndex (BoxedTriangle* bt)

Public Attributes

std::vector<BoxedTrianglem_Triangles
BoxTreeInnerNode m_Root
Matrix3D m_Transform
Matrix3D m_InvTransform
Triangle m_ColTri1
Triangle m_ColTri2
int m_iColTri1
int m_iColTri2
Vector3D m_ColPoint
enum CollisionModel3DImpl:: { ... }  m_ColType
bool m_Final
bool m_Static

Member Enumeration Documentation

anonymous enum
 

Type of the last collision test

Enumeration values:
Models  
Ray  
Sphere  


Constructor & Destructor Documentation

CollisionModel3DImpl::CollisionModel3DImpl ( bool Static )
 


Member Function Documentation

void CollisionModel3DImpl::addTriangle ( const Vector3D & v1,
const Vector3D & v2,
const Vector3D & v3 )
 

void CollisionModel3DImpl::addTriangle ( float v1[3],
float v2[3],
float v3[3] ) [inline, virtual]
 

Reimplemented from CollisionModel3D.

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

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

Reimplemented from CollisionModel3D.

bool CollisionModel3DImpl::collision ( CollisionModel3D * other,
int AccuracyDepth,
int MaxProcessingTime,
float * other_transform ) [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 from CollisionModel3D.

void CollisionModel3DImpl::finalize ( ) [virtual]
 

All triangles have been added, process model.

Reimplemented from CollisionModel3D.

bool CollisionModel3DImpl::getCollidingTriangles ( int & t1,
int & t2 ) [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 from CollisionModel3D.

bool CollisionModel3DImpl::getCollidingTriangles ( float t1[9],
float t2[9],
bool ModelSpace ) [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 from CollisionModel3D.

bool CollisionModel3DImpl::getCollisionPoint ( float p[3],
bool ModelSpace ) [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 from CollisionModel3D.

int CollisionModel3DImpl::getTriangleIndex ( BoxedTriangle * bt ) [inline]
 

bool CollisionModel3DImpl::rayCollision ( float origin[3],
float direction[3],
bool closest,
float segmin,
float segmax ) [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 from CollisionModel3D.

void CollisionModel3DImpl::setTransform ( const Matrix3D & m )
 

void CollisionModel3DImpl::setTransform ( float m[16] ) [inline, virtual]
 

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

Reimplemented from CollisionModel3D.

void CollisionModel3DImpl::setTriangleNumber ( int num ) [inline, virtual]
 

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

Reimplemented from CollisionModel3D.

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

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

Reimplemented from CollisionModel3D.


Member Data Documentation

Vector3D CollisionModel3DImpl::m_ColPoint
 

The collision point of the last test

Triangle CollisionModel3DImpl::m_ColTri1
 

The triangles that last collided

Triangle CollisionModel3DImpl::m_ColTri2
 

The triangles that last collided

enum { ... } CollisionModel3DImpl::m_ColType
 

Type of the last collision test

bool CollisionModel3DImpl::m_Final
 

Flag for indicating the model is finalized.

Matrix3D CollisionModel3DImpl::m_InvTransform
 

The current transform and its inverse

BoxTreeInnerNode CollisionModel3DImpl::m_Root
 

Root of the hierarchy tree

bool CollisionModel3DImpl::m_Static
 

Static models will maintain the same transform for a while so the inverse transform is calculated each set instead of in the collision test.

Matrix3D CollisionModel3DImpl::m_Transform
 

The current transform and its inverse

std::vector< BoxedTriangle > CollisionModel3DImpl::m_Triangles
 

Stores all the actual triangles. Other objects will use pointers into this array.

int CollisionModel3DImpl::m_iColTri1
 

The indices of the triangles that last collided

int CollisionModel3DImpl::m_iColTri2
 

The indices of the triangles that last collided


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