From 29c7faa264e1d521030f1238ae81c13f79755f2c Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 9 May 2020 18:33:37 +0200 Subject: [PATCH] stretch < -1 (seems not to be working correctly) --- geom-exp.cpp | 2 +- nonisotropic.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/geom-exp.cpp b/geom-exp.cpp index a9a179eb..dbd489a2 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -843,7 +843,7 @@ EX void showEuclideanMenu() { XLAT( "Stretch the metric along the fibers. This can currently be done in rotation spaces and in 8-cell, 24-cell and 120-cell. " "Value of 0 means not stretched, -1 means S2xE or H2xE (works only in the limit). " - "Only the raycaster is implemented for stretched geometry, so you will see only walls." + "Only the raycaster is implemented for stretched geometry, so you will see only walls. (Must be > -1)" ) ); dialog::reaction = ray::reset_raycaster; diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 59ea8ce9..4acb1139 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -2082,12 +2082,20 @@ EX namespace stretch { return translate(at) * vel; } + EX ld squared() { + return abs(1 + factor); + } + + EX ld not_squared() { + return sqrt(squared()); + } + hyperpoint isometric_to_actual(const hyperpoint at, const hyperpoint velocity) { - return mulz(at, velocity, 1/sqrt(1+factor)); + return mulz(at, velocity, 1/not_squared()); } hyperpoint actual_to_isometric(const hyperpoint at, const hyperpoint velocity) { - return mulz(at, velocity, sqrt(1+factor)); + return mulz(at, velocity, not_squared()); } hyperpoint christoffel(const hyperpoint at, const hyperpoint velocity, const hyperpoint transported) { @@ -2227,7 +2235,7 @@ EX namespace nisot { auto fix = [&] (hyperpoint& h, ld& m) { h = stretch::itranslate(at) * h; h[3] = 0; - ld m1 = h[0] * h[0] + h[1] * h[1] + h[2] * h[2] * (1 + stretch::factor); + ld m1 = h[0] * h[0] + h[1] * h[1] + h[2] * h[2] * stretch::squared(); h /= sqrt(m1/m); h = stretch::translate(at) * h; };