dev #192

Merged
ysCha merged 2 commits from dev into prd-deploy 2025-07-08 17:21:03 +09:00
Showing only changes of commit f79d94c1b7 - Show all commits

View File

@ -312,6 +312,25 @@ export function removeDuplicatePolygons(polygons) {
// 같은 직선상에 있는지 확인 같은 직선이라면 polygon을 생성할 수 없으므로 false
const isValidPoints = (points) => {
// x값별로 점들을 그룹화
const xGroups = {}
const yGroups = {}
points.forEach(point => {
if (!xGroups[point.x]) xGroups[point.x] = []
if (!yGroups[point.y]) yGroups[point.y] = []
xGroups[point.x].push(point)
yGroups[point.y].push(point)
})
// 3개 이상 같은 x 또는 y 값을 가지는 점이 있는지 확인
for (const x in xGroups) {
if (xGroups[x].length >= 3) return false
}
for (const y in yGroups) {
if (yGroups[y].length >= 3) return false
}
function isColinear(p1, p2, p3) {
return (p2.x - p1.x) * (p3.y - p1.y) === (p3.x - p1.x) * (p2.y - p1.y)
}