From 6b17cd6412846ff64fb54fc18fb5621f5f717323 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 26 Feb 2022 09:48:49 +0100 Subject: [PATCH] intra:: fixed Euclidean portals from/to product spaces --- intra.cpp | 8 ++++---- raycaster.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/intra.cpp b/intra.cpp index e2d1141f..52a5ef35 100644 --- a/intra.cpp +++ b/intra.cpp @@ -69,9 +69,9 @@ hyperpoint portal_data::to_poco(hyperpoint h) const { ld z = product_decompose(h).first; h /= exp(z); auto h1 = h; - h[0] = asin_auto(h1[1]); + h[2] = asin_auto_clamp(h1[0]); h[1] = z; - h[2] = asin_auto_clamp(h1[0] / cos_auto(h[0])); + h[0] = asin_auto_clamp(h1[1] / cos_auto(h[2])); h[3] = 1; return h; } @@ -109,8 +109,8 @@ hyperpoint portal_data::from_poco(hyperpoint h) const { } else if(prod && kind == 0) { auto h0 = h; - h[0] = sin_auto(h0[2]) * cos_auto(h0[0]); - h[1] = sin_auto(h0[0]); + h[0] = sin_auto(h0[2]); + h[1] = sin_auto(h0[0]) * cos_auto(h0[2]); h[2] = cos_auto(h0[0]) * cos_auto(h0[2]); h[3] = 1; return iT * h * exp(h0[1]); diff --git a/raycaster.cpp b/raycaster.cpp index 5256bf2c..a0c5583d 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -1623,13 +1623,13 @@ void raygen::add_functions() { add_if("from_poco_h2xr_e", "mediump vec4 from_poco_h2xr_e(mediump vec4 pos) {\n" - " return vec4(sinh(pos[2]) * cosh(pos[0]), sinh(pos[0]), cosh(pos[0]) * cosh(pos[2]), 0);\n" + " return vec4(sinh(pos[2]), sinh(pos[0]) * cosh(pos[2]), cosh(pos[0]) * cosh(pos[2]), 0);\n" " }\n\n"); add_if("to_poco_h2xr_e", "mediump vec4 to_poco_h2xr_e(mediump vec4 pos) {\n" - " mediump float x = asinh(pos[1]);\n" - " return vec4(x, 0, asinh(pos[0] / cosh(x)), 1);\n" + " mediump float x = asinh(pos[0]);\n" + " return vec4(asinh(pos[1] / cosh(x)), 0, x, 1);\n" " }\n\n"); add_if("from_poco_s2xr_s", @@ -1648,13 +1648,13 @@ void raygen::add_functions() { add_if("from_poco_s2xr_e", "mediump vec4 from_poco_s2xr_e(mediump vec4 pos) {\n" - " return vec4(sin(pos[2]) * cos(pos[0]), sin(pos[0]), cos(pos[0]) * cos(pos[2]), 0);\n" + " return vec4(sin(pos[2]), sin(pos[0]) * cos(pos[2]), cos(pos[0]) * cos(pos[2]), 0);\n" " }\n\n"); add_if("to_poco_s2xr_e", "mediump vec4 to_poco_s2xr_e(mediump vec4 pos) {\n" - " mediump float x = asin_clamp(pos[1]);\n" - " return vec4(x, 0, asin_clamp(pos[0] / cos(x)), 1);\n" + " mediump float x = asin_clamp(pos[0]);\n" + " return vec4(asin_clamp(pos[1] / cos(x)), 0, x, 1);\n" " }\n\n"); add_if("deparabolic12",