@thi.ng/geom-poly-utils
Version:
2D polygon/polyline analysis & processing utilities
26 lines • 759 B
TypeScript
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
/**
* Performs naive polygon offsetting, i.e. moving vertices along their bisectors
* by given `dist`.
*
* @remakrs
* If `points` are in CCW order (assuming Y-up), a positive `dist` will offset
* outward, and `dist` negative will inset.
*
* @example
* ```ts tangle:../export/offset-convex.ts
* import { offsetConvex } from "@thi.ng/geom-poly-utils";
*
* console.log(offsetConvex([[0,0], [100,0], [50,100]], 5));
* // [
* // [ -4.253, -2.629 ],
* // [ 104.286, -2.575 ],
* // [ 49.999, 104.999 ]
* // ]
* ```
*
* @param points
* @param dist
*/
export declare const offsetConvex: (points: ReadonlyVec[], dist: number) => Vec<number>[];
//# sourceMappingURL=offset-convex.d.ts.map