UNPKG

@technobuddha/library

Version:
28 lines (27 loc) 1.24 kB
import { type Cartesian, type Polygon, type XY } from './@types/geometry.ts'; import { type OriginOptions } from './angle.ts'; /** * Scales a point around a given origin by a specified amount. * @param point - The point to rotate. * @param amount - The amount to scale the point(s) by. This can be a number (uniform scaling) or a Cartesian object (non-uniform scaling). * @param options - see {@link OriginOptions} * @returns The rotated point. * @example * ```typescript * scale({ x: 1, y: 0 }, 2); // { x: 2, y: 0 } * ``` */ export declare function scale(point: Cartesian, amount: number | XY, options?: OriginOptions): Cartesian; /** * Scales a polygon around a given origin by a specified amount. * @param polygon - The polygon to rotate * @param amount - The amount to scale the point(s) by. This can be a number (uniform scaling) or a Cartesian object (non-uniform scaling). * @param options - see {@link OriginOptions} * @returns The rotated polygon * @example * ```typescript * scale([{ x: 0, y: 0 }, { x: 2, y: 0 }, { x: 1, y: 2}], 2); * // [{ x: 0, y: 0 }, { x: 4, y: 0 }, { x: 2, y: 4 }] * ``` */ export declare function scale(polygon: Polygon, amount: number | XY, options?: OriginOptions): Cartesian[];