mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	rendering torus in spherical native geometry now creates the actual torus
This commit is contained in:
		
							
								
								
									
										10
									
								
								rug.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								rug.cpp
									
									
									
									
									
								
							| @@ -409,6 +409,9 @@ void buildTorusRug() { | |||||||
|      |      | ||||||
|   ld factor = sqrt(ld(solution.second.d2()) / solution.first.d2()); |   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); |   Xprintf("factor = %lf\n", factor); | ||||||
|   if(factor <= 2.05) factor = 2.2; |   if(factor <= 2.05) factor = 2.2; | ||||||
|   factor -= 1; |   factor -= 1; | ||||||
| @@ -439,6 +442,13 @@ void buildTorusRug() { | |||||||
|     // r->flat = {alpha, beta, 0};  |     // r->flat = {alpha, beta, 0};  | ||||||
|     double sc = (factor+1)/4; |     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->flat = r->h = hpxyz((factor+cos(alpha)) * cos(beta) * sc, (factor+cos(alpha)) * sin(beta) * sc, -sin(alpha) * sc); | ||||||
|     r->valid = true; |     r->valid = true; | ||||||
|      |      | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue