@thi.ng/geom
Version: 
Functional, polymorphic API for 2D geometry types & SVG generation
35 lines • 1.04 kB
TypeScript
import type { MultiFn1O } from "@thi.ng/defmulti";
import type { IShape } from "./api.js";
/**
 * Computes the possibly signed (unsigned by default) surface area of given
 * `shape`. For groups calls itself for each child and returns sum of unsigned
 * areas.
 *
 * @remarks
 * In general, for polygons and triangles, the sign of the result can be used as
 * indication of the shapes orientation (clockwise / counterclockwise).
 *
 * Currently implemented for:
 *
 * - {@link AABB}
 * - {@link Arc} (sector area)
 * - {@link Circle}
 * - {@link ComplexPolygon}
 * - {@link Ellipse}
 * - {@link Group}
 * - {@link Group3}
 * - {@link Path} (closed only & via poly conversion)
 * - {@link Plane} (infinity)
 * - {@link Polygon}
 * - {@link Quad}
 * - {@link Rect}
 * - {@link Sphere}
 * - {@link Triangle}
 *
 * For all other shape types the function returns 0.
 *
 * @param shape - shape to operate on
 * @param signed - true, if signed area
 */
export declare const area: MultiFn1O<IShape, boolean, number>;
//# sourceMappingURL=area.d.ts.map