cellrelmatrix and cellgfxdist implemented efficiently for euwrap geometries

This commit is contained in:
Zeno Rogue 2018-11-27 16:15:08 +01:00
parent f522dbe46a
commit c993e80a18
1 changed files with 8 additions and 1 deletions

View File

@ -363,6 +363,10 @@ void virtualRebaseSimple(heptagon*& base, transmatrix& at) {
}
double cellgfxdist(cell *c, int i) {
if(euclid) {
if(c->type == 8 && (i&1)) return eurad * sqrt(2);
return eurad;
}
if(NONSTDVAR || archimedean) return hdist0(tC0(calc_relative_matrix(c->move(i), c, i)));
return !BITRUNCATED ? tessf : (c->type == 6 && (i&1)) ? hexhexdist : crossf;
}
@ -370,7 +374,10 @@ double cellgfxdist(cell *c, int i) {
transmatrix cellrelmatrix(cell *c, int i) {
if(NONSTDVAR || archimedean) return calc_relative_matrix(c->move(i), c, i);
double d = cellgfxdist(c, i);
return ddspin(c, i) * xpush(d) * iddspin(c->move(i), c->c.spin(i), euclid ? 0 : M_PI);
transmatrix T = ddspin(c, i) * xpush(d);
if(c->c.mirror(i)) T = T * Mirror;
T = T * iddspin(c->move(i), c->c.spin(i), M_PI);
return T;
}
double randd() { return (rand() + .5) / (RAND_MAX + 1.); }