티스토리 뷰
Syntax
BOOL D3DXIntersectTri( _In_ const D3DXVECTOR3 *p0, _In_ const D3DXVECTOR3 *p1, _In_ const D3DXVECTOR3 *p2, _In_ const D3DXVECTOR3 *pRayPos, _In_ const D3DXVECTOR3 *pRayDir, _Out_ FLOAT *pU, _Out_ FLOAT *pV, _Out_ FLOAT *pDist );
Parameters
- p0 [in]
-
Type: const D3DXVECTOR3*
Pointer to a D3DXVECTOR3 structure, describing the first triangle vertex position.
- p1 [in]
-
Type: const D3DXVECTOR3*
Pointer to a D3DXVECTOR3 structure, describing the second triangle vertex position.
- p2 [in]
-
Type: const D3DXVECTOR3*
Pointer to a D3DXVECTOR3 structure, describing the third triangle vertex position.
- pRayPos [in]
-
Type: const D3DXVECTOR3*
Pointer to a D3DXVECTOR3 structure, specifying the point where the ray begins.
- pRayDir [in]
-
Type: const D3DXVECTOR3*
Pointer to a D3DXVECTOR3 structure, specifying the direction of the ray.
- pU [out]
-
Type: FLOAT*
Barycentric hit coordinates, U.
- pV [out]
-
Type: FLOAT*
Barycentric hit coordinates, V.
- pDist [out]
-
Type: FLOAT*
Ray-intersection parameter distance.
Return value
Type: BOOL
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, the value of [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.
Barycentric coordinates define a point inside a triangle in terms of the triangle's vertices. For a more in-depth description of barycentric coordinates, see Mathworld's Barycentric Coordinates Description.
Requirements
Header |
|
---|---|
Library |
|
See also
'ComComComCom > DX .. D3D' 카테고리의 다른 글
[function] IDirect3DDevice9::SetRenderState (0) | 2017.07.06 |
---|---|
광선추적법 (ray tracing) 이 뭐지? (2) | 2017.07.03 |
DirectWrite (0) | 2017.06.21 |
글꼴 3D mesh 만들어서 출력할 수 있다고 하네 D3DXCreateText (0) | 2017.06.21 |
문자출력 ID3DXFont 인터페이스 (0) | 2017.06.20 |