mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 06:27:17 +00:00
fake:: now works with higher goldberg (sometimes still buggy)
This commit is contained in:
parent
ae7e810de7
commit
abb75ec010
5
fake.cpp
5
fake.cpp
@ -31,6 +31,8 @@ EX namespace fake {
|
||||
EX bool available() {
|
||||
if(in()) 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(arcm::in() && PURE) 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);
|
||||
}
|
||||
|
||||
if(GOLDBERG) return underlying_map->get_corner(c, cid, cf);
|
||||
|
||||
if(embedded_plane) {
|
||||
geom3::light_flip(true);
|
||||
hyperpoint h = get_corner(c, cid, cf);
|
||||
@ -128,6 +132,7 @@ EX namespace fake {
|
||||
geom3::light_flip(false);
|
||||
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(variation == eVariation::coxeter) {
|
||||
array<int, 3> which;
|
||||
|
@ -522,6 +522,7 @@ hpcshape
|
||||
struct gpdata_t {
|
||||
vector<array<array<array<transmatrix, 6>, GOLDBERG_LIMIT>, GOLDBERG_LIMIT>> Tf;
|
||||
transmatrix corners;
|
||||
transmatrix corners_for_triangle;
|
||||
ld alpha;
|
||||
int area;
|
||||
int pshid[3][8][GOLDBERG_LIMIT][GOLDBERG_LIMIT][8];
|
||||
@ -584,6 +585,10 @@ EX bool is_reg3_variation(eVariation var) {
|
||||
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() {
|
||||
|
||||
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)))
|
||||
: 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;
|
||||
int s6 = BITRUNCATED ? S3*2 : S3;
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
int sp = 0;
|
||||
again:
|
||||
@ -649,17 +651,35 @@ EX namespace gp {
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
transmatrix dir_matrix(int i) {
|
||||
|
||||
EX transmatrix dir_matrix(int i) {
|
||||
// println(hlog, "0.8424 = 1.8705 = ", cgi.hcrossf);
|
||||
auto ddspin = [] (int d) -> transmatrix {
|
||||
return spin(M_PI - d * TAU / S7 - cgi.hexshift);
|
||||
};
|
||||
auto gxpush0 = geom3::flipped ? xpush0 : lxpush0;
|
||||
return spin(-cgi.gpdata->alpha) * build_matrix(
|
||||
geom3::flipped ? C02 : tile_center(),
|
||||
geom3::flipped ? ddspin(i) * xpush0(cgi.tessf) : ddspin(i) * lxpush0(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) * gxpush0(cgi.tessf),
|
||||
gp_style ? (ddspin(i) * spin(M_PI/S7) * gxpush0(cgi.hcrossf)) : ddspin(i+1) * gxpush0(cgi.tessf),
|
||||
C03
|
||||
);
|
||||
}
|
||||
@ -667,12 +687,18 @@ EX namespace gp {
|
||||
EX void prepare_matrices(bool inv) {
|
||||
if(!(GOLDBERG_INV || inv)) return;
|
||||
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(param),
|
||||
loctoh_ort(param * loc(0,1)),
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
ld scale = 1 / hypot_d(2, next);
|
||||
if(!GOLDBERG) scale = 1;
|
||||
if(fake::in() && x == 1 && y == 1) scale = 1;
|
||||
if(special_fake()) scale = 1;
|
||||
cgi.crossf *= scale;
|
||||
cgi.hexhexdist *= scale;
|
||||
cgi.hexvdist *= scale;
|
||||
@ -1030,7 +1056,7 @@ EX namespace gp {
|
||||
int sp = 0;
|
||||
auto& at = li.relative;
|
||||
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) {
|
||||
at = at * eudir(1);
|
||||
sp++;
|
||||
|
Loading…
Reference in New Issue
Block a user