XMVector2Reflect function (directxmath.h)

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

Syntax

XMVECTOR XM_CALLCONV XMVector2Reflect(
  [in] FXMVECTOR Incident,
  [in] FXMVECTOR Normal
) noexcept;

Parameters

[in] Incident

2D incident vector to reflect.

[in] Normal

2D 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);	// 2.0 * dot(Incident, Normal);

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

return Result;

Platform Requirements

Microsoft Visual Studio 2010 or Microsoft Visual Studio 2012 with the Windows SDK for Windows 8. Supported for Win32 desktop apps, Windows Store apps, and Windows Phone 8 apps.

Requirements

Requirement Value
Target Platform Windows
Header directxmath.h (include DirectXMath.h)

See also

DirectXMath Library 2D Vector Geometric Functions