Files
cut-abstractions/tests/dev1/dataHandle/common/ConvexHull2D.ts
2025-07-22 18:22:31 +08:00

10 lines
273 B
TypeScript

import convexHull from 'monotone-convex-hull-2d'
import type { Point } from '../common/Vector2'
export function ConvexHull2D(points: Point[]): Point[]
{
let pts = points.map(p => [p.x, p.y])
let indexs: number[] = convexHull(pts)
return indexs.map(i => points[i])
}