?/TD>
Microsoft DirectX 9.0

D3DXIntersectTri Function


Computes a per-vertex coordinate system based on texture coordinate gradients.

Syntax

BOOL D3DXIntersectTri(      

    const D3DXVECTOR3 *p0,     const D3DXVECTOR3 *p1,     const D3DXVECTOR3 *p2,     const D3DXVECTOR3 *pRayPos,     const D3DXVECTOR3 *pRayDir,     FLOAT *pU,     FLOAT *pV,     FLOAT *pDist );

Parameters

p0
[in] Pointer to a D3DXVECTOR3 structure, describing first triangle vertex position.
p1
[in] Pointer to a D3DXVECTOR3 structure, describing second triangle vertex position.
p2
[in] Pointer to a D3DXVECTOR3 structure, describing third triangle vertex position.
pRayPos
[in] Pointer to a D3DXVECTOR3 structure, specifying the position of the ray.
pRayDir
[in] Pointer to a D3DXVECTOR3 structure, specifying the position of the ray.
pU
[out] Barycentric hit coordinates, U.
pV
[out] Barycentric hit coordinates, V.
pDist
[out] Ray-intersection parameter distance.

Return Value

Returns TRUE if the ray intersects the area of the triangle. Otherwise, returns FALSE.

Remarks

The D3DXIntersect 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 represents a change in coordinate systems. What holds true for Cartesian coordinates holds true for barycentric coordinates.

Function Information

Headerd3dx9mesh.h
Import libraryd3dx9.lib
Minimum operating systems Windows 98


© 2002 Microsoft Corporation. All rights reserved.