Merge pull request 'dev' (#192) from dev into prd-deploy
Reviewed-on: #192
This commit is contained in:
commit
71d92f12b8
@ -312,6 +312,22 @@ export function removeDuplicatePolygons(polygons) {
|
||||
|
||||
// 같은 직선상에 있는지 확인 같은 직선이라면 polygon을 생성할 수 없으므로 false
|
||||
const isValidPoints = (points) => {
|
||||
// 연속된 3개 이상의 점이 같은 x 또는 y 값을 가지는지 확인 (원형 배열로 처리)
|
||||
for (let i = 0; i < points.length; i++) {
|
||||
const point1 = points[i]
|
||||
const point2 = points[(i + 1) % points.length]
|
||||
const point3 = points[(i + 2) % points.length]
|
||||
|
||||
// x값이 같은 연속된 3개 점 확인
|
||||
if (point1.x === point2.x && point2.x === point3.x) {
|
||||
return false
|
||||
}
|
||||
// y값이 같은 연속된 3개 점 확인
|
||||
if (point1.y === point2.y && point2.y === point3.y) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function isColinear(p1, p2, p3) {
|
||||
return (p2.x - p1.x) * (p3.y - p1.y) === (p3.x - p1.x) * (p2.y - p1.y)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user