diff --git a/geom-exp.cpp b/geom-exp.cpp index 9bb60813..bca79017 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -715,7 +715,10 @@ EX void menuitem_nilwidth(key_type key) { dialog::addSelItem(XLAT("Nil width"), fts(nilv::nilwidth), key); dialog::add_action([] { dialog::editNumber(nilv::nilwidth, 0.01, 2, 0.1, 1, XLAT("Nil width"), ""); - dialog::get_ne().reaction = ray::reset_raycaster; + dialog::get_ne().reaction = [] { + ray::reset_raycaster(); + twist::clear_twisted_matrices(); + }; dialog::bound_low(0.01); }); } @@ -1033,9 +1036,10 @@ EX void showEuclideanMenu() { dialog::get_ne().reaction = ray::reset_raycaster; }); } - else if(mhybrid) { + else if(mtwisted) { dialog::addSelItem(XLAT("number of levels"), its(hybrid::csteps / cgi.single_step), 'L'); dialog::add_action(hybrid::configure_period); + if(nil) menuitem_nilwidth('v'); } else if(bt::in()) { menuitem_binary_width('v'); diff --git a/nonisotropic.cpp b/nonisotropic.cpp index bf4104e6..d51551c1 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -1328,8 +1328,8 @@ EX namespace hybrid { transmatrix lT = twist::lift_matrix(uT); 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]; - ld diff = (lT * lU * iso_inverse(lT1) * C0)[2] - orig_height[cw0.at]; + if(!orig_height.count(cw0.at)) orig_height[cw0.at] = (lT*C0) [2] / nilv::nilwidth / nilv::nilwidth; + ld diff = (lT * lU * iso_inverse(lT1) * C0)[2] / nilv::nilwidth / nilv::nilwidth - 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"); @@ -2352,19 +2352,19 @@ EX namespace twist { #if MAXMDIM >= 4 EX transmatrix uxpush(ld x) { if(sl2) return xpush(x); - if(nil) return xpush(x*2); + if(nil) return xpush(x*2*nilv::nilwidth); return cspin(1, 3, x) * cspin(0, 2, x); } EX transmatrix uypush(ld y) { if(sl2) return ypush(y); - if(nil) return ypush(y*2); + if(nil) return ypush(y*2*nilv::nilwidth); return cspin(0, 3, -y) * cspin(1, 2, y); } EX transmatrix uzpush(ld z) { if(sl2) return zpush(z); - if(nil) return zpush(z) * spin(-2*z); + if(nil) return zpush(z*nilv::nilwidth*nilv::nilwidth) * spin(-2*z); return cspin(3, 2, -z) * cspin(0, 1, -z); } @@ -2447,6 +2447,15 @@ EX namespace twist { } }; + EX void clear_twisted_matrices() { + saved_matrices_ray.clear(); + for(auto& m: allmaps) { + auto m1 = dynamic_cast (m); + if(m1) m1->saved_matrices.clear(); + } + } + + /** reinterpret the given point of rotspace as a rotation matrix in the underlying geometry (note: this is the inverse) * note: you should already be in underlying geometry */ EX transmatrix qtm(hyperpoint h) {