mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
rendering torus in spherical native geometry now creates the actual torus
This commit is contained in:
parent
38411a9a8b
commit
b8dbaadff6
10
rug.cpp
10
rug.cpp
@ -409,6 +409,9 @@ void buildTorusRug() {
|
||||
|
||||
ld factor = sqrt(ld(solution.second.d2()) / solution.first.d2());
|
||||
|
||||
ld xfactor = sqrt(1/ (1+factor*factor));;
|
||||
ld yfactor = xfactor * factor;
|
||||
|
||||
Xprintf("factor = %lf\n", factor);
|
||||
if(factor <= 2.05) factor = 2.2;
|
||||
factor -= 1;
|
||||
@ -439,6 +442,13 @@ void buildTorusRug() {
|
||||
// r->flat = {alpha, beta, 0};
|
||||
double sc = (factor+1)/4;
|
||||
|
||||
if(gwhere == gSphere) {
|
||||
ld ax = alpha + 1.124651, bx = beta + 1.214893;
|
||||
ld x = xfactor * sin(ax), y = xfactor * cos(ax), z = yfactor * sin(bx), t = yfactor * cos(bx);
|
||||
ld d = acos(t) / sqrt(x*x+y*y+z*z);
|
||||
r->flat = r->h = hpxyz(x * d, y * d, z * d);
|
||||
}
|
||||
else
|
||||
r->flat = r->h = hpxyz((factor+cos(alpha)) * cos(beta) * sc, (factor+cos(alpha)) * sin(beta) * sc, -sin(alpha) * sc);
|
||||
r->valid = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user