mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	irregular maps in Euclidean
This commit is contained in:
		| @@ -122,7 +122,10 @@ EX namespace euclid3 { | |||||||
|         return spacemap[at]; |         return spacemap[at]; | ||||||
|       else { |       else { | ||||||
|         auto h = tailored_alloc<heptagon> (S7); |         auto h = tailored_alloc<heptagon> (S7); | ||||||
|  |         if(!IRREGULAR)  | ||||||
|           h->c7 = newCell(S7, h); |           h->c7 = newCell(S7, h); | ||||||
|  |         else  | ||||||
|  |           irr::link_to_base(h, ((hrmap_euclid3*)irr::base)->get_at(at)); | ||||||
|         h->distance = 0; |         h->distance = 0; | ||||||
|         h->cdata = NULL; |         h->cdata = NULL; | ||||||
|         h->alt = NULL; |         h->alt = NULL; | ||||||
|   | |||||||
| @@ -45,7 +45,8 @@ EX vector<cellinfo> cells; | |||||||
| ld inner(hyperpoint h1, hyperpoint h2) { | ld inner(hyperpoint h1, hyperpoint h2) { | ||||||
|   return  |   return  | ||||||
|     hyperbolic ? h1[LDIM] * h2[LDIM] - h1[0] * h2[0] - h1[1] * h2[1] : |     hyperbolic ? h1[LDIM] * h2[LDIM] - h1[0] * h2[0] - h1[1] * h2[1] : | ||||||
|     h1[LDIM] * h2[LDIM] + h1[0] * h2[0] + h1[1] * h2[1]; |     sphere ? h1[LDIM] * h2[LDIM] + h1[0] * h2[0] + h1[1] * h2[1] : | ||||||
|  |     h1[0] * h2[0] + h1[1] * h2[1]; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| hyperpoint circumscribe(hyperpoint a, hyperpoint b, hyperpoint c) { | hyperpoint circumscribe(hyperpoint a, hyperpoint b, hyperpoint c) { | ||||||
| @@ -54,6 +55,20 @@ hyperpoint circumscribe(hyperpoint a, hyperpoint b, hyperpoint c) { | |||||||
|   b = b - a; |   b = b - a; | ||||||
|   c = c - a; |   c = c - a; | ||||||
|    |    | ||||||
|  |   if(euclid) { | ||||||
|  |     ld b2 = inner(b, b)/2; | ||||||
|  |     ld c2 = inner(c, c)/2; | ||||||
|  |      | ||||||
|  |     ld det = c[1]*b[0] - b[1]*c[0]; | ||||||
|  |      | ||||||
|  |     h = a; | ||||||
|  |      | ||||||
|  |     h[1] += (c2*b[0] - b2 * c[0]) / det; | ||||||
|  |     h[0] += (c2*b[1] - b2 * c[1]) / -det; | ||||||
|  |      | ||||||
|  |     return h; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   if(inner(b,b) < 0) { |   if(inner(b,b) < 0) { | ||||||
|     b = b / sqrt(-inner(b, b)); |     b = b / sqrt(-inner(b, b)); | ||||||
|     c = c + b * inner(c, b); |     c = c + b * inner(c, b); | ||||||
| @@ -104,7 +119,7 @@ void make_cells_of_heptagon() { | |||||||
|    |    | ||||||
| string status[5]; | string status[5]; | ||||||
|    |    | ||||||
| hrmap *base; | EX hrmap *base; | ||||||
|  |  | ||||||
| bool gridmaking; | bool gridmaking; | ||||||
|  |  | ||||||
| @@ -1077,6 +1092,7 @@ EX bool ctof(cell* c) { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| EX bool supports(eGeometry g) { | EX bool supports(eGeometry g) { | ||||||
|  |   if(g == gEuclid || g == gEuclidSquare) return ginf[g].flags & qBOUNDED; | ||||||
|   return among(g, gNormal, gKleinQuartic, gOctagon, gBolza2, gFieldQuotient, gSphere, gSmallSphere, gTinySphere); |   return among(g, gNormal, gKleinQuartic, gOctagon, gBolza2, gFieldQuotient, gSphere, gSmallSphere, gTinySphere); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue