@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
44 lines • 1.23 kB
TypeScript
import type { Maybe } from "@thi.ng/api";
import type { MultiFn1O } from "@thi.ng/defmulti";
import type { Vec } from "@thi.ng/vectors";
import type { IShape } from "./api.js";
/**
* Computes the unweighted centroid of given shape, writes result in optionally
* provided output vector (or creates new one if omitted).
*
* @remarks
* For vertex based shapes, this computes the simple mean position of the
* vertices. Also see {@link centroidOfBounds}, {@link centerOfWeight}.
*
* Currently implemented for:
*
* - {@link AABB}
* - {@link Arc}
* - {@link BPatch}
* - {@link Circle}
* - {@link ComplexPolygon}
* - {@link Cubic}
* - {@link Ellipse}
* - {@link Extra} (returns `undefined`)
* - {@link Group}
* - {@link Line}
* - {@link Path}
* - {@link Polygon}
* - {@link Polygon3}
* - {@link Polyline}
* - {@link Polyline3}
* - {@link Points}
* - {@link Points3}
* - {@link Quad}
* - {@link Quad3}
* - {@link Quadratic}
* - {@link Quadratic3}
* - {@link Text} (returns position, not considering body or alignment)
* - {@link Triangle}
* - {@link Triangle3}
*
* @param shape
* @param out
*/
export declare const centroid: MultiFn1O<IShape, Vec, Maybe<Vec>>;
//# sourceMappingURL=centroid.d.ts.map