DirectX SDK |
The D3DXVec3BaryCentric function returns a point in Barycentric coordinates, using the specified 3-D vectors.
D3DXVECTOR3* D3DXVec3BaryCentric( D3DXVECTOR3* pOut, const D3DXVECTOR3* pV1, const D3DXVECTOR3* pV2, D3DXVECTOR3* pV3, float f, float g );
A pointer to a D3DXVECTOR3 structure in Barycentric coordinates.
The D3DXVec3BaryCentric function provides a way to understand points in and around a triangle, independent of where the triangle is actually located. This function returns the resulting point by using the following equation: V1 + f(V2-V1) + g(V3-V1).
Any point in the plane V1V2V3 can be represented by the barycentric coordinate (f,g).The parameter f controls how much V2 gets weighted into the result and the parameter g controls how much V3 gets weighted into the result. Lastly, 1-f-g controls how much V1 gets weighted into the result.
Note the following relations:
Barycentric coordinates are a form of general coordinates. In this context, using barycentric coordinates simply represents a change in coordinate systems; what holds true for Cartesian coordinates holds true for Barycentric coordinates.
The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXVec3BaryCentric function can be used as a parameter for another function.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Version: Requires DirectX 7.0.
Header: Declared in d3dxmath.h.
Library: Use d3dx.lib.