From 4e52804d4597a8242ece6e90fa36f027549ef3c5 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 21 Mar 2020 09:27:12 +0100 Subject: [PATCH] moved spin_to and spin_from implementations outside of hr_map --- cell.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/cell.cpp b/cell.cpp index 2838be37..64b249a3 100644 --- a/cell.cpp +++ b/cell.cpp @@ -53,22 +53,9 @@ struct hrmap { static constexpr ld SPIN_NOT_AVAILABLE = 1e5; virtual ld spin_angle(cell *c, int d) { return SPIN_NOT_AVAILABLE; } - virtual transmatrix spin_to(cell *c, int d, ld bonus=0) { - ld sa = spin_angle(c, d); - if(sa != SPIN_NOT_AVAILABLE) { return spin(bonus + sa); } - transmatrix T = rspintox(tC0(adj(c, d))); - if(WDIM == 3) return T * cspin(2, 0, bonus); - return T * spin(bonus); - } - - virtual transmatrix spin_from(cell *c, int d, ld bonus=0) { - ld sa = spin_angle(c, d); - if(sa != SPIN_NOT_AVAILABLE) { return spin(bonus - sa); } - transmatrix T = spintox(tC0(adj(c, d))); - if(WDIM == 3) return T * cspin(2, 0, bonus); - return T * spin(bonus); - } - + virtual transmatrix spin_to(cell *c, int d, ld bonus=0); + virtual transmatrix spin_from(cell *c, int d, ld bonus=0); + virtual double spacedist(cell *c, int i) { return hdist0(tC0(adj(c, i))); } }; @@ -106,6 +93,22 @@ struct hrmap_hyperbolic : hrmap_standard { }; #endif +transmatrix hrmap::spin_to(cell *c, int d, ld bonus) { + ld sa = spin_angle(c, d); + if(sa != SPIN_NOT_AVAILABLE) { return spin(bonus + sa); } + transmatrix T = rspintox(tC0(adj(c, d))); + if(WDIM == 3) return T * cspin(2, 0, bonus); + return T * spin(bonus); + } + +transmatrix hrmap::spin_from(cell *c, int d, ld bonus) { + ld sa = spin_angle(c, d); + if(sa != SPIN_NOT_AVAILABLE) { return spin(bonus - sa); } + transmatrix T = spintox(tC0(adj(c, d))); + if(WDIM == 3) return T * cspin(2, 0, bonus); + return T * spin(bonus); + } + transmatrix hrmap::adj(heptagon *h, int i) { return relative_matrix(h->cmove(i), h, C0); } vector& hrmap::allcells() {