Voxelyze
Public Member Functions | Static Public Attributes
CVX_Collision Class Reference

Defines a potential collision between two voxels. More...

#include <VX_Collision.h>

List of all members.

Public Member Functions

 CVX_Collision (CVX_Voxel *v1, CVX_Voxel *v2)
 Constructor taking the two voxels to watch for collision between. The order is irrelevant.
CVX_Collisionoperator= (const CVX_Collision &col)
 Overload "=" operator.
 CVX_Collision (const CVX_Collision &col)
 copy constructor.
Vec3D< float > const contactForce (CVX_Voxel *pVoxel)
 Returns the repelling force acting on pVoxel from the penetration of the other voxel if their collision boundaries overlap. Otherwise returns a zero force. This force will only be accurate if updateContactForce() has been called since the voxels last moved.
void updateContactForce ()
 Updates the state this collision based on the current positions and properties of voxel1() and voxel2(). Call contactForce() with either voxel as the argument to obtain the repelling penetration force (if any) that exisits.
CVX_Voxelvoxel1 () const
 One voxel of this potential collision pair.
CVX_Voxelvoxel2 () const
 The other voxel of this potential collision pair.

Static Public Attributes

static float envelopeRadius = 0.625f
 The collision envelope radius that these two voxels collide at. Even though voxels are cubic, a spherical collision envelope is used for computation efficiency. Values are multiplied by the length of an edge of the voxel to determine the actual collision radius. Values less than 0.5 or greater than 0.866 are probably of limited use. Prefer around 0.625 (default).

Detailed Description

Defines a potential collision between two voxels.

A CVX_Collision object is created for two voxels (presumably in close proximity) that are likely to self-intersect. If they don't intersect, no force is present. Otherwise, an appropriate repelling force is calculated here.

Voxels are assumed to have spherical collision boundaries with a radius of CVX_Collision::envelopeRadius * voxel edge dimension. This radius should be slightly larger than 0.5 to prevent voxels from penetrating too far between other voxels.

updateContactForce() is called to calculate the repelling force. This force is retreived by calling contactForce() with an appropriate voxel pointer to return the force (in the global coordinate system) acting on that voxel as a result of this (potential) collision.


Constructor & Destructor Documentation

Constructor taking the two voxels to watch for collision between. The order is irrelevant.

Parameters:
[in]v1One voxel
[in]v2The other voxel

Member Function Documentation

Vec3D< float > const CVX_Collision::contactForce ( CVX_Voxel pVoxel)

Returns the repelling force acting on pVoxel from the penetration of the other voxel if their collision boundaries overlap. Otherwise returns a zero force. This force will only be accurate if updateContactForce() has been called since the voxels last moved.

Parameters:
[in]pVoxelThe voxel in question. This should be voxel1() or voxel2() to have any meaning. Otherwise a zero force is returned.

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Enumerator Friends