1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-07-16 06:42:42 +00:00

auto-configure Clifford Torus embedding

This commit is contained in:
Zeno Rogue
2023-01-05 16:12:23 +01:00
parent 2182f442d9
commit dd01cd9af4
2 changed files with 22 additions and 1 deletions
+15
View File
@@ -1400,6 +1400,7 @@ EX void switch_always3() {
vid.wall_height *= -1;
}
}
if(spatial_embedding == seCliffordTorus) configure_clifford_torus();
}
else {
vid.always3 = false;
@@ -1418,6 +1419,20 @@ EX void switch_always3() {
#endif
}
EX void configure_clifford_torus() {
rug::clifford_torus ct;
euclid_embed_scale = TAU / hypot_d(2, ct.xh);
euclid_embed_scale_y = TAU / hypot_d(2, ct.yh) / euclid_embed_scale;
euclid_embed_rotate = atan2(ct.xh[1], ct.xh[0]) / degree;
ld alpha = atan2(ct.xfactor, ct.yfactor);
vid.depth = alpha - 1;
vid.wall_height = min(1 / euclid_embed_scale_mean(), (90._deg - alpha) * 0.9);
vid.eye = vid.wall_height / 2 - vid.depth;
}
EX }
EX geometry_information *cgip;