fixed displayspin in syntetic

This commit is contained in:
Zeno Rogue 2018-08-19 16:28:36 +02:00
parent 3ac47f53f5
commit e1c49a83fa
19 changed files with 68 additions and 74 deletions

View File

@ -1011,7 +1011,7 @@ transmatrix change_geometry(const transmatrix& T) {
push = hdist0(h);
alpha = atan2(h[1], h[0]);
if(push == 0) alpha = 0;
hyperpoint spinpoint = gpushxto0(h) * T * xpush(1) * C0;
hyperpoint spinpoint = gpushxto0(h) * T * xpush0(1);
beta = atan2(spinpoint[1], spinpoint[0]);
}

View File

@ -51,9 +51,9 @@ mesher msh(eGeometry g, int sym, ld main, ld v0, ld v1, ld bspi, ld scale) {
m.bspi = bspi;
dynamicval<eGeometry> dg(geometry, g);
hyperpoint rot = xpush(v0) * spin(M_PI - M_PI/sym) * xpush(main) * C0;
hyperpoint bnlfar = xpush(v0) * spin(M_PI) * rspintox(rot) * rspintox(rot) * rspintox(rot) * xpush(hdist0(rot)) * C0;
hyperpoint bnrfar = xpush(v0) * spin(M_PI) * spintox(rot) * spintox(rot) * spintox(rot) * xpush(hdist0(rot)) * C0;
hyperpoint rot = xpush(v0) * xspinpush0(M_PI - M_PI/sym, main);
hyperpoint bnlfar = xpush(v0) * spin(M_PI) * rspintox(rot) * rspintox(rot) * rspintox(rot) * xpush0(hdist0(rot));
hyperpoint bnrfar = xpush(v0) * spin(M_PI) * spintox(rot) * spintox(rot) * spintox(rot) * xpush0(hdist0(rot));
m.lcorner = xspinpush0 (bspi-M_PI/sym, main);
m.rcorner = xspinpush0 (bspi+M_PI/sym, main);

View File

@ -94,13 +94,13 @@ void precalc() {
ld f = (fmin+fmax) / 2;
ld v1=0, v2=0;
if(vertexdegree == 3) {
hyperpoint H = xpush(f) * C0;
hyperpoint H = xpush0(f);
v1 = intval(H, C0), v2 = intval(H, spin(2*M_PI/S7)*H);
}
else if(vertexdegree == 4) {
hyperpoint H = xpush(f) * C0;
hyperpoint H = xpush0(f);
ld opposite = hdist(H, spin(2*M_PI/S7)*H);
hyperpoint Hopposite = spin(M_PI/S7) * xpush(opposite) * C0;
hyperpoint Hopposite = xspinpush0(M_PI/S7, opposite);
v2 = intval(H, Hopposite), v1 = intval(H, C0);
}
if(sphere ? v1 < v2 : v1 > v2) fmin = f; else fmax = f;
@ -112,23 +112,23 @@ void precalc() {
fmin = 0, fmax = sphere ? M_PI / 2 : 2;
for(int p=0; p<100; p++) {
ld f = (fmin+fmax) / 2;
hyperpoint H = spin(M_PI/S7) * xpush(f) * C0;
ld v1 = intval(H, C0), v2 = intval(H, xpush(tessf) * C0);
hyperpoint H = xspinpush0(M_PI/S7, f);
ld v1 = intval(H, C0), v2 = intval(H, xpush0(tessf));
if(v1 < v2) fmin = f; else fmax = f;
}
hcrossf = fmin;
}
else {
hcrossf = hdist(xpush(tessf) * C0, spin(2*M_PI/S7) * xpush(tessf) * C0) / 2;
hcrossf = hdist(xpush0(tessf), xspinpush0(2*M_PI/S7, tessf)) / 2;
}
crossf = nonbitrunc ? tessf : hcrossf;
fmin = 0, fmax = tessf;
for(int p=0; p<100; p++) {
ld f = (fmin+fmax) / 2;
hyperpoint H = xpush(f) * C0;
hyperpoint H = xpush0(f);
hyperpoint H1 = spin(2*M_PI/S7) * H;
hyperpoint H2 = xpush(tessf-f) * C0;
hyperpoint H2 = xpush0(tessf-f);
ld v1 = intval(H, H1), v2 = intval(H, H2);
if(v1 < v2) fmin = f; else fmax = f;
}
@ -142,7 +142,7 @@ void precalc() {
finish:
for(int i=0; i<S42; i++)
Crad[i] = spin(2*M_PI*i/S42) * xpush(.4) * C0;
Crad[i] = xspinpush0(2*M_PI*i/S42, .4);
for(int d=0; d<S7; d++)
heptmove[d] = spin(-d * ALPHA) * xpush(tessf) * spin(M_PI);
@ -152,9 +152,9 @@ void precalc() {
for(int d=0; d<S7; d++) invheptmove[d] = inverse(heptmove[d]);
for(int d=0; d<S7; d++) invhexmove[d] = inverse(hexmove[d]);
hexhexdist = hdist(xpush(crossf) * C0, spin(M_PI*2/S7) * xpush(crossf) * C0);
hexhexdist = hdist(xpush0(crossf), xspinpush0(M_PI*2/S7, crossf));
hexvdist = hdist(tC0(xpush(hexf)), spin(ALPHA/2) * tC0(xpush(hcrossf)));
hexvdist = hdist(xpush0(hexf), xspinpush0(ALPHA/2, hcrossf));
if(debug_geometry)
printf("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift,

View File

@ -46,7 +46,7 @@ transmatrix master_relative(cell *c, bool get_inverse) {
}
transmatrix calc_relative_matrix(cell *c2, cell *c1, int direction_hint) {
return calc_relative_matrix(c2, c1, ddspin(c1, direction_hint) * xpush(1e-2) * C0);
return calc_relative_matrix(c2, c1, ddspin(c1, direction_hint) * xpush0(1e-2));
}
// target, source, direction from source to target
@ -357,7 +357,7 @@ double randd() { return (rand() + .5) / (RAND_MAX + 1.); }
hyperpoint randomPointIn(int t) {
while(true) {
hyperpoint h = spin(2*M_PI*(randd()-.5)/t) * tC0(xpush(asinh(randd())));
hyperpoint h = xspinpush0(2*M_PI*(randd()-.5)/t, asinh(randd()));
double d =
nonbitrunc ? tessf : t == 6 ? hexhexdist : crossf;
if(hdist0(h) < hdist0(xpush(-d) * h))
@ -392,7 +392,7 @@ hyperpoint get_corner_position(cell *c, int cid, ld cf) {
if(syntetic) {
if(synt::id_of(c->master) >= synt::N*2) return C0;
auto& t = synt::get_triangle(c->master, cid);
return spin(-t.first) * xpush(t.second * 3 / cf) * C0;
return xspinpush0(-t.first, t.second * 3 / cf);
}
if(nonbitrunc) {
return ddspin(c,cid,M_PI/S7) * xpush0(hcrossf * 3 / cf);
@ -454,7 +454,7 @@ hyperpoint nearcorner(cell *c, int i) {
auto& t = synt::get_triangle(c->master, i);
int id = synt::id_of(c->master);
int id1 = synt::get_adj(synt::get_adj(c->master, i), -2).first;
return spin(-t.first - M_PI / c->type) * xpush(synt::inradius[id/2] + synt::inradius[id1/2]) * C0;
return xspinpush0(-t.first - M_PI / c->type, synt::inradius[id/2] + synt::inradius[id1/2]);
}
if(binarytiling) {
ld yx = log(2) / 2;
@ -474,7 +474,7 @@ hyperpoint nearcorner(cell *c, int i) {
return neis[i];
}
double d = cellgfxdist(c, i);
return ddspin(c, i) * xpush(d) * C0;
return ddspin(c, i) * xpush0(d);
}
hyperpoint farcorner(cell *c, int i, int which) {
@ -508,7 +508,7 @@ hyperpoint farcorner(cell *c, int i, int which) {
int id = synt::id_of(c->master);
auto id1 = synt::get_adj(synt::get_adj(c->master, i), -2).first;
int n1 = isize(synt::adjacent[id1]);
return spin(-t.first - M_PI / c->type) * xpush(synt::inradius[id/2] + synt::inradius[id1/2]) * spin(M_PI + M_PI/n1*(which?3:-3)) * xpush(synt::circumradius[id1/2]) * C0;
return spin(-t.first - M_PI / c->type) * xpush(synt::inradius[id/2] + synt::inradius[id1/2]) * xspinpush0(M_PI + M_PI/n1*(which?3:-3), synt::circumradius[id1/2]);
}
return cellrelmatrix(c, i) * get_corner_position(c->move(i), (cellwalker(c, i) + wstep + (which?2:-1)).spin);

View File

@ -535,8 +535,8 @@ namespace hr { namespace gp {
cell cc; cc.type = S7;
return spin(-alpha) * build_matrix(
C0,
ddspin(&cc, i) * xpush(tessf) * C0,
ddspin(&cc, i+1) * xpush(tessf) * C0
ddspin(&cc, i) * xpush0(tessf),
ddspin(&cc, i+1) * xpush0(tessf)
);
}

View File

@ -237,7 +237,7 @@ void drawLightning(const transmatrix& V) {
ld displayspin(cell *c, int d) {
if(syntetic) {
auto& t1 = synt::get_triangle(c->master, d);
return t1.first + M_PI / c->type;
return -(t1.first + M_PI / c->type);
}
else if(irr::on) {
auto id = irr::cellindex[c];
@ -5329,11 +5329,7 @@ void drawmovestar(double dx, double dy) {
// EUCLIDEAN
#if CAP_QUEUE
if(euclid)
queueline(tC0(Centered), Centered * xspinpush0(d * M_PI / 4, 0.5) , col, vid.linequality);
else
// queueline(tC0(Centered), Centered * spin(M_PI*d/4)* xpush(d==0?.7:d==2?.6:.5) * C0, col >> darken);
queueline(tC0(Centered), Centered * xspinpush0(M_PI*d/4, d==0?.7:d==2?.5:.2), col, 3 + vid.linequality);
queueline(tC0(Centered), Centered * xspinpush0(d * M_PI / 4, euclid ? 0.5 : d==0?.7:d==2?.5:.2), col, 3 + vid.linequality);
#endif
}
}
@ -5403,8 +5399,8 @@ void drawfullmap() {
ptds.clear();
if(pmodel == mdTwoPoint) {
queuechr(xpush(+vid.twopoint_param) * C0, vid.xres / 100, 'X', 0xFF0000);
queuechr(xpush(-vid.twopoint_param) * C0, vid.xres / 100, 'X', 0xFF0000);
queuechr(xpush0(+vid.twopoint_param), vid.xres / 100, 'X', 0xFF0000);
queuechr(xpush0(-vid.twopoint_param), vid.xres / 100, 'X', 0xFF0000);
}
/*
@ -5496,10 +5492,10 @@ void drawfullmap() {
#if CAP_QUEUE
int col = darkena(0x80, 0, 0x80);
queueline(hpxyz(0,0,1), hpxyz(0,0,-vid.alpha), col, 0, PPR_CIRCLE);
queueline(xpush(+4)*C0, hpxyz(0,0,0), col, 0, PPR_CIRCLE);
queueline(xpush(+4)*C0, hpxyz(0,0,-vid.alpha), col, 0, PPR_CIRCLE);
queueline(xpush(-4)*C0, hpxyz(0,0,0), col, 0, PPR_CIRCLE);
queueline(xpush(-4)*C0, hpxyz(0,0,-vid.alpha), col, 0, PPR_CIRCLE);
queueline(xpush0(+4), hpxyz(0,0,0), col, 0, PPR_CIRCLE);
queueline(xpush0(+4), hpxyz(0,0,-vid.alpha), col, 0, PPR_CIRCLE);
queueline(xpush0(-4), hpxyz(0,0,0), col, 0, PPR_CIRCLE);
queueline(xpush0(-4), hpxyz(0,0,-vid.alpha), col, 0, PPR_CIRCLE);
queueline(hpxyz(-1,0,0), hpxyz(1,0,0), col, 0, PPR_CIRCLE);
#endif
}

View File

@ -617,7 +617,7 @@ hyperpoint mid_at(hyperpoint h1, hyperpoint h2, ld v) {
hyperpoint mid_at_actual(hyperpoint h, ld v) {
using namespace hyperpoint_vec;
return rspintox(h) * xpush(hdist0(h) * v) * C0;
return rspintox(h) * xpush0(hdist0(h) * v);
}
}

View File

@ -250,8 +250,8 @@ void applymodel(hyperpoint H, hyperpoint& ret) {
// map to plane
if(false) {
auto p = vid.twopoint_param;
ld dleft = hdist(H, xpush(-p) * C0);
ld dright = hdist(H, xpush(p) * C0);
ld dleft = hdist(H, xpush0(-p));
ld dright = hdist(H, xpush0(p));
ld yf = 1, zf = 0;
if(zlev_used) {
ld y_orig = asin_auto(H[1]);

View File

@ -242,7 +242,7 @@ bool step(int delta) {
cells.emplace_back();
cellinfo& s = cells.back();
s.patterndir = -1;
s.owner = h, s.p = spin(hrand(1000)) * xpush(.01) * C0;
s.owner = h, s.p = xspinpush0(hrand(1000), .01);
set_relmatrices(s);
}
}
@ -489,9 +489,7 @@ bool step(int delta) {
ld dist = hcrossf / 2;
ld dists[8];
for(int i=0; i<S7; i++) {
dists[i] = hdist(s.p, spin(hexshift - i * ALPHA) * xpush(-hcrossf) * C0);
// calc_relative_matrix(s.owner->move(i), s.owner, s.p) * C0);
// spin(2 * M_PI * i / S7) * xpush(hcrossf) * C0);
dists[i] = hdist(s.p, xspinpush0(hexshift - i * ALPHA, -hcrossf));
if(dists[i] < dist)
d = i, dist = dists[i];
}

View File

@ -911,12 +911,12 @@ namespace mapeditor {
for(int d=0; d<S84; d++) {
transmatrix d2 = drawtrans * rgpushxto0(ccenter) * rspintox(inverse(drawtrans * rgpushxto0(ccenter)) * coldcenter);
unsigned col = (d % (S84/drawcell->type) == 0) ? gridcolor : lightgrid;
queueline(d2 * C0, d2 * spin(M_PI*d/S42)* xpush(1) * C0, col, 4 + vid.linequality);
queueline(d2 * C0, d2 * xspinpush0(M_PI*d/S42, 1), col, 4 + vid.linequality);
}
for(int u=2; u<=20; u++) {
PRING(d) {
transmatrix d2 = drawtrans * rgpushxto0(ccenter) * rspintox(inverse(drawtrans * rgpushxto0(ccenter)) * coldcenter);
curvepoint(d2 * spin(M_PI*d/S42)* xpush(u/20.) * C0);
curvepoint(d2 * xspinpush0(M_PI*d/S42, u/20.));
}
queuecurve((u%5==0) ? gridcolor : lightgrid, 0, PPR_LINE);
}
@ -1501,7 +1501,7 @@ namespace mapeditor {
transmatrix T = rgpushxto0(lstart);
texture::where = lstartcell;
for(int i=0; i<circp; i++)
texture::drawPixel(T * spin(2 * M_PI * i / circp) * xpush(rad) * C0, tcolor);
texture::drawPixel(T * xspinpush0(2 * M_PI * i / circp, rad), tcolor);
lstartcell = NULL;
}
}
@ -1632,7 +1632,7 @@ namespace mapeditor {
if(radius > .1) circp *= 2;
for(int j=0; j<circp; j++)
pts.push_back(Ctr * tC0(spin(M_PI*j*2/circp) * xpush(radius)));
pts.push_back(Ctr * xspinpush0(M_PI*j*2/circp, radius));
for(int j=0; j<circp; j++) curvepoint(pts[j]);
curvepoint(pts[0]);
queuecurve(texture::config.paint_color, 0, PPR_LINE);

View File

@ -2069,7 +2069,7 @@ namespace linepatterns {
if(pseudohept(c) && (p/4 == 10 || p/4 == 8))
for(int i=0; i<S7; i++) if(c->move(i) && emeraldval(c->move(i)) == p-4) {
queuelinef(tC0(V), V*tC0(heptmove[i]), col, 2 + vid.linequality);
queuelinef(tC0(V), V*tC0(spin(-i * ALPHA) * xpush(-hdist/2)), col, 2 + vid.linequality);
queuelinef(tC0(V), V*xspinpush0(-i * ALPHA, -hdist/2), col, 2 + vid.linequality);
}
}
break;

View File

@ -1557,8 +1557,8 @@ void buildpolys() {
bshape(shMovestar, PPR_MOVESTAR);
for(int i=0; i<=8; i++) {
hpcpush(spin(M_PI * i/4) * xpush(crossf) * spin(M_PI * i/4) * C0);
if(i != 8) hpcpush(spin(M_PI * i/4 + M_PI/8) * xpush(crossf/4) * spin(M_PI * i/4 + M_PI/8) * C0);
hpcpush(xspinpush0(M_PI * i/4, crossf));
if(i != 8) hpcpush(xspinpush0(M_PI * i/4 + M_PI/8, crossf/4));
}
// scales
@ -1603,10 +1603,10 @@ void buildpolys() {
if(sphere&&S7==3) trihepta0 *= 1.3, trihepta1 *= 1.6;
if(nonbitrunc) {
ld hedge = hdist(spin(M_PI/S7) * xpush(rhexf) * C0, spin(-M_PI/S7) * xpush(rhexf) * C0);
ld hedge = hdist(xspinpush0(M_PI/S7, rhexf), xspinpush0(-M_PI/S7, rhexf));
trihepta1 = hdist0(xpush(tessf) * spin(2*M_PI*2/S7) * xpush(tessf) * C0) / 2 * .98;
trihepta0 = hdist0(xpush(-tessf) * spin(M_PI/S7) * xpush(rhexf+hedge/2) * C0) * .98;
trihepta1 = hdist0(xpush(tessf) * xspinpush0(2*M_PI*2/S7, tessf)) / 2 * .98;
trihepta0 = hdist0(xpush(-tessf) * xspinpush0(M_PI/S7, rhexf+hedge/2)) * .98;
}
if(binarytiling) hexvdist = rhexf = 1, tessf = 1, gp::scale = 1, scalef = 1, crossf *= .8;
@ -1749,7 +1749,7 @@ void buildpolys() {
bshape(shCross, PPR_WALL);
for(int i=0; i<=84; i+=7)
hpcpush(spin(2*M_PI*i/84) * xpush(zhexf * (i%3 ? 0.8 : 0.3)) * C0);
hpcpush(xspinpush0(2*M_PI*i/84, zhexf * (i%3 ? 0.8 : 0.3)));
// items
@ -1973,16 +1973,16 @@ void buildpolys() {
bshape(shRose, PPR_ITEM);
PRING(t)
hpcpush(spin(M_PI * t / (S42+.0)) * xpush(xcrossf * (0.2 + .15 * sin(M_PI * t / (S42+.0) * 3))) * C0);
hpcpush(xspinpush0(M_PI * t / (S42+.0), xcrossf * (0.2 + .15 * sin(M_PI * t / (S42+.0) * 3))));
bshape(shThorns, PPR_THORNS);
for(int t=0; t<=60; t++)
hpcpush(spin(M_PI * t / 30.0) * xpush(xcrossf * ((t&1) ? 0.3 : 0.6)) * C0);
hpcpush(xspinpush0(M_PI * t / 30.0, xcrossf * ((t&1) ? 0.3 : 0.6)));
for(int i=0; i<16; i++) {
bshape(shParticle[i], PPR_PARTICLE);
for(int t=0; t<6; t++)
hpcpush(spin(M_PI * t * 2 / 6 + M_PI * 2/6 * hrand(100) / 150.) * xpush((0.03 + hrand(100) * 0.0003) * goldbf) * C0);
hpcpush(xspinpush0(M_PI * t * 2 / 6 + M_PI * 2/6 * hrand(100) / 150., (0.03 + hrand(100) * 0.0003) * goldbf));
hpc.push_back(hpc[last->s]);
}

View File

@ -339,7 +339,7 @@ void bantar_frame() {
transmatrix itView = inverse(tView);
transmatrix z = rspintox(itView*C0) * xpush(hdist0(itView*C0) * part) * spintox(itView*C0);
transmatrix ful = rspintox(itView*C0) * xpush(hdist0(itView*C0) * tmax / tmax) * spintox(itView*C0); // rgpushxto0(itView*C0);
hyperpoint C1 = xpush(1) * C0;
hyperpoint C1 = xpush0(1);
ld bof = alphaof(tView * ful * C1);
z = z * spin(bof * part);
View = inverse(z);

View File

@ -811,8 +811,8 @@ namespace levelline {
auto draw = [&] () {
auto vmid = *v1;
queueline(
tC0(T * ddspin(c1,i) * xpush(d2 * (vmid-val1) / (val2-val1))),
tC0(T * ddspin(c1,i-1) * xpush(d3 * (vmid-val1) / (val3-val1))),
(T * ddspin(c1,i) * xpush0(d2 * (vmid-val1) / (val2-val1))),
(T * ddspin(c1,i-1) * xpush0(d3 * (vmid-val1) / (val3-val1))),
l.color, vid.linequality);
};
while(v1 < v2 && v1 < v3) {

View File

@ -22,7 +22,7 @@ ld strafex, strafey;
hyperpoint spcoord(hyperpoint h) {
ld phi = h[0], y = h[1], z = h[2], r = global_r;
dynamicval<eGeometry> gw(geometry, rug::gwhere == gElliptic ? gSphere : rug::gwhere);
hyperpoint inh = xpush(-acurvature*(y + r - frac(progress))/szoom) * spin(M_PI/2) * xpush(acurvature*z) * C0;
hyperpoint inh = xpush(-acurvature*(y + r - frac(progress))/szoom) * xspinpush0(M_PI/2, acurvature*z);
hyperpoint i = inh * (hdist0(inh) / hypot2(inh));
ld aphi = (r+phi + floor(progress))*M_PI/6;
return hpxyz(i[1] * sin(aphi), i[1] * cos(aphi), i[0]);

View File

@ -239,7 +239,7 @@ rugpoint *addRugpoint(hyperpoint h, double dist) {
ld r = acosh(modelscale);
// point on an equdistant going through C0 in distance d along the guiding line
// hpoint = hpxy(cosh(r) * sinh(r) * (cosh(d) - 1), sinh(d) * cosh(r));
hpoint = xpush(r) * ypush(d) * xpush(-r) * C0;
hpoint = xpush(r) * ypush(d) * xpush0(-r);
hpoint[0] = -hpoint[0];
}
@ -683,8 +683,8 @@ bool force(rugpoint& m1, rugpoint& m2, double rd, bool is_anticusp=false, double
throw rug_exception();
}
f1 = iT1 * xpush(d1*forcev) * C0;
f2 = iT1 * xpush(t-d2*forcev) * C0;
f1 = iT1 * xpush0(d1*forcev);
f2 = iT1 * xpush0(t-d2*forcev);
m1.flat = n[f1];
m2.flat = n[f2];
@ -1242,7 +1242,7 @@ void prepareTexture() {
transmatrix V = rgpushxto0(finger_center->h);
queuechr(V, 0.5, 'X', 0xFFFFFFFF, 2);
for(int i=0; i<72; i++)
queueline(tC0(V * spin(i*M_PI/32) * xpush(finger_range)), tC0(V * spin((i+1)*M_PI/32) * xpush(finger_range)), 0xFFFFFFFF, vid.linequality);
queueline(V * xspinpush0(i*M_PI/32, finger_range), V * xspinpush0((i+1)*M_PI/32, finger_range), 0xFFFFFFFF, vid.linequality);
}
drawqueue();
vid = svid;

View File

@ -1319,7 +1319,7 @@ void roseCurrents(transmatrix& nat, monster *m, int delta) {
hyperpoint keytarget(int i) {
double d = 2 + sin(curtime / 350.);
return pc[i]->pat * xpush(d) * C0;
return pc[i]->pat * xpush0(d);
}
/* int charidof(int pid) {
@ -1333,11 +1333,11 @@ double getSwordSize() { return 0.7255; }
double getHornsSize() { return 0.33; }
hyperpoint swordpos(int id, bool rev, double frac) {
return pc[id]->pat * spin(pc[id]->swordangle) * xpush((rev?-frac:frac) * getSwordSize()) * C0;
return pc[id]->pat * xspinpush0(pc[id]->swordangle, (rev?-frac:frac) * getSwordSize());
}
hyperpoint hornpos(int id) {
return pc[id]->pat * tC0(xpush(getHornsSize()));
return pc[id]->pat * xpush0(getHornsSize());
}
#define IGO 9

View File

@ -219,13 +219,13 @@ void prepare() {
ld crmin = 0, crmax = sphere ? M_PI : 10;
for(int q=0; q<100; q++) {
circumradius[i] = (crmin + crmax) / 2;
hyperpoint p1 = xpush(circumradius[i]) * C0;
hyperpoint p1 = xpush0(circumradius[i]);
hyperpoint p2 = spin(2 * M_PI / faces[i]) * p1;
inradius[i] = hdist0(mid(p1, p2));
if(hdist(p1, p2) > edgelength) crmax = circumradius[i];
else crmin = circumradius[i];
}
hyperpoint h = xpush(edgelength/2) * spin(M_PI/2) * xpush(inradius[i]) * C0;
hyperpoint h = xpush(edgelength/2) * xspinpush0(M_PI/2, inradius[i]);
alphas[i] = atan2(-h[1], h[0]);
alpha_total += alphas[i];
}
@ -369,9 +369,9 @@ void create_adjacent(heptagon *h, int d) {
for(int d2=0; d2<p.first->c7->type; d2++) {
auto& t2 = get_triangle(p.first, d2);
transmatrix T1 = T * spin(M_PI + t2.first);
SDEBUG( printf("compare: %s", display(T1 * xpush(1) * C0)); )
SDEBUG( printf(":: %s\n", display(p.second * xpush(1) * C0)); )
if(intval(T1 * xpush(1) * C0, p.second * xpush(1) * C0) < 1e-6) {
SDEBUG( printf("compare: %s", display(T1 * xpush0(1))); )
SDEBUG( printf(":: %s\n", display(p.second * xpush0(1))); )
if(intval(T1 * xpush0(1), p.second * xpush0(1)) < 1e-6) {
connectHeptagons(h, d, heptspin(p.first, d2));
return;
}

View File

@ -1328,7 +1328,7 @@ void filltriangle(const array<hyperpoint, 3>& v, const array<point, 3>& p, int c
void splitseg(const transmatrix& A, const array<ld, 2>& angles, const array<hyperpoint, 2>& h, const array<point, 2>& p, int col, int lev) {
ld newangle = (angles[0] + angles[1]) / 2;
hyperpoint nh = A * spin(newangle) * xpush(penwidth) * C0;
hyperpoint nh = A * xspinpush0(newangle, penwidth);
auto np = ptc(nh);
filltriangle(make_array(h[0],h[1],nh), make_array(p[0],p[1],np), col, lev);
@ -1345,7 +1345,7 @@ void fillcircle(hyperpoint h, int col) {
ld step = M_PI * 2/3;
array<hyperpoint, 3> mh = make_array(A * xpush(penwidth) * C0, A * spin(step) * xpush(penwidth) * C0, A * spin(-step) * xpush(penwidth) * C0);
array<hyperpoint, 3> mh = make_array(A * xpush0(penwidth), A * xspinpush0(step, penwidth), A * xspinpush0(-step, penwidth));
auto mp = ptc(mh);
filltriangle(mh, mp, col, 0);