mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 22:12:59 +00:00 
			
		
		
		
	fake:: now works with higher goldberg (sometimes still buggy)
This commit is contained in:
		
							
								
								
									
										5
									
								
								fake.cpp
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								fake.cpp
									
									
									
									
									
								
							| @@ -31,6 +31,8 @@ EX namespace fake { | |||||||
|   EX bool available() { |   EX bool available() { | ||||||
|     if(in()) return true; |     if(in()) return true; | ||||||
|     if(WDIM == 2 && standard_tiling() && (PURE || BITRUNCATED)) return true; |     if(WDIM == 2 && standard_tiling() && (PURE || BITRUNCATED)) return true; | ||||||
|  |     if(WDIM == 2 && standard_tiling() && GOLDBERG && S3 == 4 && ((gp::param.first+gp::param.second) % 2)) return true; | ||||||
|  |     if(WDIM == 2 && standard_tiling() && GOLDBERG && S3 == 3 && ((gp::param.first-gp::param.second) % 3)) return true; | ||||||
|     if(WDIM == 2 && standard_tiling() && GOLDBERG && S3 == 4 && gp::param.first == 1 && gp::param.second == 1) return true; |     if(WDIM == 2 && standard_tiling() && GOLDBERG && S3 == 4 && gp::param.first == 1 && gp::param.second == 1) return true; | ||||||
|     if(arcm::in() && PURE) return true; |     if(arcm::in() && PURE) return true; | ||||||
|     if(hat::in()) return true; |     if(hat::in()) return true; | ||||||
| @@ -97,6 +99,8 @@ EX namespace fake { | |||||||
|         return ddspin(c, cid) * spin(-M_PI / c->type) * lxpush0((c == c->master->c7 ? cgi.hexf : cgi.hexvdist) * 3 / cf); |         return ddspin(c, cid) * spin(-M_PI / c->type) * lxpush0((c == c->master->c7 ? cgi.hexf : cgi.hexvdist) * 3 / cf); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |       if(GOLDBERG) return underlying_map->get_corner(c, cid, cf); | ||||||
|  |  | ||||||
|       if(embedded_plane) { |       if(embedded_plane) { | ||||||
|         geom3::light_flip(true); |         geom3::light_flip(true); | ||||||
|         hyperpoint h = get_corner(c, cid, cf); |         hyperpoint h = get_corner(c, cid, cf); | ||||||
| @@ -128,6 +132,7 @@ EX namespace fake { | |||||||
|         geom3::light_flip(false); |         geom3::light_flip(false); | ||||||
|         return cgi.emb->base_to_actual(T); |         return cgi.emb->base_to_actual(T); | ||||||
|         } |         } | ||||||
|  |       if(GOLDBERG) return underlying_map->adj(c, d); | ||||||
|       if(hat::in()) return underlying_map->adj(c, d); |       if(hat::in()) return underlying_map->adj(c, d); | ||||||
|       if(variation == eVariation::coxeter) { |       if(variation == eVariation::coxeter) { | ||||||
|         array<int, 3> which; |         array<int, 3> which; | ||||||
|   | |||||||
| @@ -522,6 +522,7 @@ hpcshape | |||||||
|   struct gpdata_t { |   struct gpdata_t { | ||||||
|     vector<array<array<array<transmatrix, 6>, GOLDBERG_LIMIT>, GOLDBERG_LIMIT>> Tf; |     vector<array<array<array<transmatrix, 6>, GOLDBERG_LIMIT>, GOLDBERG_LIMIT>> Tf; | ||||||
|     transmatrix corners; |     transmatrix corners; | ||||||
|  |     transmatrix corners_for_triangle; | ||||||
|     ld alpha; |     ld alpha; | ||||||
|     int area; |     int area; | ||||||
|     int pshid[3][8][GOLDBERG_LIMIT][GOLDBERG_LIMIT][8]; |     int pshid[3][8][GOLDBERG_LIMIT][GOLDBERG_LIMIT][8]; | ||||||
| @@ -584,6 +585,10 @@ EX bool is_reg3_variation(eVariation var) { | |||||||
|   return var == eVariation::coxeter; |   return var == eVariation::coxeter; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | EX bool special_fake() { | ||||||
|  |   return fake::in() && (BITRUNCATED || (S3 == 4 && gp::param.first == 1 && gp::param.second == 1)); | ||||||
|  |   } | ||||||
|  |  | ||||||
| void geometry_information::prepare_basics() { | void geometry_information::prepare_basics() { | ||||||
|  |  | ||||||
|   DEBBI(DF_INIT | DF_POLY | DF_GEOM, ("prepare_basics")); |   DEBBI(DF_INIT | DF_POLY | DF_GEOM, ("prepare_basics")); | ||||||
| @@ -694,7 +699,7 @@ void geometry_information::prepare_basics() { | |||||||
|     2 * hdist0(mid(xspinpush0(M_PI/S6, hexvdist), xspinpush0(-M_PI/S6, hexvdist))) |     2 * hdist0(mid(xspinpush0(M_PI/S6, hexvdist), xspinpush0(-M_PI/S6, hexvdist))) | ||||||
|     : hdist(xpush0(crossf), xspinpush0(TAU/S7, crossf)); |     : hdist(xpush0(crossf), xspinpush0(TAU/S7, crossf)); | ||||||
|  |  | ||||||
|   if(fake::in() && (BITRUNCATED || (S3 == 4 && gp::param.first == 1 && gp::param.second == 1))) { |   if(special_fake()) { | ||||||
|     vector<pair<ld, ld>> vals; |     vector<pair<ld, ld>> vals; | ||||||
|     int s6 = BITRUNCATED ? S3*2 : S3; |     int s6 = BITRUNCATED ? S3*2 : S3; | ||||||
|     vals.emplace_back(S7, BITRUNCATED ? fake::around / 3 : fake::around / 2); |     vals.emplace_back(S7, BITRUNCATED ? fake::around / 3 : fake::around / 2); | ||||||
|   | |||||||
							
								
								
									
										40
									
								
								goldberg.cpp
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								goldberg.cpp
									
									
									
									
									
								
							| @@ -637,6 +637,8 @@ EX namespace gp { | |||||||
|     else return corners * c; |     else return corners * c; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |   EX bool gp_style = true; /** disable for the old implementation which did not support fake */ | ||||||
|  |  | ||||||
|   hyperpoint atz(const transmatrix& T, const transmatrix& corners, loc at, int cornerid = 6, ld cf = 3) { |   hyperpoint atz(const transmatrix& T, const transmatrix& corners, loc at, int cornerid = 6, ld cf = 3) { | ||||||
|     int sp = 0; |     int sp = 0; | ||||||
|     again: |     again: | ||||||
| @@ -649,17 +651,35 @@ EX namespace gp { | |||||||
|       } |       } | ||||||
|     if(sp>SG3) sp -= SG6; |     if(sp>SG3) sp -= SG6; | ||||||
|  |  | ||||||
|  |     if(gp_style && corner[0] < -1e-6) { | ||||||
|  |       auto ac = corner; ac[1] = 1 - corner[1]; ac[2] = 1 - corner[2]; ac[0] = -ac[0]; | ||||||
|  |       hyperpoint ctr = normalize(cornmul(T, hyperpoint(0, 0.5, 0.5, 0))); | ||||||
|  |       int sp2 = 0; | ||||||
|  |       while(ac[1] < -1e-6 || ac[2] < -1e-6) { | ||||||
|  |         auto xac = inverse(corners) * ac; | ||||||
|  |         xac = xac[0] * loctoh_ort(eudir(1)) + xac[1] * loctoh_ort(eudir(2)); xac[2] = 1; xac[3] = 0; | ||||||
|  |         ac = corners * xac; | ||||||
|  |         sp2++; | ||||||
|  |         } | ||||||
|  |       if(sp2>SG3) sp2 -= SG6; | ||||||
|  |       return spin(TAU*sp/S7) * | ||||||
|  |         rgpushxto0(ctr) * rgpushxto0(ctr) * spin(M_PI + TAU*sp2/S7) * | ||||||
|  |         normalize(cornmul(T, ac)); | ||||||
|  |       } | ||||||
|  |  | ||||||
|     return normalize(spin(TAU*sp/S7) * cornmul(T, corner)); |     return normalize(spin(TAU*sp/S7) * cornmul(T, corner)); | ||||||
|     } |     } | ||||||
|    |  | ||||||
|   transmatrix dir_matrix(int i) { |   EX transmatrix dir_matrix(int i) { | ||||||
|  |     // println(hlog, "0.8424 = 1.8705 = ", cgi.hcrossf); | ||||||
|     auto ddspin = [] (int d) -> transmatrix {  |     auto ddspin = [] (int d) -> transmatrix {  | ||||||
|       return spin(M_PI - d * TAU / S7 - cgi.hexshift); |       return spin(M_PI - d * TAU / S7 - cgi.hexshift); | ||||||
|       }; |       }; | ||||||
|  |     auto gxpush0 = geom3::flipped ? xpush0 : lxpush0; | ||||||
|     return spin(-cgi.gpdata->alpha) * build_matrix( |     return spin(-cgi.gpdata->alpha) * build_matrix( | ||||||
|       geom3::flipped ? C02 : tile_center(), |       geom3::flipped ? C02 : tile_center(), | ||||||
|       geom3::flipped ? ddspin(i) * xpush0(cgi.tessf) : ddspin(i) * lxpush0(cgi.tessf), |       gp_style ? (ddspin(i) * spin(-M_PI/S7) * gxpush0(cgi.hcrossf)) : ddspin(i) * gxpush0(cgi.tessf), | ||||||
|       geom3::flipped ? ddspin(i+1) * xpush0(cgi.tessf) : ddspin(i+1) * lxpush0(cgi.tessf), |       gp_style ? (ddspin(i) * spin(M_PI/S7) * gxpush0(cgi.hcrossf)) : ddspin(i+1) * gxpush0(cgi.tessf), | ||||||
|       C03 |       C03 | ||||||
|       ); |       ); | ||||||
|     } |     } | ||||||
| @@ -667,12 +687,18 @@ EX namespace gp { | |||||||
|   EX void prepare_matrices(bool inv) { |   EX void prepare_matrices(bool inv) { | ||||||
|     if(!(GOLDBERG_INV || inv)) return; |     if(!(GOLDBERG_INV || inv)) return; | ||||||
|     if(embedded_plane) geom3::light_flip(true); |     if(embedded_plane) geom3::light_flip(true); | ||||||
|     cgi.gpdata->corners = inverse(build_matrix( |     cgi.gpdata->corners_for_triangle = inverse(build_matrix( | ||||||
|       loctoh_ort(loc(0,0)), |       loctoh_ort(loc(0,0)), | ||||||
|       loctoh_ort(param), |       loctoh_ort(param), | ||||||
|       loctoh_ort(param * loc(0,1)), |       loctoh_ort(param * loc(0,1)), | ||||||
|       C03 |       C03 | ||||||
|       )); |       )); | ||||||
|  |     cgi.gpdata->corners = (!gp_style) ? cgi.gpdata->corners_for_triangle : inverse(build_matrix( | ||||||
|  |       loctoh_ort(loc(0,0)), | ||||||
|  |       S3 == 4 ? (loctoh_ort(param * loc(1,1)) + C02)/2 : (loctoh_ort(loc(0,0)) + loctoh_ort(param) + loctoh_ort(param * loc(0,1))) / 3, | ||||||
|  |       S3 == 4 ? (loctoh_ort(param * loc(1,-1)) + C02)/2 : (loctoh_ort(loc(0,0)) + loctoh_ort(param) + loctoh_ort(param * loc(0,1) * loc(0,1) * loc(0,1) * loc(0,1) * loc(0,1))) / 3, | ||||||
|  |       C03 | ||||||
|  |       )); | ||||||
|     cgi.gpdata->Tf.resize(S7); |     cgi.gpdata->Tf.resize(S7); | ||||||
|  |  | ||||||
|     /* should work directly without flipping but it does not... flipping for now */ |     /* should work directly without flipping but it does not... flipping for now */ | ||||||
| @@ -733,7 +759,7 @@ EX namespace gp { | |||||||
|       next = point3(x+y/2., -y * sqrt(3) / 2, 0); |       next = point3(x+y/2., -y * sqrt(3) / 2, 0); | ||||||
|       ld scale = 1 / hypot_d(2, next); |       ld scale = 1 / hypot_d(2, next); | ||||||
|       if(!GOLDBERG) scale = 1; |       if(!GOLDBERG) scale = 1; | ||||||
|       if(fake::in() && x == 1 && y == 1) scale = 1; |       if(special_fake()) scale = 1; | ||||||
|       cgi.crossf *= scale; |       cgi.crossf *= scale; | ||||||
|       cgi.hexhexdist *= scale; |       cgi.hexhexdist *= scale; | ||||||
|       cgi.hexvdist *= scale; |       cgi.hexvdist *= scale; | ||||||
| @@ -1030,7 +1056,7 @@ EX namespace gp { | |||||||
|     int sp = 0; |     int sp = 0; | ||||||
|     auto& at = li.relative; |     auto& at = li.relative; | ||||||
|     again: |     again: | ||||||
|     auto corner = cgi.gpdata->corners * loctoh_ort(at); |     auto corner = cgi.gpdata->corners_for_triangle * loctoh_ort(at); | ||||||
|     if(corner[1] < -1e-6 || corner[2] < -1e-6) { |     if(corner[1] < -1e-6 || corner[2] < -1e-6) { | ||||||
|       at = at * eudir(1); |       at = at * eudir(1); | ||||||
|       sp++; |       sp++; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue