1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

intra:: fixed Euclidean portals from/to product spaces

This commit is contained in:
Zeno Rogue 2022-02-26 09:48:49 +01:00
parent 8569242082
commit 6b17cd6412
2 changed files with 10 additions and 10 deletions

View File

@ -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]);

View File

@ -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",