feat:提交
This commit is contained in:
9
tests/dev1/dataHandle/common/ConvexHull2D.ts
Normal file
9
tests/dev1/dataHandle/common/ConvexHull2D.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
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])
|
||||
}
|
Reference in New Issue
Block a user