@thi.ng/geom-clip-poly
Version:
2D polygon clipping / offsetting (Sutherland-Hodgeman, Grainer-Hormann)
15 lines • 651 B
TypeScript
import type { ReadonlyVec } from "@thi.ng/vectors";
/**
* Extended version of Sutherland-Hodgeman convex polygon clipping supporting
* any convex boundary polygon (not only rects). Returns new array of clipped
* vertices.
*
* https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm
*
* @param pts - subject poly vertices
* @param bounds - clipping boundary vertices
* @param bc - pre-computed boundary centroid
* @param eps - edge classification tolerance
*/
export declare const sutherlandHodgeman: (pts: ReadonlyVec[], bounds: ReadonlyVec[], bc?: ReadonlyVec, eps?: number) => ReadonlyVec[];
//# sourceMappingURL=index.d.ts.map