1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-03 19:27:54 +00:00

intra:: fixed portals to/from S3 and H3

This commit is contained in:
Zeno Rogue
2022-02-26 09:49:46 +01:00
parent 6b17cd6412
commit 80b9d9533c
2 changed files with 16 additions and 2 deletions

View File

@@ -91,6 +91,10 @@ hyperpoint portal_data::to_poco(hyperpoint h) const {
else {
h = T * h;
h /= h[3];
if(sphere)
h[2] /= sqrt(1+h[0]*h[0]+h[1]*h[1]);
if(hyperbolic)
h[2] /= sqrt(1-h[0]*h[0]-h[1]*h[1]);
return h;
}
}
@@ -126,6 +130,10 @@ hyperpoint portal_data::from_poco(hyperpoint h) const {
}
else {
h[3] = 1;
if(sphere)
h[2] *= sqrt(1+h[0]*h[0]+h[1]*h[1]);
if(hyperbolic)
h[2] *= sqrt(1-h[0]*h[0]-h[1]*h[1]);
return normalize(iT * h);
}
}