Function directx_math::XMVector3Reflect [−][src]
pub fn XMVector3Reflect(Incident: FXMVECTOR, Normal: FXMVECTOR) -> FXMVECTOR
Reflects an incident 3D vector across a 3D normal vector.
Parameters
Incident
3D incident vector to reflect.
Normal
3D normal vector to reflect the incident vector across.
Return value
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;
Reference
https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-XMVector3Reflect