XMVector3Reflect

Reflects an incident 3D vector across a 3D normal vector.

Syntax

XMVECTOR XMVector3Reflect(
         XMVECTOR Incident,
         XMVECTOR Normal
)  

Parameters

Incident
Type: XMVECTOR 

3D incident vector to reflect.

Normal
Type: XMVECTOR 

3D normal vector to reflect the incident vector across.

Return value

Type: XMVECTOR 

Returns the reflected incident angle.

Remarks

The following pseudocode demonstrates the operation of the function:

XMVECTOR Result;

float s = 2.0f * ( Incident.x * Normal.x + Incident.y * Normal.y + Incident.z * Normal.z );

Result.x = Incident.x - s * Normal.x;
Result.y = Incident.y - s * Normal.y;
Result.z = Incident.z - s * Normal.z;
Result.w = undefined;

return Result;  

Requirements

Header: Declared in directxmath.h.