mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-03-26 21:37:02 +00:00
renamed as_gp and as_coord to to_loc and to_coord
This commit is contained in:
parent
16eb050788
commit
638f408d05
30
euclid.cpp
30
euclid.cpp
@ -526,8 +526,8 @@ EX namespace euclid3 {
|
||||
}
|
||||
else {
|
||||
twisted &= 8;
|
||||
twisted_vec = as_gp(T0[1]);
|
||||
ortho_vec = as_gp(T0[0]);
|
||||
twisted_vec = to_loc(T0[1]);
|
||||
ortho_vec = to_loc(T0[0]);
|
||||
if(twisted_vec == gp::loc{0,0}) twisted = 0;
|
||||
if(chiral(twisted_vec)) twisted = 0;
|
||||
if(dscalar(twisted_vec, ortho_vec))
|
||||
@ -614,11 +614,11 @@ EX namespace euclid3 {
|
||||
return coo;
|
||||
}
|
||||
else {
|
||||
gp::loc coo = as_gp(x);
|
||||
gp::loc coo = to_loc(x);
|
||||
gp::loc ort = ort1() * twisted_vec;
|
||||
int dsc = dscalar(twisted_vec, twisted_vec);
|
||||
gp::loc d0 (d[0], d[1]);
|
||||
hyperpoint h = eumove(as_coord(twisted_vec)) * C0;
|
||||
hyperpoint h = eumove(to_coord(twisted_vec)) * C0;
|
||||
while(true) {
|
||||
int dsx = dscalar(coo, twisted_vec);
|
||||
if(dsx >= dsc) coo = coo - twisted_vec;
|
||||
@ -646,7 +646,7 @@ EX namespace euclid3 {
|
||||
}
|
||||
}
|
||||
d[0] = d0.first; d[1] = d0.second;
|
||||
return as_coord(coo);
|
||||
return to_coord(coo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -807,9 +807,9 @@ EX namespace euclid3 {
|
||||
else {
|
||||
if(T_edit[1][0] == 0 && T_edit[1][1] == 0)
|
||||
dialog::addInfo(XLAT("change the second column for Möbius bands and Klein bottles"));
|
||||
else if(chiral(as_gp(T_edit[1])))
|
||||
else if(chiral(to_loc(T_edit[1])))
|
||||
dialog::addInfo(XLAT("second period is chiral -- cannot be mirrored"));
|
||||
else if(dscalar(as_gp(T_edit[1]), as_gp(T_edit[0])))
|
||||
else if(dscalar(to_loc(T_edit[1]), to_loc(T_edit[0])))
|
||||
dialog::addInfo(XLAT("periods must be orthogonal for mirroring"));
|
||||
else {
|
||||
dialog::addBoolItem(XLAT("mirror flip in the second period"), twisted_edit & 8, 'x');
|
||||
@ -975,14 +975,14 @@ EX int dcross(gp::loc e1, gp::loc e2) {
|
||||
EX gp::loc euc2_coordinates(cell *c) {
|
||||
auto ans = euclid3::eucmap()->ispacemap[c->master];
|
||||
if(BITRUNCATED)
|
||||
return as_gp(ans) * gp::loc(1,1) + (c == c->master->c7 ? gp::loc(0,0) : gp::eudir((c->c.spin(0)+4)%6));
|
||||
return to_loc(ans) * gp::loc(1,1) + (c == c->master->c7 ? gp::loc(0,0) : gp::eudir((c->c.spin(0)+4)%6));
|
||||
if(GOLDBERG) {
|
||||
auto li = gp::get_local_info(c);
|
||||
gp::loc shift(0,0);
|
||||
if(li.first_dir >= 0) shift = gp::eudir(li.last_dir) * li.relative;
|
||||
return as_gp(ans) * gp::param + shift;
|
||||
return to_loc(ans) * gp::param + shift;
|
||||
}
|
||||
return as_gp(ans);
|
||||
return to_loc(ans);
|
||||
}
|
||||
|
||||
/** this is slow, but we use it only for small p's */
|
||||
@ -994,9 +994,9 @@ EX cell* at_euc2_coordinates(gp::loc p) {
|
||||
return cw.at;
|
||||
}
|
||||
|
||||
EX euclid3::coord as_coord(gp::loc p) { return euclid3::coord(p.first, p.second, 0); }
|
||||
EX euclid3::coord to_coord(gp::loc p) { return euclid3::coord(p.first, p.second, 0); }
|
||||
|
||||
EX gp::loc sdxy() { return as_gp(euclid3::T[1]) * gp::univ_param(); }
|
||||
EX gp::loc sdxy() { return to_loc(euclid3::T[1]) * gp::univ_param(); }
|
||||
|
||||
EX pair<bool, string> coord_display(const transmatrix& V, cell *c) {
|
||||
if(c != c->master->c7) return {false, ""};
|
||||
@ -1011,7 +1011,7 @@ EX pair<bool, string> coord_display(const transmatrix& V, cell *c) {
|
||||
return {true, fts(h[0]) + "," + fts(h[1]) };
|
||||
}
|
||||
|
||||
EX gp::loc as_gp(const euclid3::coord& v) { return gp::loc(v[0], v[1]); }
|
||||
EX gp::loc to_loc(const euclid3::coord& v) { return gp::loc(v[0], v[1]); }
|
||||
|
||||
EX map<gp::loc, cdata>& get_cdata() { return euclid3::eucmap()->eucdata; }
|
||||
|
||||
@ -1071,8 +1071,8 @@ EX int eudist(gp::loc a, gp::loc b) {
|
||||
}
|
||||
|
||||
EX int cyldist(gp::loc a, gp::loc b) {
|
||||
a = as_gp(euclid3::canonicalize(as_coord(a)));
|
||||
b = as_gp(euclid3::canonicalize(as_coord(b)));
|
||||
a = to_loc(euclid3::canonicalize(to_coord(a)));
|
||||
b = to_loc(euclid3::canonicalize(to_coord(b)));
|
||||
|
||||
if(!quotient) return eudist(a, b);
|
||||
|
||||
|
@ -192,7 +192,7 @@ EX namespace models {
|
||||
if(euclid) {
|
||||
euclidean_spin = pispin * inverse(cview() * master_relative(centerover, true));
|
||||
euclidean_spin = gpushxto0(euclidean_spin * C0) * euclidean_spin;
|
||||
hyperpoint h = inverse(euclidean_spin) * (C0 + (eumove(as_coord({1,0}))*C0 - C0) * spiral_x + (eumove(as_coord({0,1}))*C0 - C0) * spiral_y);
|
||||
hyperpoint h = inverse(euclidean_spin) * (C0 + (eumove(to_coord({1,0}))*C0 - C0) * spiral_x + (eumove(to_coord({0,1}))*C0 - C0) * spiral_y);
|
||||
spiral_multiplier = cld(0, 2 * M_PI) / cld(h[0], h[1]);
|
||||
}
|
||||
|
||||
@ -267,13 +267,13 @@ EX namespace models {
|
||||
for(int y=0; y<=200; y++)
|
||||
for(int x=-200; x<=200; x++) {
|
||||
if(y == 0 && x <= 0) continue;
|
||||
auto zero = euclid3::canonicalize(as_coord({x, y}));
|
||||
auto zero = euclid3::canonicalize(to_coord({x, y}));
|
||||
if(zero == euclid3::euzero)
|
||||
torus_zeros.emplace_back(x, y);
|
||||
}
|
||||
sort(torus_zeros.begin(), torus_zeros.end(), [] (const gp::loc p1, const gp::loc p2) {
|
||||
ld d1 = hdist0(tC0(eumove(as_coord(p1))));
|
||||
ld d2 = hdist0(tC0(eumove(as_coord(p2))));
|
||||
ld d1 = hdist0(tC0(eumove(to_coord(p1))));
|
||||
ld d2 = hdist0(tC0(eumove(to_coord(p2))));
|
||||
if(d1 < d2 - 1e-6) return true;
|
||||
if(d1 > d2 + 1e-6) return false;
|
||||
return p1 < p2;
|
||||
|
12
pattern2.cpp
12
pattern2.cpp
@ -2433,12 +2433,12 @@ EX namespace linepatterns {
|
||||
case patZebraTriangles:
|
||||
if(euclid6) {
|
||||
if(c != c->master->c7 || patterns::sevenval(c)) break;
|
||||
gridline(V, C0, tC0(eumove(as_coord({-1, +3}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(as_coord({-3, +2}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(as_coord({-2, -1}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(as_coord({+1, -3}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(as_coord({+3, -2}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(as_coord({+2, +1}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(to_coord({-1, +3}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(to_coord({-3, +2}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(to_coord({-2, -1}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(to_coord({+1, -3}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(to_coord({+3, -2}))), col, 3 + vid.linequality);
|
||||
gridline(V, C0, tC0(eumove(to_coord({+2, +1}))), col, 3 + vid.linequality);
|
||||
break;
|
||||
}
|
||||
if(zebra40(c) / 4 == 10) {
|
||||
|
8
rug.cpp
8
rug.cpp
@ -432,11 +432,11 @@ EX void buildTorusRug() {
|
||||
calcparam_rug();
|
||||
models::configure();
|
||||
|
||||
auto p1 = as_gp(euclid3::T0[0]);
|
||||
auto p2 = as_gp(euclid3::T0[1]);
|
||||
auto p1 = to_loc(euclid3::T0[0]);
|
||||
auto p2 = to_loc(euclid3::T0[1]);
|
||||
|
||||
hyperpoint xh = eumove(as_coord(p1))*C0-C0;
|
||||
hyperpoint yh = eumove(as_coord(p2))*C0-C0;
|
||||
hyperpoint xh = eumove(to_coord(p1))*C0-C0;
|
||||
hyperpoint yh = eumove(to_coord(p2))*C0-C0;
|
||||
if(nonorientable) yh *= 2;
|
||||
|
||||
bool flipped = sqhypot_d(2, xh) < sqhypot_d(2, yh);
|
||||
|
Loading…
x
Reference in New Issue
Block a user