# NewtonTreeCollisionEndBuild

## NewtonTreeCollisionEndBuild

void NewtonTreeCollisionEndBuild( const NewtonCollision* treeCollision, int optimize)

## Usage

Finalize the construction of the polygonal mesh.

## Parameters

- const NewtonCollision* treeCollision - is the pointer to the Tree Collision collision shape.
- int optimize - flag that indicates to Newton whether it should optimize this mesh. Set to 1 to optimize the mesh, otherwise set it to 0 to leave triangles same as they were sent by the application.

## Return

- Nothing.

## Remarks

- After the application has finished adding polygons to the TreeCollision, it must call this function to finalize the construction of the collision mesh. If concave polygons are added to the TreeCollision, the application must call this function with the parameter optimize set to 1. With the optimize parameter set to 1, Newton will optimize the collision mesh by removing non essential edges from adjacent flat polygons. Newton will not change the topology of the mesh but significantly reduces the number of polygons in the mesh. The reduction factor of the number of polygons in the mesh depends upon the irregularity of the mesh topology. A reduction factor of 1.5 to 2.0 is common. Calling this function with the parameter optimize set to zero, will leave the mesh geometry unaltered.

## See also

NewtonCreateTreeCollision NewtonTreeCollisionAddFace NewtonTreeCollisionBeginBuild