position

fun IIndexedPolygon.position(vertexData: IVertexData, barycentric: Vector3): Vector3(source)

Computes the 3D position of a point in a polygon using barycentric coordinates.

The method retrieves the positions of the vertices associated with this polygon from the provided vertex data. Using the given barycentric coordinates, it calculates the weighted combination of the vertex positions.

Return

A 3D vector representing the position in the polygon corresponding to the given barycentric coordinates.

Parameters

vertexData

The vertex data containing the positions of the polygon's vertices.

barycentric

A vector representing the barycentric coordinates, used to describe the relative position within the polygon.

Throws

If the polygon does not have exactly 3 position indices.

If the polygon's positions list is empty.