Intersects (triangle-ray)

Test whether a triangle intersects with a ray.

Syntax

bool Intersects(
         XMVECTOR Origin,
         XMVECTOR Direction,
         XMVECTOR V0,
         GXMVECTOR V1,
         XMVECTOR V2,
         float &Dist
)  

Parameters

Origin
Type: XMVECTOR 

[in] The origin of the ray.

Direction
Type: XMVECTOR 

[in] The direction of the ray.

V0
Type: XMVECTOR 

[in] A vector defining the triangle.

V1
Type: GXMVECTOR 

[in] A vector defining the triangle.

V2
Type: XMVECTOR 

[in] A vector defining the triangle.

Dist
Type: float 

[out] The distance along the ray where the intersection occurs.

Return value

Type: bool 

A boolean value indicating whether the triangle intersects with the ray.

Remarks

Note

TriangleTests::Intersects is new for DirectXMath. This functionality is not available in XNAMath 2.x. Similar functionality for XNAMath can be found in the DirectX SDK Collision sample.

Requirements

Header: Declared in directxcollision.h.