From cb654ca990172849a4947ae7ea7f9f068f678034 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 23 Apr 2022 00:42:53 +0200 Subject: [PATCH] tes:: fixed get_adj with infinite points --- arbitrile.cpp | 19 ++++++------------- hyperpoint.cpp | 7 +++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arbitrile.cpp b/arbitrile.cpp index f7d6bfdd..997de65f 100644 --- a/arbitrile.cpp +++ b/arbitrile.cpp @@ -905,23 +905,16 @@ EX hrmap *current_altmap; heptagon *build_child(heptspin p, pair 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 */ EX hyperpoint get_midedge(ld len, const hyperpoint &l, const hyperpoint &r) { if(len == INFINITE_BOTH) { return normalize(kleinize(l) + kleinize(r)); } - else if(len == INFINITE_LEFT) { - return at1(r, l); - } 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); } @@ -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 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); hyperpoint xvl = xsh.vertices[xdl]; 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); diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 0a550e80..022f176c 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -1684,6 +1684,13 @@ EX hyperpoint circumscribe(hyperpoint a, hyperpoint b, hyperpoint c, hyperpoint 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) { return h1[0] * h2[1] > h1[1] * h2[0]; }