diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 185ccca7..4afac8d0 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -877,6 +877,14 @@ EX void orthonormalize(transmatrix& T) { } } +/** fix a 3D rotation matrix */ +EX void fix_rotation(transmatrix& rot) { + dynamicval g(geometry, gSphere); + fixmatrix(rot); + for(int i=0; i<3; i++) rot[i][3] = rot[3][i] = 0; + rot[3][3] = 1; + } + /** determinant 2x2 */ EX ld det2(const transmatrix& T) { return T[0][0] * T[1][1] - T[0][1] * T[1][0]; diff --git a/nonisotropic.cpp b/nonisotropic.cpp index abd2e42b..44bca5f1 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -2791,7 +2791,7 @@ EX namespace nisot { transmatrix push = eupush( tC0(T) ); transmatrix push_back = eupush(tC0(T), -1); transmatrix gtl = push_back * T; - { dynamicval g(geometry, gSphere); hr::fixmatrix(gtl); } + fix_rotation(gtl); T = push * gtl; } diff --git a/shmup.cpp b/shmup.cpp index dbfddd21..42729cb8 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -176,7 +176,7 @@ void fix_to_2(transmatrix& T) { if(nonisotropic) { hyperpoint h = tC0(T); transmatrix rot = gpushxto0(h) * T; - { dynamicval g(geometry, gSphere); fixmatrix(rot); } + fix_rotation(rot); T = rgpushxto0(h) * rot; } else