Microsoft DirectX 8.1 (C++) |
Returns the intersection of the specified ray with the specified triangle, if they intersect.
BOOL D3DXIntersectTri( CONST D3DXVECTOR3* p0, CONST D3DXVECTOR3* p1, CONST D3DXVECTOR3* p2, CONST D3DXVECTOR3* pRayPos, CONST D3DXVECTOR3* pRayDir, FLOAT* pU, FLOAT* pV, FLOAT* pDist );
Returns TRUE if the ray intersects the area of the triangle. Otherwise, returns FALSE.
The D3DXIntersectTri 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 + U(V2-V1) + V(V3-V1).
Any point in the plane V1V2V3 can be represented by the barycentric coordinate (U,V). The parameter U controls how much V2 gets weighted into the result and the parameter V controls how much V3 gets weighted into the result. Lastly, 1-U-V controls how much V1 gets weighted into the result.
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.
Header: Declared in D3dx8mesh.h.
Import Library: Use D3dx8.lib.