[This is preliminary documentation and is subject to change.]

Returns the centroid of a convex polygon.

Namespace: org.critterai.geom
Assembly: cai-util (in cai-util.dll) Version: 0.5.0.0 (0.5.0.0)

Syntax

         
 C#  Visual Basic  Visual C++ 
public static Vector3[] GetCentroid(
	Vector3[] vertices,
	int startVert,
	int vertCount,
	Vector3[] result,
	int resultVert
)
Public Shared Function GetCentroid ( _
	vertices As Vector3(), _
	startVert As Integer, _
	vertCount As Integer, _
	result As Vector3(), _
	resultVert As Integer _
) As Vector3()
public:
static array<Vector3>^ GetCentroid(
	array<Vector3>^ vertices, 
	int startVert, 
	int vertCount, 
	array<Vector3>^ result, 
	int resultVert
)

Parameters

vertices
array<Vector3>[]()[][]
An array of vertices that contains a representation of a polygon with an arbitrary number of sides. Wrap direction does not matter.
startVert
Int32
The index of the first vertex in the polygon.
vertCount
Int32
The number of vertices in the polygon.
result
array<Vector3>[]()[][]
The array to store the result in.
resultVert
Int32
The index in the result array to store the result.

Return Value

A reference to the result argument.

Remarks

Behavior is undefined if the polygon is not convex.

Behavior is undefined if the vector being overwritten in the out array is a vertex in the polygon. (Can only happen if the vertices and result arrays are the same object.)

See Also