Contents

matrix4x4f::transformDirection

Transforms a direction vector by a 4x4 matrix, ignoring translation.

Declaration

float3 matrix4x4f::transformDirection(float4x4 matrix, float3 vector)

Parameters

  • matrix:

    The 4x4 transformation matrix to apply.

  • vector:

    The 3D direction vector to transform.

Return Value

The transformed 3D direction vector.

Discussion

Multiplies the vector by the matrix with a w component of 0.0, so only rotation and scale are applied. This is appropriate for normals, tangents, and other direction vectors that should not be affected by the matrix’s translational component.