1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 22:39:53 +00:00

fixed a bug with centerin

This commit is contained in:
Zeno Rogue 2018-09-07 17:28:55 +02:00
parent 093022b3ec
commit 6f3fcb2694

View File

@ -1506,14 +1506,14 @@ void finishshape() {
if(s == 3) if(s == 3)
last->intester = hpxy(.2, .2518); last->intester = hpxy(.2, .2518);
last->flags &=~ POLY_BADCENTERIN; last->flags &=~ (POLY_BADCENTERIN | POLY_CENTERIN);
for(int i=last->s; i<last->e-1; i++) { for(int i=last->s; i<last->e-1; i++) {
ld x1 = hpc[i][0] - last->intester[0], y1 = hpc[i][1] - last->intester[1], x2 = hpc[i+1][0] - last->intester[0], y2 = hpc[i+1][1] - last->intester[1]; ld x1 = hpc[i][0] - last->intester[0], y1 = hpc[i][1] - last->intester[1], x2 = hpc[i+1][0] - last->intester[0], y2 = hpc[i+1][1] - last->intester[1];
if(asign(y1, y2)) { if(asign(y1, y2)) {
ld x = xcross(x1, y1, x2, y2); ld x = xcross(x1, y1, x2, y2);
if(abs(x) < 1e-3 && !(last->flags & POLY_ISSIDE)) { if(abs(x) < 1e-3 && !(last->flags & POLY_ISSIDE)) {
printf("close call [%d], x = %lf\n", s, x); if(s >= 2) printf("close call [%d], x = %lf\n", s, x);
last->flags |= POLY_BADCENTERIN; last->flags |= POLY_BADCENTERIN;
} }
if(x < 0) last->flags ^= POLY_CENTERIN; if(x < 0) last->flags ^= POLY_CENTERIN;