UNPKG

@sheetxl/models

Version:

Models - A Headless javascript spreadsheet library.

79 lines 2.79 kB
import { Point, Size, Bounds } from "@sheetxl/common"; export declare const lineLength: (x1: number, y1: number, x2: number, y2: number) => number; export declare const rotatePoint: (x: number, y: number, deg: number) => Point; /** * Points are return tl, tr, br, bl * @param bounds * @returns */ export declare const boundsToPoints: (bounds: Bounds) => Point[]; export declare const minBoundingRect: (points: Point[]) => Bounds; export declare const centerPoint: (bounds: Bounds) => Point; export declare const translatePoints: (points: Point[], translate: Point) => Point[]; /** * Rotate all points around * @param points * @param deg * @returns */ export declare const rotatePoints: (points: Point[], deg: number, center?: Point) => Point[]; export declare const rotateBounds2: (bounds: Bounds, rotation: number) => Bounds; export declare const rotateBounds: (bounds: Bounds, deg: number) => Bounds; export declare const intersectBounds: (a: Bounds, b: Bounds) => Bounds; export declare const unionBounds: (a: Bounds, b: Bounds) => { x: number; y: number; width: number; height: number; }; /** * This will find the intersection point of two lines or false if they don't intersect. * This optionally takes a finiteLine flag. If this is set to false then * two line segments that would virtual intersect if extended to infinity will also return a point. * * @credit by Paul Bourke http://paulbourke.net/geometry/pointlineplane/ */ export declare const intersect: (x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, finiteLine?: boolean) => Point | false; export interface Line { p1: Point; p2: Point; } export declare const intersectLines: (a: Line, b: Line, checkSegment?: boolean) => Point | false; export declare const pointsToEdges: (points: Point[]) => { top: { p1: Point; p2: Point; }; left: { p1: Point; p2: Point; }; right: { p1: Point; p2: Point; }; bottom: { p1: Point; p2: Point; }; }; export declare const perpendicularLine: (line: Line, point: Point) => Line; /** * Takes an an inner un-rotated dimension and an outer un-rotated dimension and then will return * an un-rotated rectangle that if rotated will fit inside the outer rectangle. * @remarks * * If the rectangle */ export declare const clipToOuterRect: (sizeInner: Size, sizeOuter: Size, rotation?: number) => Size; export declare const findIntersectMath: (p1: Point, p2: Point, min: number, max: number) => { min: number; max: number; }; export declare const angleToPoints: (angleDeg: number, rectBounds: Bounds) => { x1: number; y1: number; x2: number; y2: number; }; //# sourceMappingURL=GeomUtils.d.ts.map