NewtonCollisionClosestPoint

From Newton Wiki
Jump to: navigation, search

NewtonCollisionClosestPoint

int NewtonCollisionClosestPoint (const NewtonWorld* newtonWorld, 
		const NewtonCollision* collisionA, const dFloat* matrixA, const NewtonCollision* collisionB, const dFloat* matrixB,
		dFloat* contactA, dFloat* contactB, dFloat* normalAB, int threadIndex);

Usage

Calculate the closest points between two disjoint convex collision primitive.

Parameters

  • const NewtonWorld *newtonWorld - is the pointer to the Newton world.
  • const NewtonCollision *collisionA - pointer to collision primitive A.
  • const dFloat *matrixA - pointer to the first element of an array of 16 floats containing the offset matrix of collision primitiveA.
  • const NewtonCollision *collisionB - pointer to collision primitive B.
  • const dFloat *matrixB - pointer to the first element of an array of 16 floats containing the offset matrix of collision primitiveB.
  • dFloat *contactA - pointer to the first element of an array of a least 3 floats to contain the closest point to collisionA.
  • dFloat *contactB - pointer to the first element of an array of a least 3 floats to contain the closest point to collisionB.
  • dFloat *normalAB - pointer to the first element of an array of a least 3 floats to contain the separating vector normal.
  • int threadIndex

Return

  • one if the two bodies are disjoint and the closest point could be found, zero if the two collision primitives are intersecting.

Remarks

  • This function can be used as a low-level building block for a stand-alone collision system. Applications that have already there own physics system, and only want and quick and fast collision solution, can use Newton advanced collision engine as the low level collision detection part. To do this the application only needs to initialize Newton, create the collision primitives at application discretion, and just call this function when the objects are in close proximity. Applications using Newton as a collision system only, are responsible for implementing their own broad phase collision determination, based on any high level tree structure. Also the application should implement their own trivial aabb test, before calling this function .
  • the current implementation of this function does not work on collision trees, or user define collision.

See also

NewtonCollisionCollideContinue NewtonCollisionPointDistance NewtonCollisionCollide NewtonCollisionRayCast NewtonCollisionCalculateAABB