8각 안나눠지는 현상 작업 추가
This commit is contained in:
parent
9be21fc2b2
commit
3432d64a3c
@ -767,7 +767,7 @@ export const usePolygon = () => {
|
||||
obj.type === 'QLine' &&
|
||||
obj.attributes?.type !== 'pitchSizeLine' &&
|
||||
obj.attributes?.roofId === polygon.id &&
|
||||
(innerLineTypes.includes(obj.name) || !obj.name),
|
||||
innerLineTypes.includes(obj.name),
|
||||
)
|
||||
|
||||
innerLines = [...polygon.innerLines]
|
||||
|
||||
@ -518,14 +518,23 @@ export const sortedPointLessEightPoint = (points) => {
|
||||
*/
|
||||
// 직선의 방정식.
|
||||
// 방정식은 ax + by + c = 0이며, 점의 좌표를 대입하여 계산된 값은 직선과 점 사이의 관계를 나타낸다.
|
||||
export function isPointOnLine(line, point) {
|
||||
const a = line.y2 - line.y1
|
||||
export function isPointOnLine({ x1, y1, x2, y2 }, { x, y }) {
|
||||
/*const a = line.y2 - line.y1
|
||||
const b = line.x1 - line.x2
|
||||
const c = line.x2 * line.y1 - line.x1 * line.y2
|
||||
const result = Math.abs(a * point.x + b * point.y + c) / 100
|
||||
|
||||
// 점이 선 위에 있는지 확인
|
||||
return result <= 10
|
||||
return result <= 10*/
|
||||
// 직선 방정식 만족 여부 확인
|
||||
const crossProduct = (y - y1) * (x2 - x1) - (x - x1) * (y2 - y1)
|
||||
if (Math.abs(crossProduct) > 5) return false // 작은 오차 허용
|
||||
|
||||
// 점이 선분의 범위 내에 있는지 확인
|
||||
const withinXRange = Math.min(x1, x2) <= x && x <= Math.max(x1, x2)
|
||||
const withinYRange = Math.min(y1, y2) <= y && y <= Math.max(y1, y2)
|
||||
|
||||
return withinXRange && withinYRange
|
||||
}
|
||||
/**
|
||||
* 점과 가까운 line 찾기
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user