mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 22:12:59 +00:00 
			
		
		
		
	crystal:: coordinate computation is exported now
This commit is contained in:
		
							
								
								
									
										12
									
								
								crystal.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								crystal.cpp
									
									
									
									
									
								
							| @@ -24,14 +24,6 @@ bool view_east = false; | |||||||
|  |  | ||||||
| bool used_compass_inside; | bool used_compass_inside; | ||||||
|  |  | ||||||
| const int MAXDIM = 7; |  | ||||||
|  |  | ||||||
| typedef array<int, MAXDIM> coord; |  | ||||||
| static const coord c0 = {}; |  | ||||||
|  |  | ||||||
| typedef array<ld, MAXDIM> ldcoord; |  | ||||||
| static const ldcoord ldc0 = {}; |  | ||||||
|  |  | ||||||
| ldcoord told(coord c) { ldcoord a; for(int i=0; i<MAXDIM; i++) a[i] = c[i]; return a; } | ldcoord told(coord c) { ldcoord a; for(int i=0; i<MAXDIM; i++) a[i] = c[i]; return a; } | ||||||
| // strange number to prevent weird acting in case of precision errors | // strange number to prevent weird acting in case of precision errors | ||||||
| coord roundcoord(ldcoord c) { coord a; for(int i=0; i<MAXDIM; i++) a[i] = floor(c[i] + .5136); return a; } | coord roundcoord(ldcoord c) { coord a; for(int i=0; i<MAXDIM; i++) a[i] = floor(c[i] + .5136); return a; } | ||||||
| @@ -449,6 +441,10 @@ hrmap_crystal *crystal_map() { | |||||||
|   return (hrmap_crystal*) currentmap; |   return (hrmap_crystal*) currentmap; | ||||||
|   }  |   }  | ||||||
|  |  | ||||||
|  | heptagon *get_heptagon_at(coord c) { return crystal_map()->get_heptagon_at(c, S7); } | ||||||
|  | coord get_coord(heptagon *h) { return crystal_map()->hcoords[h]; } | ||||||
|  | ldcoord get_ldcoord(cell *c) { return crystal_map()->get_coord(c); } | ||||||
|  |  | ||||||
| bool is_bi(crystal_structure& cs, coord co) { | bool is_bi(crystal_structure& cs, coord co) { | ||||||
|   for(int i=0; i<cs.dim; i++) if(co[i] & HALFSTEP) return true; |   for(int i=0; i<cs.dim; i++) if(co[i] & HALFSTEP) return true; | ||||||
|   return false; |   return false; | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								hyper.h
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								hyper.h
									
									
									
									
									
								
							| @@ -4185,6 +4185,17 @@ namespace arcm { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| namespace crystal { | namespace crystal { | ||||||
|  |   static const int MAXDIM = 7; | ||||||
|  |   typedef array<int, MAXDIM> coord; | ||||||
|  |   static const coord c0 = {}; | ||||||
|  |    | ||||||
|  |   typedef array<ld, MAXDIM> ldcoord; | ||||||
|  |   static const ldcoord ldc0 = {}; | ||||||
|  |  | ||||||
|  |   heptagon *get_heptagon_at(coord c); | ||||||
|  |   coord get_coord(heptagon *h); | ||||||
|  |   ldcoord get_ldcoord(cell *c); | ||||||
|  |    | ||||||
|   extern colortable coordcolors; |   extern colortable coordcolors; | ||||||
|   extern ld compass_probability; |   extern ld compass_probability; | ||||||
|   extern bool view_coordinates; |   extern bool view_coordinates; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue