removed the tohex parameter

This commit is contained in:
Zeno Rogue 2019-11-14 19:33:55 +01:00
parent decd30164d
commit 012d833f50
8 changed files with 22 additions and 21 deletions

View File

@ -1107,7 +1107,7 @@ EX vector<cell*> build_shortest_path(cell *c1, cell *c2) {
ld step = hdist0(h) / steps;
for(int i=0; i< steps; i++) {
T1 = T1 * xpush(step);
virtualRebase(x, T1, true);
virtualRebase(x, T1);
println(hlog, "x = ", x, "p length = ", isize(p), " dist = ", hdist0(tC0(T1)), " dist from end = ", hdist(tC0(T1), tC0(calc_relative_matrix(c2, x, C0))));
while(x != p.back()) {
forCellCM(c, p.back())

View File

@ -243,12 +243,13 @@ void virtualRebase_cell(cell*& base, T& at, const U& check) {
}
template<class T, class U>
void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
void virtualRebase(cell*& base, T& at, const U& check) {
if(prod) {
auto w = hybrid::get_where(base);
auto d = product_decompose(check(at)).first;
at = mscale(at, -d);
hybrid::in_underlying_map([&] { virtualRebase(w.first, at, tohex, check); });
hybrid::in_underlying_map([&] { virtualRebase(w.first, at, check); });
if(d > cgi.plevel / 2) { w.second++; d -= cgi.plevel; }
if(d < -cgi.plevel / 2) { w.second--; d += cgi.plevel; }
at = mscale(at, +d);
@ -283,13 +284,13 @@ void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
virtualRebase_cell(base, at, check);
}
EX void virtualRebase(cell*& base, transmatrix& at, bool tohex) {
virtualRebase(base, at, tohex, tC0);
EX void virtualRebase(cell*& base, transmatrix& at) {
virtualRebase(base, at, tC0);
}
EX void virtualRebase(cell*& base, hyperpoint& h, bool tohex) {
EX void virtualRebase(cell*& base, hyperpoint& h) {
// we perform fixing in check, so that it works with larger range
virtualRebase(base, h, tohex, [] (const hyperpoint& h) {
virtualRebase(base, h, [] (const hyperpoint& h) {
if(hyperbolic && GDIM == 2) return hpxy(h[0], h[1]);
if(hyperbolic && GDIM == 3) return hpxy3(h[0], h[1], h[2]);
return h;

View File

@ -4226,7 +4226,7 @@ EX ld wall_radar(cell *c, transmatrix T, transmatrix LPe, ld max) {
ld fixed_yshift = 0;
for(int i=0; i<20; i++) {
T = parallel_transport(T, ori, ztangent(-step));
virtualRebase(c, T, true);
virtualRebase(c, T);
color_t col;
if(isWall3(c, col) || (WDIM == 2 && GDIM == 3 && tC0(T)[2] > cgi.FLOOR)) {
T = parallel_transport(T, ori, ztangent(step));

View File

@ -1435,7 +1435,7 @@ EX void optimizeview() {
if(dual::split(optimizeview)) return;
transmatrix iView = inverse(View);
virtualRebase(centerover, iView, true);
virtualRebase(centerover, iView);
View = inverse(iView);
println(hlog, "centerover = ", centerover);

View File

@ -125,7 +125,7 @@ void set_relmatrices(cellinfo& ci) {
void rebase(cellinfo& ci) {
cell *cx = ci.owner;
virtualRebase(ci.owner, ci.p, false);
virtualRebase(ci.owner, ci.p);
if(ci.owner != cx) {
printf("rebased %p to %p\n", cx, ci.owner);
set_relmatrices(ci);
@ -173,7 +173,7 @@ void bitruncate() {
s.neid.push_back(next);
s.neid.push_back(-1);
s.generation = bitruncations_performed + 1;
virtualRebase(s.owner, s.p, false);
virtualRebase(s.owner, s.p);
set_relmatrices(s);
}
}

View File

@ -579,21 +579,21 @@ EX void generate_track() {
if(WDIM == 2 && !bounded_track) for(a=0; a<10; a += .1) {
hyperpoint h = straight * parabolic1(a) * C0;
cell *at = s;
virtualRebase(at, h, true);
virtualRebase(at, h);
if(!rti_id.count(at) || get_info(at).from_track >= TWIDTH) break;
}
if(WDIM == 2 && !bounded_track) for(ld cleaner=0; cleaner<a*.75; cleaner += .2) for(int dir=-1; dir<=1; dir+=2) {
transmatrix T = straight * parabolic1(cleaner * dir);
cell *at = s;
virtualRebase(at, T, true);
virtualRebase(at, T);
get_info(at).from_start = 0;
for(ld u=0; u<50; u++) {
if(at->wall != waBarrier)
makeEmpty(at);
killMonster(at, moNone, 0);
T = T * xpush(.1);
virtualRebase(at, T, true);
virtualRebase(at, T);
}
}
@ -623,7 +623,7 @@ EX void generate_track() {
for(const transmatrix& t: forbidden) if(hdist(t*C0, who->at * C0) < 10. / (j+10)) ok = false;
if(ok) break;
}
virtualRebase(who, true);
virtualRebase(who);
}
if(bounded_track) track.back()->wall = waCloud;

View File

@ -820,7 +820,7 @@ EX void cast() {
if(nonisotropic) T = NLP * T;
T = inverse(T);
virtualRebase(cs, T, true);
virtualRebase(cs, T);
if(true) {
manual_celllister cl;

View File

@ -151,7 +151,7 @@ cell *monster::findbase(const transmatrix& T, int maxsteps) {
if(isVirtual) {
cell *c = base;
auto cT = T;
virtualRebase(c, cT, true);
virtualRebase(c, cT);
return c;
}
else return findbaseAround(T, base, maxsteps);
@ -169,14 +169,14 @@ void fix_to_2(transmatrix& T) {
void monster::rebasePat(const transmatrix& new_pat, cell *c2) {
if(isVirtual) {
at = new_pat;
virtualRebase(this, true);
virtualRebase(this);
fix_to_2(at);
pat = at;
return;
}
if(quotient) {
at = inverse(gmatrix[base]) * new_pat;
virtualRebase(this, true);
virtualRebase(this);
fix_to_2(at);
if(base != c2) {
auto T = calc_relative_matrix(c2, base, tC0(at));
@ -2812,8 +2812,8 @@ EX void destroyBoats(cell *c) {
m->inBoat = false;
}
EX void virtualRebase(shmup::monster *m, bool tohex) {
virtualRebase(m->base, m->at, tohex);
EX void virtualRebase(shmup::monster *m) {
virtualRebase(m->base, m->at);
}
EX hookset<bool(shmup::monster*, string&)> *hooks_describe;