From 8823afc8d255e2d8577a77799746a98009142861 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 15 Jul 2024 09:03:58 +0200 Subject: [PATCH] twist::formula_exp now returns shiftpoint --- hyperpoint.cpp | 4 +++- nonisotropic.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 6e9ffd56..43c13669 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -155,6 +155,8 @@ struct transmatrix { struct shiftpoint { hyperpoint h; ld shift; + shiftpoint() {} + shiftpoint(hyperpoint _h, ld _shift) : h(_h), shift(_shift) {} ld& operator [] (int i) { return h[i]; } const ld& operator [] (int i) const { return h[i]; } inline friend shiftpoint operator + (const shiftpoint& h, const hyperpoint& h2) { @@ -1651,7 +1653,7 @@ EX hyperpoint direct_exp(hyperpoint v) { #endif #if MAXMDIM >= 4 if(nil) return nilv::formula_exp(v); - if(sl2 || stretch::in()) return stretch::mstretch ? nisot::numerical_exp(v) : twist::formula_exp(v); + if(sl2 || stretch::in()) return stretch::mstretch ? nisot::numerical_exp(v) : unshift(twist::formula_exp(v)); #endif if(gproduct) return product::direct_exp(v); ld d = hypot_d(GDIM, v); diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 2f617b8f..36ef1872 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -2570,11 +2570,11 @@ EX namespace twist { /** @brief exponential function for both slr and Berger sphere */ - EX hyperpoint formula_exp(hyperpoint vel) { + EX shiftpoint formula_exp(hyperpoint vel) { bool sp = sphere; ld K = sp ? 1 : -1; - if(vel[0] == 0 && vel[1] == 0 && vel[2] == 0) return C0; + if(vel[0] == 0 && vel[1] == 0 && vel[2] == 0) return shiftpoint(C0,0); ld len = hypot_d(3, vel); @@ -2606,7 +2606,7 @@ EX namespace twist { ld xy = sr * sinh(k); ld zw = cr * sinh(k); - return hyperpoint(K*xy * cos(u+beta), K*xy * sin(u+beta), zw * cos(u) - cosh(k) * sin(u), zw * sin(u) + cosh(k)*cos(u)); + return shiftpoint(hyperpoint(K*xy * cos(beta), K*xy * sin(beta), zw, cosh(k)), u); } else { @@ -2624,7 +2624,7 @@ EX namespace twist { ld xy = sr * sin(k); ld zw = cr * sin(k); - return hyperpoint(K*xy * cos(u+beta), K*xy * sin(u+beta), zw * cos(u) - cos(k) * sin(u), zw * sin(u) + cos(k)*cos(u)); + return shiftpoint(hyperpoint(K*xy * cos(u+beta), K*xy * sin(u+beta), zw * cos(u) - cos(k) * sin(u), zw * sin(u) + cos(k)*cos(u)), 0); } }