Function directx_math::XMVector4Reflect [−][src]
pub fn XMVector4Reflect(Incident: FXMVECTOR, Normal: FXMVECTOR) -> XMVECTOR
Reflects an incident 4D vector across a 4D normal vector.
Parameters
Incident
4D incident vector to reflect.
Normal
4D 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:
MVECTOR Result;
float s = 2.0f * dot(Incident, Normal);
Result.x = Incident.x - s * Normal.x;
Result.y = Incident.y - s * Normal.y;
Result.z = Incident.z - s * Normal.z;
Result.w = Incident.w - s * Normal.w;
return Result;
Reference
https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-XMVector4Reflect