Skip to content

Commit c1f6bd7

Browse files
authored
Update BuildingShapeUtils.js
1 parent a96ae8a commit c1f6bd7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/extras/BuildingShapeUtils.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,13 @@ class BuildingShapeUtils extends ShapeUtils {
362362
if (vec.x === point[0] && vec.y === point[1]) {
363363
return true;
364364
}
365-
if ((vec.x >= point[0] || nextvec.x >= point[0]) && (vec.y >= point[1] !== nextvec.y >= point[1])) {
365+
const slope = (nextvec.y - vec.y) / (nextvec.x - vec.x);
366+
const intercept = v.y / slope / v.x;
367+
const intersection = (point[1] - intercept) / slope;
368+
if (intersection > point[0]) {
366369
count++;
370+
} else if (intersection == point[0]) {
371+
return true;
367372
}
368373
}
369374
return count % 2 === 1;

0 commit comments

Comments
 (0)