mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-12-24 14:36:02 +00:00
3D effects in the new models. Also made the 3D effects in old models 'correct'
This commit is contained in:
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user