1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-31 05:52:59 +00:00

3D effects in the new models. Also made the 3D effects in old models 'correct'

This commit is contained in:
Zeno Rogue
2018-03-27 04:01:30 +02:00
parent 7c84280b73
commit fa7822fdf8
4 changed files with 136 additions and 63 deletions

View File

@@ -39,6 +39,42 @@ ld squar(ld x) { return x*x; }
int sig(int z) { return (sphere || z<2)?1:-1; }
int curvature() {
switch(cgclass) {
case gcEuclid: return 0;
case gcHyperbolic: return -1;
case gcSphere: return 1;
default: return 0;
}
}
ld sin_auto(ld x) {
switch(cgclass) {
case gcEuclid: return x;
case gcHyperbolic: return sinh(x);
case gcSphere: return sin(x);
default: return x;
}
}
ld asin_auto(ld x) {
switch(cgclass) {
case gcEuclid: return x;
case gcHyperbolic: return asinh(x);
case gcSphere: return asin(x);
default: return x;
}
}
ld cos_auto(ld x) {
switch(cgclass) {
case gcEuclid: return 1;
case gcHyperbolic: return cosh(x);
case gcSphere: return cos(x);
default: return 1;
}
}
// hyperbolic point:
//===================
@@ -120,6 +156,19 @@ char *display(const hyperpoint& H) {
return buf;
}
ld hypot_auto(ld x, ld y) {
switch(cgclass) {
case gcEuclid:
return hypot(x, y);
case gcHyperbolic:
return acosh(cosh(x) * cosh(y));
case gcSphere:
return acos(cos(x) * cos(y));
default:
return hypot(x, y);
}
}
// get the center of the line segment from H1 to H2
hyperpoint mid(const hyperpoint& H1, const hyperpoint& H2) {