pointing-to-directions now checks for the cell which is the most towards the given direction

This commit is contained in:
Zeno Rogue 2019-08-24 19:03:42 +02:00
parent 96d7496043
commit 50052f27f5
3 changed files with 9 additions and 6 deletions

View File

@ -87,7 +87,9 @@ EX movedir vectodir(hyperpoint P) {
for(int i=0; i<cwt.at->type; i++) { for(int i=0; i<cwt.at->type; i++) {
transmatrix T; transmatrix T;
if(compute_relamatrix((cwt+i).peek(), cwt.at, i, T)) { if(compute_relamatrix((cwt+i).peek(), cwt.at, i, T)) {
dirdist[i] = quickdist(U * T * C0, Centered * P); ld d1 = geo_dist(U * T * C0, Centered * P, iTable);
ld d2 = geo_dist(U * T * C0, Centered * C0, iTable);
dirdist[i] = d1 - d2;
} }
//xspinpush0(-i * 2 * M_PI /cwt.at->type, .5), P); //xspinpush0(-i * 2 * M_PI /cwt.at->type, .5), P);
} }
@ -238,7 +240,7 @@ EX void checkjoy() {
if(sq < joyvalue1) { joydir.d = -1; return; } if(sq < joyvalue1) { joydir.d = -1; return; }
} }
joydir = vectodir(hpxy(jx, jy)); joydir = vectodir(tangent_length(point2(jx, jy), 0.01));
} }
EX void checkpanjoy(double t) { EX void checkpanjoy(double t) {
@ -1074,7 +1076,7 @@ EX bool handleCompass() {
if(h < rad) { if(h < rad) {
if(h < rad*SKIPFAC) movepcto(MD_WAIT); if(h < rad*SKIPFAC) movepcto(MD_WAIT);
else { else {
hyperpoint param = hpxy(dx * 1. / rad, dy * 1. / rad); hyperpoint param = tangent_length(point2(dx, dy), .01);
movedir md = vectodir(param); movedir md = vectodir(param);

View File

@ -7246,9 +7246,10 @@ EX void precise_mouseover() {
if(WDIM == 3) { if(WDIM == 3) {
mouseover2 = mouseover = viewcenter(); mouseover2 = mouseover = viewcenter();
ld best = HUGE_VAL; ld best = HUGE_VAL;
hyperpoint h = direct_exp(lp_iapply(ztangent(1)), 100); hyperpoint h = direct_exp(lp_iapply(ztangent(0.01)), 100);
forCellEx(c1, mouseover2) { forCellEx(c1, mouseover2) {
ld dist = hdist(tC0(ggmatrix(c1)), h); hyperpoint h1 = tC0(ggmatrix(c1));
ld dist = geo_dist(h1, h, iTable) - geo_dist(C0, h1, iTable);
if(dist < best) mouseover = c1, best = dist; if(dist < best) mouseover = c1, best = dist;
} }
return; return;

View File

@ -1118,6 +1118,6 @@ hyperpoint lp_apply(const hyperpoint h) {
return nisot::local_perspective_used() ? nisot::local_perspective * h : h; return nisot::local_perspective_used() ? nisot::local_perspective * h : h;
} }
EX hyperpoint smalltangent() { return xtangent((sphere || hybri) ?.5 : 1); } EX hyperpoint smalltangent() { return xtangent(.1); }
} }