Export (0) Print
Expand All

ID3DX10Mesh::Intersect method

Determines if a ray intersects with this mesh.

Syntax


HRESULT Intersect(
  [in]  D3DXVECTOR3 *pRayPos,
  [in]  D3DXVECTOR3 *pRayDir,
  [in]  UINT        *pHitCount,
  [in]  UINT        *pFaceIndex,
  [in]  float       *pU,
  [in]  float       *pV,
  [in]  float       *pDist,
  [out] ID3D10Blob  **ppAllHits
);

Parameters

pRayPos [in]

Type: D3DXVECTOR3*

Pointer to a D3DXVECTOR3 structure, specifying the point where the ray begins.

pRayDir [in]

Type: D3DXVECTOR3*

Pointer to a D3DXVECTOR3 structure, specifying the direction of the ray.

pHitCount [in]

Type: UINT*

The number of times the ray intersected with the mesh.

pFaceIndex [in]

Type: UINT*

Pointer to an index value of the face closest to the ray origin, if pHit is TRUE.

pU [in]

Type: float*

Pointer to a barycentric hit coordinate, U.

pV [in]

Type: float*

Pointer to a barycentric hit coordinate, V.

pDist [in]

Type: float*

Pointer to a ray intersection parameter distance.

ppAllHits [out]

Type: ID3D10Blob**

Pointer to an ID3D10Blob Interface, containing an array of D3DX10_INTERSECT_INFO structures. This is a list of all the hits that occurred in the intersection test.

Return value

Type: HRESULT

The return value is one of the values listed in Direct3D 10 Return Codes.

Remarks

This API 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

D3DX10.h

Library

D3DX10.lib

See also

ID3DX10Mesh
D3DX Interfaces

 

 

Community Additions

ADD
Show:
© 2015 Microsoft