#include "MePrecision.h"
#include <stddef.h>
Go to the source code of this file.
Compounds | |
| struct | McdContact |
| struct | McdIntersectResult |
| struct | McdLineSegIntersectResult |
| struct | McdModelPair |
| struct | McdModelPairArray |
| struct | McdSpaceGoodbyePairIterator |
| struct | McdSpaceHelloPairIterator |
| struct | McdSpacePairIterator |
| struct | McdSpaceStayingPairIterator |
Typedefs | |
| typedef MeReal | McdReal |
| type used for reals in the Mcd API. | |
| typedef short | McdBool |
| \internal. | |
| typedef void (* | McdMessageHandler )(const char *msg) |
| typedef struct _McdGeometry | McdGeometry |
| Abstract "base class" for geometrical types. More... | |
| typedef McdGeometry* | McdGeometryID |
| References to MathEngine objects are made using "ID" tokens instead of explicit pointers. | |
| typedef struct _McdModel | McdModel |
| An McdModel represents a collision model whose geometrical shape is specified by a concrete McdGeometry type. More... | |
| typedef McdModel* | McdModelID |
| References to MathEngine objects are made using "ID" tokens instead of explicit pointers. | |
| typedef struct _McdSpace | McdSpace |
| McdSpace keeps track of where collision models are in 3D space. More... | |
| typedef McdSpace* | McdSpaceID |
| References to MathEngine objects are made using "ID" tokens instead of explicit pointers. | |
Functions | |
| McdMessageHandler | McdSetFatalErrorHandler (McdMessageHandler) |
| Set the function that is called upon a fatal error. More... | |
| McdMessageHandler | McdSetWarningHandler (McdMessageHandler) |
| Set the function that is called upon a warning. | |
| McdMessageHandler | McdSetInfoHandler (McdMessageHandler) |
| Set the function that is called for an informational message. | |
| void | McdInit ( int geoTypeMaxCount ) |
| Initializes framework (performs allocation of tables). | |
| void | McdTerm () |
| Shuts down framework, cleans up all memory allocation, including registered geometry's data pools. | |
| int | McdGeometryGetTypeID ( McdGeometryID g ) |
| Returns geometry's shape-unique ID. | |
| void | McdGeometryDestroy ( McdGeometryID g ) |
| Frees memory associated with the geometry. | |
| int | McdGeometryGetMassProperties ( McdGeometryID g, MeMatrix4 relativeTransform, MeMatrix3 inertiaMatrix, MeReal *volume ) |
| Computes g 's inertia matrix, writing the result into m. More... | |
| void | McdModelPoolSetSize ( int size ) |
| void | McdModelPoolSetIncrement ( int increment ) |
| Sets the increment limit for the Models pool. More... | |
| McdModelID | McdModelCreateEmpty () |
| Creates a collision model with no geometry. More... | |
| McdModelID | McdModelCreate ( McdGeometryID g ) |
| Creates a collision model with specified geometry. | |
| void | McdModelSetGeometry ( McdModelID cm, McdGeometryID g ) |
| Re-sets a model's geometry to a new one. More... | |
| McdGeometryID | McdModelGetGeometry ( McdModelID g ) |
| Returns a model's geometry. | |
| int | McdModelGetGeometryTypeID ( McdModelID g ) |
| Returns the type ID of the geometry associated with the model. | |
| void | McdModelDestroy ( McdModelID cm ) |
| Returns models memory to the pool. | |
| unsigned int | McdModelRemoveFromSpace ( McdModelID cm ) |
| Takes model out of its space. More... | |
| void | McdUpdateModelInSpace ( McdModelID cm ) |
| Computes overlaps with this model in its space. | |
| unsigned int | McdModelFreezeInSpace ( McdModelID cm ) |
| Inform the system that cm 's transform will not change value. More... | |
| unsigned int | McdModelUnfreezeInSpace ( McdModelID cm ) |
| Inform the system that cm 's transform may change. More... | |
| unsigned int | McdModelIsFrozenInSpace ( McdModelID cm ) |
| Returns cm 's "frozen" status. More... | |
| void | McdModelSetResponseID ( McdModelID cm, int reponseID ) |
| int | McdModelGetResponseID ( McdModelID cm ) |
| void | McdModelSetContactTolerance ( McdModelID cm , McdReal tol ) |
| Sets the contact tolerance used for geometric intersection tests. | |
| McdReal | McdModelGetContactTolerance ( McdModelID cm ) |
| Returns the contact tolerance used for geometric intersection tests. | |
| void | McdModelGetBSphere ( McdModelID cm, MeVector3 center, McdReal *radius ) |
| Returns the bounding sphere which contains the model's geometry. | |
| void | McdModelGetAABB ( McdModelID cm, MeVector3 minCorner, MeVector3 maxCorner ) |
| Returns the axis-aligned bounding box which contains the model's geometry. | |
| void | McdModelSetTransformPtr ( McdModelID cm, MeMatrix4 geometryTM ) |
| Sets the geometry's 4X4 transformation matrix. More... | |
| MeMatrix4* | McdModelGetTransformPtr ( McdModelID cm ) |
| Returns the pointer to the geometry's 4X4 transformation matrix. More... | |
| void | McdModelSetUserData ( McdModelID cm, void *data ) |
| Sets the user data to be attached to the model. | |
| void* | McdModelGetUserData ( McdModelID cm ) |
| Gets the user data attached to the model. | |
| unsigned int | McdModelSetInteractionEnabled ( McdModelID cm1, McdModelID cm2 ) |
| Allows collision interaction between two models (this is the default). | |
| unsigned int | McdModelSetInteractionDisabled ( McdModelID cm1, McdModelID cm2 ) |
| Turns off collision interaction between two models. | |
| unsigned int | McdModelInteractionIsEnabled ( McdModelID cm1, McdModelID cm2 ) |
| Returns TRUE if interaction is enabled, else FALSE. | |
| void | McdModelPairInit ( McdModelPair *mcdPair, McdModelID model1, McdModelID model2) |
| Prepare an McdModelPair for use with McdIntersectHello. More... | |
| void | McdModelPairTerm ( McdModelPair *mcdPair ) |
| Stop using this pair. More... | |
| void | McdModelPairSetUserData ( McdModelPair *mcdPair, void *userData ) |
| void* | McdModelPairGetUserData ( McdModelPair *mcdPair ) |
| void | McdModelPairSetResponseData ( McdModelPair *mcdPair, void *responseData ) |
| void* | McdModelPairGetResponseData ( McdModelPair *mcdPair ) |
| void | McdModelPairArrayReset ( McdModelPairArray* ) |
| int | McdContactSimplify ( McdReal* avgNormal, McdContact* contacts_src, int nContacts_src, McdContact* contacts_dst, int nContacts_dest ) |
| Utility function for reducing a list of contacts to a smaller list. More... | |
| int | McdIntersectHello ( McdModelPair* ) |
| Prepares pair for collision. More... | |
| int | McdIntersect ( McdModelPair*, McdIntersectResult* ) |
| Performs appropriate collision test on input pair. More... | |
| int | McdIntersectGoodbye ( McdModelPair* ) |
| Informs the system that collisions will no longer be attempted for this pair, such as for examples when pairs are far apart. More... | |
| unsigned int | McdLineSegIntersect ( McdModelID cm, McdReal* inOrig, McdReal* inDest, McdLineSegIntersectResult *outOverlap) |
| Intersect a linesegment with a collision model. More... | |
| McdSpaceID | McdSpaceAxisSortCreate ( int axes, int objectCount, int pairCount ) |
| Creates a space whose models are sorted by x, y, and z axes. More... | |
| void | McdSpaceDestroy ( McdSpaceID s ) |
| Deletes a McdSpace object - performs memory deallocation. | |
| void | McdSpaceBuild ( McdSpaceID s ) |
| Sets up space internal data structures, to be used after all models have been inserted. | |
| void | McdSpaceUpdate ( McdSpaceID s ) |
| Updates new/current/old nearby pair lists. | |
| unsigned int | McdSpaceInsertModel ( McdSpaceID s, McdModelID cm ) |
| Adds a collision model into the space. More... | |
| void | McdSpaceSetUserData ( McdSpaceID s, void *data ) |
| Set user void* attached to space. | |
| void* | McdSpaceGetUserData ( McdSpaceID s ) |
| Get user void* attached to space. | |
| int | McdSpaceGetLineSegIntersections ( McdSpaceID space, McdReal* inOrig, McdReal* inDest, McdLineSegIntersectResult *outList, int inMaxListSize) |
| Intersects an oriented line segment with all models in the space. More... | |
| void | McdSpaceHelloPairIteratorInit ( McdSpaceID, McdSpaceHelloPairIterator* ) |
| Get an iterator for the "hello" pairs. More... | |
| void | McdSpaceStayingPairIteratorInit ( McdSpaceID, McdSpaceStayingPairIterator* ) |
| Get an iterator for the "staying" pairs. More... | |
| void | McdSpaceGoodbyePairIteratorInit ( McdSpaceID, McdSpaceGoodbyePairIterator* ) |
| Get an iterator for the "goodbye" pairs. More... | |
| int | McdSpaceGetHelloPairs ( McdSpaceID, McdSpaceHelloPairIterator*, McdModelPair**, int pairMaxCount ) |
| Get the "hello" pairs from s. More... | |
| int | McdSpaceGetStayingPairs ( McdSpaceID, McdSpaceStayingPairIterator*, McdModelPair**, int pairMaxCount ) |
| Get the "staying" pairs from s. More... | |
| int | McdSpaceGetGoodbyePairs ( McdSpaceID, McdSpaceGoodbyePairIterator*, McdModelPair**, int pairMaxCount ) |
| Get the "goodbye" pairs from s. More... | |
| void | McdSpacePairIteratorInit ( McdSpaceID, McdSpacePairIterator* ) |
| McdBool | McdSpaceGetPairs ( McdSpaceID, McdSpacePairIterator*, McdModelPairArray* ) |
| void | McdPairHandlerDataPoolSetSize ( int size ) |
| void | McdPairHandlerDataPoolSetIncrement ( int increment ) |
| Sets the increment for the pool of pair data - default is 100. More... | |
| void | McdPairHandlerSetSpaceMaxCount ( int count ) |
| Sets the number of spaces that can be registered with the pair handler. More... | |
| int | McdPairHandlerGetNewResponseID ( ) |
| int | McdPairHandlerGetDefaultResponseID ( ) |
| void | McdPairHandlerSetResponseIDMaxCount ( int count ) |
| int | McdPairHandlerGetResponseIDMaxCount ( ) |
| void | McdPairHandlerRegisterSpace ( McdSpaceID s ) |
| Puts a space into the pair handler's list. | |
| void | McdPairHandlerUnregisterSpace ( McdSpaceID s ) |
| Takes a space out of the pair handler's list. | |
| void | McdPairHandlerUpdate ( ) |
| Registered spaces are updated, and overlap status of pairs in all spaces is sent to various response modules. | |
| void | McdIntersectSetContactBufferSize ( int count ) |
| Sets the maximum number of contact points to be considered between a colliding pair. More... | |
| int | McdIntersectGetContactBufferSize ( ) |
| Gets the maximum number of contact points to be considered between a colliding pair. More... | |
| int | McdIntersectGetNewRequestID () |
| The request IDs of two models determines the collision request. More... | |
| int | McdIntersectGetDefaultRequestID () |
| Returns the default request ID given to all models upon their creation. | |
| void | McdIntersectSetRequestID ( McdModelID cm, int requestID ) |
| Sets the Request group id for a model. More... | |
| int | McdIntersectGetRequestID ( McdModelID cm ) |
| Returns the Request group id for a model. More... | |
| void | McdIntersectSetRequestIDMaxCount ( int count ) |
| Increases the maximum number of request IDs. More... | |
| int | McdIntersectGetRequestIDMaxCount ( ) |
| Returns the maximum number of request IDs. | |
| void | McdIntersectRequestSetContactMaxCount ( int requestID1, int requestID2, int count ) |
| Sets the maximum number of contacts allowed per model pair. More... | |
| int | McdIntersectRequestGetContactMaxCount ( int requestID1, int requestID2 ) |
| Gets the maximum number of contacts allowed per model pair. More... | |
| void | McdIntersectSetFaceNormalsFirst ( int requestID1, int requestID2, unsigned int faceNormalsFirst ) |
| By setting this request to TRUE, contacts generated from face normals are returned first in the contact list. More... | |
| unsigned int | McdIntersectGetFaceNormalsFirst ( int requestID1, int requestID2 ) |
| Returns value set in McdIntersectSetFaceNormalsFirst(). More... | |
Variables | |
| int | McdXAxis = X_axis |
| X-axis to be or'ed with McdYAxis and McdZAxis. | |
| int | McdYAxis = Y_axis |
| Y-axis to be or'ed with McdXAxis and McdZAxis. | |
| int | McdZAxis = Z_axis |
| Z-axis to be or'ed with McdXAxis and McdYAxis. | |
| int | McdAllAxes = All_axes |
| A constant equal to McdXAxis+McdYAxis+McdZAxis. | |
|
Abstract "base class" for geometrical types.
All concrete geometrical types share a common set of functionality defined by the McdGeometry interface.
|
For internal use only.
|
An McdModel represents a collision model whose geometrical shape is specified by a concrete McdGeometry type.
Collision models are the principal type of object in the system, for which bounding volume, culling and intersections queries are available.
|
|
Utility function for reducing a list of contacts to a smaller list.
Approximate average normal of the input contacts needed and can be obtained from McdIntersectResult.normal Returns actual number of contacts that were produced.
|
Computes g 's inertia matrix, writing the result into m.
The inertia matrix is computed relative to relTM, whose translational component always holds the position of the center of mass, and whose orientation is either an identity matrix or an orientation with respect to which m is diagonal. A return value of zero indicates that relTM is diagonal, in which case m has been calculated with respect to the original local coordinate system of g.
|
Performs appropriate collision test on input pair.
All data returned in McdIntersectResult "result." The return value is 1 if the proper collision function was available, 0 otherwise. This function can be used in conjunction with the McdSpaceGetNewPairs call. McdIntersectHello needs to be called on this pair before calling this function.
|
Gets the maximum number of contact points to be considered between a colliding pair.
|
|
The request IDs of two models determines the collision request.
At present, the only request is the maximum # of contacts per overlap- ping pair.
|
Returns the Request group id for a model.
A request id may be used to represent a behavioural aspect of the object which impacts the type of contact info to be returned from a collision query. For example two objects which are known to be fast moving may only require a single contact point to be computed when they collide.
|
Informs the system that collisions will no longer be attempted for this pair, such as for examples when pairs are far apart.
Frees up any internal data associated with this pair if applicable. This can be used in conjunction with the McdSpaceGetOldPairs call. McdIntersect should no longer be called on a pair on which McdIntersectGoodbye has been called.
|
Prepares pair for collision.
For some pairs this means allocating data that is persistent across McdIntersect invocations while the pair is nearby, for efficiency. This can be used in conjunction with the McdSpaceGetNewPairs call. McdModelPairInit must be called on the pair before this function is called. Must be called before McdIntersect.
|
Gets the maximum number of contacts allowed per model pair.
|
Sets the maximum number of contacts allowed per model pair.
Tries to maximize the area of the contact "footprint." Default is 4.
|
Sets the maximum number of contact points to be considered between a colliding pair.
Allocates memory - unaffected by McdPoolsFreeze().
|
By setting this request to TRUE, contacts generated from face normals are returned first in the contact list.
Default is FALSE.
|
Sets the Request group id for a model.
A request id may be used to represent a behavioural aspect of the object which impacts the type of contact info to be returned from a collision query. For example two objects which are known to be fast moving may only require a single contact point to be computed when they collide.
|
Increases the maximum number of request IDs.
Allocates memory - unaffected by McdPoolsFreeze().
|
Intersect a linesegment with a collision model.
|
Creates a collision model with no geometry.
The geometry must be set later.
|
Inform the system that cm 's transform will not change value.
Changes cm 's status from "unfrozen" to "frozen". cm remains in the "frozen" status until McdUnfreezeInSpace is called. McdModel objects are by default in "unfrozen" status.
This information is used for optimisation opportunities by the McdSpace object in which cm is currently active. Nearby pairs for which both McdModel's are frozen will be ignored by McdSpace, and will not appear in its nearby pair list. The "frozen" status is also used for optimisation opportunities by the McdDtBridge component.
|
For internal use only.
|
Returns the pointer to the geometry's 4X4 transformation matrix.
This transform determines the global coordinates of the model's geometry, which is specified locally.
If cm has been used in McdDtBridgeSetBody(..), then its transform pointer will be pointed to the MdtBody's transform.
The returned address is intended for reading only, not writing. The validity of the return value is guaranteed only during the current time step.
|
Returns cm 's "frozen" status.
|
For internal use only.
|
For internal use only.
|
For internal use only.
|
Prepare an McdModelPair for use with McdIntersectHello.
Must be called before a pair is passed to McdIntersectHello, unless it has been obtained from one of the McdSpaceGetNewPairs, McdSpaceGetStayingPairs or McdSpaceGetOldPairs functions.
|
For internal use only.
|
For internal use only.
|
Stop using this pair.
Must be called before McdModelPairInit if this pair is to be reused for another pair of models, for example.
|
Sets the increment limit for the Models pool.
This pool is frozen by McdPoolsFreeze().
|
For internal use only.
|
Takes model out of its space.
|
Re-sets a model's geometry to a new one.
This might allocate memory if the geometry needs precomputation for collision optimization.
|
For internal use only.
|
Sets the geometry's 4X4 transformation matrix.
User must allocate his/her own transform for model's geometry, and pass a pointer in with this function. This transform determines the global coordinates of the model's geometry, which is specified locally.
If cm has been used in McdDtBridgeSetBody(..), then its transform pointer will be pointed to the MdtBody's transform. If McdModelSetTransformPtr() is called after this point, a warning will be issued.
|
Inform the system that cm 's transform may change.
Changes cm 's status from "frozen" to "unfrozen". Reverses the effects described in McdModelFreezeInSpace.
|
Sets the increment for the pool of pair data - default is 100.
The pair handler holds a pool of pair data for all pairs potentially intersecting in all spaces.
|
For internal use only.
|
For internal use only.
|
For internal use only.
|
For internal use only.
|
For internal use only.
|
Sets the number of spaces that can be registered with the pair handler.
Allocates memory - unaffected by McdPoolsFreeze().
|
Set the function that is called upon a fatal error.
Using the collision system after f is called will likely yield unexpected results.
|
Creates a space whose models are sorted by x, y, and z axes.
Spaces hold collision models. The Axis-sorted space created with this command is efficient at determining when pairs of models are nearby.
|
Get the "goodbye" pairs from s.
The "goodbye" pairs are those pairs of McdModel's that McdSpace had identified as in close proximity after the previous call to McdSpaceUpdate(), but are no longer in close proximity after the current call to McdSpaceUpdate().
The user allocates the pairs array and specifies its length in pairMaxCount. iter is a valid iterator obtained from McdSpaceGetGoodbyePairIterator(). The return value indicates how many pairs were actually written into pairs array. If the return value is equal to pairMaxCount, then there may be an overflow condition. In this case, the function must be called again with the same @iter argument, in order to get any remaining pairs.
|
Get the "hello" pairs from s.
The "hello" pairs are those pairs of McdModel's that McdSpace identifies as in close proximity to each other, but which where not in close proximity after the previous call to McdSpaceUpdate().
The user allocates the pairs array and specifies its length in pairMaxCount. iter is a valid iterator obtained from McdSpaceGetHelloPairIterator(). The return value indicates how many pairs were actually written into pairs array. If the return value is equal to pairMaxCount, then there may be an overflow condition. In this case, the function must be called again with the same iter argument, in order to get any remaining pairs.
|
Intersects an oriented line segment with all models in the space.
|
For internal use only.
|
Get the "staying" pairs from s.
The "staying" pairs are those pairs of McdModel's that McdSpace identifies as in close proximity to each other, and were also in close proximity after the previous call to McdSpaceUpdate(). For use in McdSpaceGetStayingPairs().
The user allocates the pairs array and specifies its length in pairMaxCount. iter is a valid iterator obtained from McdSpaceGetStayingPairIterator(). The return value indicates how many pairs were actually written into pairs array. If the return value is equal to pairMaxCount, then there may be an overflow condition. In this case, the function must be called again with the same @iter argument, in order to get any remaining pairs.
|
Get an iterator for the "goodbye" pairs.
The "goodbye" pairs are those pairs of McdModel's that McdSpace had identified as in close proximity after the previous call to McdSpaceUpdate(), but are no longer in close proximity after the current call to McdSpaceUpdate(). For use in McdSpaceGetGoodbyePairs().
|
Get an iterator for the "hello" pairs.
The "hello" pairs are those pairs of McdModel's that McdSpace identifies as in close proximity to each other, but which were not in close proximity after the previous call to McdSpaceUpdate(). For use in McdSpaceGetHelloPairs().
|
Adds a collision model into the space.
|
For internal use only.
|
Get an iterator for the "staying" pairs.
The "staying" pairs are those pairs of McdModel's that McdSpace identifies as in close proximity to each other, and were also in close proximity after the previous call to McdSpaceUpdate(). For use in McdSpaceGetStayingPairs().
Copyright MathEngine PLC 2000, all rights reserved.