From 144c76ca8bcb64cde77c84a692b3d0ccb6c33121 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 16 Jun 2024 23:14:03 +0200 Subject: [PATCH] twist:: fixed orig_height --- nonisotropic.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nonisotropic.cpp b/nonisotropic.cpp index b43efad0..6a8e51fc 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -1329,9 +1329,10 @@ EX namespace hybrid { transmatrix lU = twist::lift_matrix(uU); transmatrix lT1 = twist::lift_matrix(uT1); if(!orig_height.count(cw0.at)) orig_height[cw0.at] = (lT*C0) [2]; - if(!orig_height.count(cw0.peek())) orig_height[cw0.peek()] = (lT1*C0) [2]; - ld diff = (lT * lU * iso_inverse(lT1) * C0)[2] - orig_height[cw0.at] + orig_height[cw0.peek()]; - if(abs(frac(diff / cgi.plevel + 0.5) - 0.5) > 1e-6) throw hr_exception("not an integer"); + ld diff = (lT * lU * iso_inverse(lT1) * C0)[2] - orig_height[cw0.at]; + if(!orig_height.count(cw0.peek())) orig_height[cw0.peek()] = -diff; + diff += orig_height[cw0.peek()]; + if(abs(frac(diff / cgi.plevel + 0.5) - 0.5) > 1e-6) throw hr_exception("not an integer in get_shift"); v = floor(diff / cgi.plevel + 0.5); return v; }