@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
60 lines • 1.59 kB
TypeScript
import type { MultiFn2 } from "@thi.ng/defmulti";
import type { ReadonlyVec } from "@thi.ng/vectors";
import type { IShape, IShape2, IShape3 } from "./api.js";
import { Circle } from "./api/circle.js";
import { Ellipse } from "./api/ellipse.js";
/**
* Function overrides for {@link scale}.
*/
export type ScaleFn = {
(shape: Circle, factor: number): Circle;
(shape: Circle, factor: ReadonlyVec): Ellipse;
<T extends IShape2>(shape: T, factor: number | ReadonlyVec): T;
<T extends IShape3>(shape: T, factor: number | ReadonlyVec): T;
} & MultiFn2<IShape, number | ReadonlyVec, IShape>;
/**
* Scales given shape uniformly or non-uniformly by given `factor`.
*
* @remarks
* Scaling non-uniformly might result in different result types, e.g.
* {@link Circle} => {@link Ellipse}.
*
* Currently implemented for:
*
* - {@link AABB}
* - {@link Arc}
* - {@link BPatch}
* - {@link Circle}
* - {@link ComplexPolygon}
* - {@link Cubic}
* - {@link Cubic3}
* - {@link Ellipse}
* - {@link Extra} (returns `undefined`)
* - {@link Group}
* - {@link Group3}
* - {@link Line}
* - {@link Line3}
* - {@link Path}
* - {@link Path3}
* - {@link Points}
* - {@link Points3}
* - {@link Polygon}
* - {@link Polygon3}
* - {@link Polyline}
* - {@link Polyline3}
* - {@link Quad}
* - {@link Quad3}
* - {@link Quadratic}
* - {@link Quadratic3}
* - {@link Ray}
* - {@link Ray3}
* - {@link Rect}
* - {@link Sphere}
* - {@link Text}
* - {@link Triangle}
*
* @param shape
* @param factor
*/
export declare const scale: ScaleFn;
//# sourceMappingURL=scale.d.ts.map