@thi.ng/geom-poly-utils
Version:
2D polygon/polyline analysis & processing utilities
26 lines • 977 B
TypeScript
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
/**
* Computes center of weight for given simple polygon defined by `points`.
* Writes result to `out` (or creates a new vector if needed).
*
* @param points
* @param out
*/
export declare const centerOfWeight2: (points: ReadonlyVec[], out?: Vec) => Vec<number>;
/**
* Computes center of weight for given complex polygon defined by multiple
* simple polygons, i.e. `boundary` points and zero or more child polygons
* (interpreted to be holes fully contained within the boundary). Writes result
* to `out` (or creates a new vector if needed).
*
* @remarks
* Reference: https://math.stackexchange.com/a/623849
*
* Centroid formula: ((Aout * Cout) - (Ain * Cin)) / (Aout - Ain)
*
* @param boundary
* @param children
* @param out
*/
export declare const complexCenterOfWeight2: (boundary: ReadonlyVec[], children: ReadonlyVec[][], out?: Vec) => Vec<number>;
//# sourceMappingURL=center-of-weight.d.ts.map