Returns a point in Barycentric coordinates, using the specified position vectors.
XMVECTOR XMVectorBaryCentric(
XMVECTOR Position0,
XMVECTOR Position1,
XMVECTOR Position2,
float f,
float g
)
Position0
Type: XMVECTOR
First position.
Position1
Type: XMVECTOR
Second position.
Position2
Type: XMVECTOR
Third position.
f
Type: float
Weighting factor. See the remarks.
g
Type: float
Weighting factor. See the remarks.
Type: XMVECTOR
Returns the Barycentric coordinates.
This function provides a way to understand points in and around a triangle, independent of where the triangle is located. This function returns the resulting point by using the following equation: Position0> + f>(Position1-Position0>) + g>(Position2-Position0>).
Any point in the plane Position0>Position1>Position2> can be represented by the Barycentric coordinate (f>,g>), where f> controls how much Position1> gets weighted into the result, and g> controls how much Position2> gets weighted into the result. Lastly, 1-f>-g> controls how much Position0> gets weighted into the result.
Note the following relations.
Barycentric coordinates are a form of general coordinates. In this context, using Barycentric coordinates represents a change in coordinate systems. What holds true for Cartesian coordinates holds true for Barycentric coordinates.
Header: Declared in directxmath.h.