The inverse of a Matrix4 that is a rotation plus a translation only: transposes the 3x3 part and rotates the negated translation. Much cheaper than a general inverse, but wrong for any matrix with scale, shear or projection.
q: Quaternion;
set_from_axis_and_angle(*q, xyz(0, 0, 1), 0.7);
m := rotation_matrix(Matrix4, q);
m._14 = 3;
inv := isometry_inverse(m);
p := transform_point(inv, transform_point(m, xyz(1, 2, 3)));
assert(abs(p.x - 1) < 0.0001 && abs(p.y - 2) < 0.0001 && abs(p.z - 3) < 0.0001);isometry_inverse :: (m: Matrix4) -> Matrix4
The inverse of a matrix that is only a rotation and a translation.
Parameters
- m: Matrix4
- the matrix. Anything else gives a wrong result.