오차 적용
This commit is contained in:
parent
d54103943d
commit
553cbd44db
@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user