reflection_matrix

Function reflection_matrix 

Source
pub fn reflection_matrix(plane_normal: Vec3) -> Mat3A
Expand description

Creates a 3×3 matrix that reflects points across the plane at the origin with the given normal.

This is also known as a Householder matrix. It has the general form I - 2NNᵀ, where N is the normal of the plane and I is the identity matrix.

If the plane across which points are to be reflected isn’t at the origin, you can create a translation matrix that translates the points to the origin, then apply the matrix that this function returns on top of that, and finally translate back to the original position.

See the mirror example for a demonstration of how you might use this function.