Math module

make_reflector

procedure · 1 overloadSource

Returns the vector u of the Householder reflection I - u u^T that maps v onto the z axis (to minus its own length along z when v.z is not negative). u has length square root of 2, which is what makes I - u u^T a reflection; reflect_cols and reflect_rows apply it. A zero v gives the zero vector.

ExampleOpen in playground ↗
v := xyz(1, 2, 2);
h := Matrix3_Identity;
reflect_cols(*h, make_reflector(v));
r := h * v;
assert(abs(r.x) < 0.0001 && abs(r.y) < 0.0001 && abs(r.z + 3) < 0.0001);
make_reflector :: (v: Vector3) -> u: Vector3

A vector u for a reflection that sends v onto the z axis. Zero gives zero.

Parameters

v: Vector3
the vector to reflect.

Returns

See also