오차 적용

This commit is contained in:
hyojun.choi 2025-05-09 16:52:04 +09:00
parent d54103943d
commit 553cbd44db

View File

@ -360,16 +360,16 @@ export const calculateIntersection = (line1, line2) => {
// Check if the intersection X and Y are within the range of both lines // Check if the intersection X and Y are within the range of both lines
if ( if (
result[0] >= line1MinX && result[0] >= line1MinX - 1 &&
result[0] <= line1MaxX && result[0] <= line1MaxX + 1 &&
result[0] >= line2MinX && result[0] >= line2MinX - 1 &&
result[0] <= line2MaxX && result[0] <= line2MaxX + 1 &&
result[1] >= line1MinY && result[1] >= line1MinY - 1 &&
result[1] <= line1MaxY && result[1] <= line1MaxY + 1 &&
result[1] >= line2MinY && result[1] >= line2MinY - 1 &&
result[1] <= line2MaxY result[1] <= line2MaxY + 1
) { ) {
return { x: Math.round(result[0]), y: Math.round(result[1]) } return { x: result[0], y: result[1] }
} else { } else {
return null // Intersection is out of range return null // Intersection is out of range
} }