모든 점이 같은 직선상일 경우 제거

This commit is contained in:
hyojun.choi 2025-07-30 16:37:42 +09:00
parent f82a355f01
commit 31751c26b9

View File

@ -311,8 +311,6 @@ export function removeDuplicatePolygons(polygons, hasAuxiliaryLine = false) {
// return isValidPoints(polygon)
// })
console.log('uniquePolygons2', uniquePolygons)
return uniquePolygons
}
@ -373,6 +371,14 @@ function checkPolygonSelfIntersection(coordinates) {
}
}
// 모든 점이 같은 직선상에 있는지 검사 (degenerate polygon)
const allSameX = coordinates.every((point) => point.x === coordinates[0].x)
const allSameY = coordinates.every((point) => point.y === coordinates[0].y)
if (allSameX || allSameY) {
return true // 직선상의 점들은 유효하지 않은 다각형이므로 true 반환
}
const intersections = []
const edges = []