Fix distance filtering

This commit is contained in:
Mark Tolmacs 2024-10-03 11:38:42 +02:00
parent 648728e4b8
commit 85611b8754
No known key found for this signature in database

View file

@ -264,7 +264,7 @@ const intersectRectanguloidWithLine = (
.filter( .filter(
(p, idx, points) => points.findIndex((d) => pointsEqual(p, d)) === idx, (p, idx, points) => points.findIndex((d) => pointsEqual(p, d)) === idx,
) )
.sort((g, h) => pointDistanceSq(g!, b) - pointDistanceSq(h!, b)) .sort((g, h) => pointDistanceSq(g!, a) - pointDistanceSq(h!, a))
); );
}; };
@ -390,7 +390,7 @@ const intersectDiamondWithLine = (
.filter( .filter(
(p, idx, points) => points.findIndex((d) => pointsEqual(p, d)) === idx, (p, idx, points) => points.findIndex((d) => pointsEqual(p, d)) === idx,
) )
.sort((g, h) => pointDistanceSq(g!, b) - pointDistanceSq(h!, b)) .sort((g, h) => pointDistanceSq(g!, a) - pointDistanceSq(h!, a))
); );
}; };
@ -418,5 +418,7 @@ const intersectEllipseWithLine = (
return ellipseLineIntersectionPoints( return ellipseLineIntersectionPoints(
ellipse(center, element.width / 2 + offset, element.height / 2 + offset), ellipse(center, element.width / 2 + offset, element.height / 2 + offset),
line(rotatedA, rotatedB), line(rotatedA, rotatedB),
).map((p) => pointRotateRads(p, center, element.angle)); )
.map((p) => pointRotateRads(p, center, element.angle))
.sort((g, h) => pointDistanceSq(g!, a) - pointDistanceSq(h!, a));
}; };