finishes rotation

This commit is contained in:
Steve Ruiz 2021-05-18 09:32:20 +01:00
parent e2aac4b267
commit 1ece606db0
18 changed files with 353 additions and 198 deletions

View file

@ -342,3 +342,21 @@ export function intersectPolylineBounds(points: number[][], bounds: Bounds) {
return intersections
}
export function intersectPolygonBounds(points: number[][], bounds: Bounds) {
const { minX, minY, width, height } = bounds
const intersections: Intersection[] = []
for (let i = 1; i < points.length + 1; i++) {
intersections.push(
...intersectRectangleLineSegment(
[minX, minY],
[width, height],
points[i - 1],
points[i % points.length]
)
)
}
return intersections
}