1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

tes:: fixed get_adj with infinite points

This commit is contained in:
Zeno Rogue 2022-04-23 00:42:53 +02:00
parent 47da0d9f09
commit cb654ca990
2 changed files with 13 additions and 13 deletions

View File

@ -905,23 +905,16 @@ EX hrmap *current_altmap;
heptagon *build_child(heptspin p, pair<int, int> adj); heptagon *build_child(heptspin p, pair<int, int> adj);
/** the point in distance 1 from 'material' to 'ideal' */
EX hyperpoint at1(hyperpoint material, hyperpoint ideal) {
transmatrix T = gpushxto0(material);
hyperpoint id = T * ideal;
return rgpushxto0(material) * rspintox(id) * xpush0(1);
}
/** get the midedge of lr; it takes infinite vertices into account */ /** get the midedge of lr; it takes infinite vertices into account */
EX hyperpoint get_midedge(ld len, const hyperpoint &l, const hyperpoint &r) { EX hyperpoint get_midedge(ld len, const hyperpoint &l, const hyperpoint &r) {
if(len == INFINITE_BOTH) { if(len == INFINITE_BOTH) {
return normalize(kleinize(l) + kleinize(r)); return normalize(kleinize(l) + kleinize(r));
} }
else if(len == INFINITE_LEFT) {
return at1(r, l);
}
else if(len == INFINITE_RIGHT) { else if(len == INFINITE_RIGHT) {
return at1(l, r); return towards_ideal(r, l);
}
else if(len == INFINITE_LEFT) {
return towards_ideal(l, r);
} }
else return mid(l, r); else return mid(l, r);
} }
@ -942,13 +935,13 @@ EX transmatrix get_adj(arbi_tiling& c, int t, int dl, int t1, int xdl) {
hyperpoint vl = sh.vertices[dl]; hyperpoint vl = sh.vertices[dl];
hyperpoint vr = sh.vertices[dr]; hyperpoint vr = sh.vertices[dr];
hyperpoint vm = get_midedge(sh.edges[dr], vl, vr); hyperpoint vm = get_midedge(sh.edges[dl], vl, vr);
transmatrix rm = gpushxto0(vm); transmatrix rm = gpushxto0(vm);
hyperpoint xvl = xsh.vertices[xdl]; hyperpoint xvl = xsh.vertices[xdl];
hyperpoint xvr = xsh.vertices[xdr]; hyperpoint xvr = xsh.vertices[xdr];
hyperpoint xvm = get_midedge(sh.edges[xdr], xvl, xvr); hyperpoint xvm = get_midedge(sh.edges[xdl], xvl, xvr);
transmatrix xrm = gpushxto0(xvm); transmatrix xrm = gpushxto0(xvm);

View File

@ -1684,6 +1684,13 @@ EX hyperpoint circumscribe(hyperpoint a, hyperpoint b, hyperpoint c, hyperpoint
return h; return h;
} }
/** the point in distance dist from 'material' to 'ideal' */
EX hyperpoint towards_ideal(hyperpoint material, hyperpoint ideal, ld dist IS(1)) {
transmatrix T = gpushxto0(material);
hyperpoint id = T * ideal;
return rgpushxto0(material) * rspintox(id) * xpush0(1);
}
EX bool clockwise(hyperpoint h1, hyperpoint h2) { EX bool clockwise(hyperpoint h1, hyperpoint h2) {
return h1[0] * h2[1] > h1[1] * h2[0]; return h1[0] * h2[1] > h1[1] * h2[0];
} }