range 계산 수정
This commit is contained in:
parent
f48a8b31d3
commit
f4ba3058c7
@ -536,8 +536,8 @@ export function isPointOnLine({ x1, y1, x2, y2 }, { x, y }, epsilon = 2) {
|
|||||||
if (Math.abs(crossProduct) > 1000) return false // 작은 오차 허용
|
if (Math.abs(crossProduct) > 1000) return false // 작은 오차 허용
|
||||||
|
|
||||||
// 점이 선분의 범위 내에 있는지 확인
|
// 점이 선분의 범위 내에 있는지 확인
|
||||||
const withinXRange = Math.abs(Math.min(x1, x2) - x) <= 2 || 2 <= Math.abs(Math.max(x1, x2) - x)
|
const withinXRange = Math.min(x1, x2) - x <= 2 && 2 <= Math.max(x1, x2) - x
|
||||||
const withinYRange = Math.abs(Math.min(y1, y2) - y) <= 2 || 2 <= Math.abs(Math.max(y1, y2) - y)
|
const withinYRange = Math.min(y1, y2) - y <= 2 && 2 <= Math.max(y1, y2) - y
|
||||||
|
|
||||||
return withinXRange && withinYRange
|
return withinXRange && withinYRange
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user