# NewtonCollisionPointDistance

## NewtonCollisionPointDistance

int NewtonCollisionPointDistance (const NewtonWorld* newtonWorld, const dFloat *point, const NewtonCollision* collision, const dFloat* matrix, dFloat* contact, dFloat* normal, int threadIndex);

## Usage

Calculate the closest point between a point and convex collision primitive.

## Parameters

- const NewtonWorld *newtonWorld - is the pointer to the Newton world.
- dFloat *point - pointer to and array of a least 3 floats representing the origin.
- const NewtonCollision *collision - pointer to collision primitive.
- const dFloat *matrix - pointer to an array of 16 floats containing the offset matrix of collision primitiveA.
- dFloat *contact - pointer to and array of a least 3 floats to contain the closest point to collisioA.
- dFloat *normal - pointer to and 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 point is inside the convex primitive.

## 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 do work on collision trees, or user defined collision.

## See also

NewtonCollisionCollideContinue NewtonCollisionClosestPoint NewtonCollisionCollide NewtonCollisionRayCast NewtonCollisionCalculateAABB