1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 09:00:34 +00:00

models:: Spiral projection now spins together in Euclidean

This commit is contained in:
Zeno Rogue 2019-11-28 20:16:17 +01:00
parent 1329ec6b04
commit ecde911db2
2 changed files with 8 additions and 1 deletions

View File

@ -853,6 +853,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ret[0] = -sin(alpha) * r; ret[0] = -sin(alpha) * r;
ret[1] = cos(alpha) * r; ret[1] = cos(alpha) * r;
if(euclid) ret = models::euclidean_spin * ret;
ret[2] = (r-1) * sqrt( pow(360/models::spiral_cone, 2) - 1); ret[2] = (r-1) * sqrt( pow(360/models::spiral_cone, 2) - 1);
models::apply_ball(ret[2], ret[1]); models::apply_ball(ret[2], ret[1]);
@ -861,6 +862,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
z = exp(z); z = exp(z);
ret[0] = real(z); ret[0] = real(z);
ret[1] = imag(z); ret[1] = imag(z);
if(euclid) ret = models::euclidean_spin * ret;
if(vid.skiprope) if(vid.skiprope)
ret = mobius(ret, vid.skiprope, 1); ret = mobius(ret, vid.skiprope, 1);

View File

@ -160,6 +160,9 @@ EX namespace models {
EX ld spiral_cone_rad; EX ld spiral_cone_rad;
EX bool ring_not_spiral; EX bool ring_not_spiral;
/** the matrix to rotate the Euclidean view from the standard coordinates to the screen coordinates */
EX transmatrix euclidean_spin;
EX ld product_z_scale = 1; EX ld product_z_scale = 1;
EX void configure() { EX void configure() {
@ -187,7 +190,9 @@ EX namespace models {
spiral_multiplier = cld(cos_spiral, sin_spiral) * cld(spiral_cone_rad * mul / 2., 0); spiral_multiplier = cld(cos_spiral, sin_spiral) * cld(spiral_cone_rad * mul / 2., 0);
} }
if(euclid) { if(euclid) {
hyperpoint h = C0 + (eumove(as_coord({1,0}))*C0 - C0) * spiral_x + (eumove(as_coord({0,1}))*C0 - C0) * spiral_y; euclidean_spin = pispin * inverse(cview() * master_relative(centerover, true));
euclidean_spin = gpushxto0(euclidean_spin * C0) * euclidean_spin;
hyperpoint h = inverse(euclidean_spin) * (C0 + (eumove(as_coord({1,0}))*C0 - C0) * spiral_x + (eumove(as_coord({0,1}))*C0 - C0) * spiral_y);
spiral_multiplier = cld(0, 2 * M_PI) / cld(h[0], h[1]); spiral_multiplier = cld(0, 2 * M_PI) / cld(h[0], h[1]);
} }