UNPKG

@allmaps/stdlib

Version:

Allmaps Standard Library

75 lines (74 loc) 6.54 kB
import type { Point, Line, LineString, Triangle, Ring, Polygon, MultiPoint, MultiLineString, MultiPolygon, Geometry, GeojsonPoint, GeojsonLineString, GeojsonPolygon, GeojsonMultiPoint, GeojsonMultiLineString, GeojsonMultiPolygon, GeojsonGeometry, SvgCircle, SvgPolyLine, SvgPolygon, SvgGeometry, Size, MultiGeometryOptions } from '@allmaps/types'; export declare function isPoint(input: unknown): input is Point; export declare function isLineString(input: unknown): input is LineString; export declare function isRing(input: unknown): input is Ring; export declare function isPolygon(input: unknown): input is Polygon; export declare function isMultiPoint(input: unknown): input is MultiPoint; export declare function isMultiLineString(input: unknown): input is MultiLineString; export declare function isMultiPolygon(input: unknown): input is MultiPolygon; export declare function isGeometry(input: unknown): input is Geometry; export declare function closeRing(ring: Ring): Ring; export declare function uncloseRing(ring: Ring): Ring; export declare function closePolygon(polygon: Polygon): Polygon; export declare function unclosePolygon(polygon: Polygon): Polygon; export declare function closeMultiPolygon(multiPolygon: MultiPolygon): MultiPolygon; export declare function uncloseMultiPolygon(multiPolygon: MultiPolygon): MultiPolygon; export declare function conformLineString(lineString: LineString): LineString; export declare function conformRing(ring: Ring): Ring; export declare function conformPolygon(polygon: Polygon): Polygon; export declare function conformMultiLineString(multiLineString: MultiLineString): MultiLineString; export declare function conformMultiPolygon(multiPolygon: MultiPolygon): MultiPolygon; export declare function pointToGeojsonPoint(point: Point): GeojsonPoint; export declare function lineStringToGeojsonLineString(lineString: LineString): GeojsonLineString; export declare function ringToGeojsonPolygon(ring: Ring, close?: boolean): GeojsonPolygon; export declare function polygonToGeojsonPolygon(polygon: Polygon, close?: boolean): GeojsonPolygon; export declare function multiPointToGeojsonMultiPoint(multiPoint: MultiPoint): GeojsonMultiPoint; export declare function multiLineStringToGeojsonMultiLineString(multiLineString: MultiLineString): GeojsonMultiLineString; export declare function multiPolygonToGeojsonMultiPolygon(multiPolygon: MultiPolygon, close?: boolean): GeojsonMultiPolygon; export declare function geometryToGeojsonGeometry(point: Point, options?: Partial<MultiGeometryOptions>): GeojsonPoint; export declare function geometryToGeojsonGeometry(lineString: LineString, options?: Partial<MultiGeometryOptions>): GeojsonLineString; export declare function geometryToGeojsonGeometry(polygon: Polygon, options?: Partial<MultiGeometryOptions>): GeojsonPolygon; export declare function geometryToGeojsonGeometry(multiPoint: MultiPoint, options?: Partial<MultiGeometryOptions>): GeojsonMultiPoint; export declare function geometryToGeojsonGeometry(multiLineString: MultiLineString, options?: Partial<MultiGeometryOptions>): GeojsonMultiLineString; export declare function geometryToGeojsonGeometry(multiPolygon: MultiPolygon, options?: Partial<MultiGeometryOptions>): GeojsonMultiPolygon; export declare function geometryToGeojsonGeometry(geometry: Geometry, options?: Partial<MultiGeometryOptions>): GeojsonGeometry; export declare function pointToSvgCircle(point: Point): SvgCircle; export declare function lineStringToSvgPolyLine(lineString: LineString): SvgPolyLine; export declare function polygonToSvgPolygon(polygon: Polygon): SvgPolygon; export declare function geometryToSvgGeometry(point: Point): SvgCircle; export declare function geometryToSvgGeometry(lineString: LineString): SvgPolyLine; export declare function geometryToSvgGeometry(polygon: Polygon): SvgPolygon; export declare function geometryToSvgGeometry(geometry: Geometry): SvgGeometry; export declare function isClosed(input: Point[]): boolean; export declare function isEqualPoint(point0: Point, point1: Point): boolean; export declare function isEqualPointArray(pointArray0: Point[], pointArray1: Point[]): boolean; export declare function isEqualPointArrayArray(pointArrayArray0: Point[][], pointArrayArray1: Point[][]): boolean; export declare function pointsAndPointsToLines(points0: Point[], points1: Point[]): Line[]; export declare function lineStringToLines(lineString: LineString): Line[]; export declare function pointToPixel(point: Point, translate?: Point): Point; export declare function pixelToIntArrayIndex(pixel: Point, size: Size, channels: number, flipY?: boolean): number; export declare function flipX(point: Point): Point; export declare function flipY(point: Point): Point; export declare function mixNumbers(number0: number, number1: number, t: number): number; export declare function mixPoints(point0: Point, point1: Point, t: number): Point; export declare function mixLineStrings(lineString0: LineString, lineString1: LineString, t: number): LineString; export declare function midPoint(...points: Point[]): Point; export declare function lineAngle(line: Line): number; export declare function stepDistanceAngle(point: Point, dist: number, angle: number): Point; export declare function distance(from: Point, to: Point): number; export declare function squaredDistance(from: Point, to?: Point): number; export declare function rms(from: Point[], to: Point[]): number; export declare function triangleArea(triangle: Triangle): number; export declare function invertPoint(point: Point): Point; export declare function invertPoints(points: Point[]): Point[]; export declare function scalePoint(point: Point, scale: number): Point; export declare function scalePoints(points: Point[], scale: number): Point[]; export declare function translatePoint(point: Point, translationPoint: Point, addOrSubstract?: 'add' | 'substract'): Point; export declare function translatePoints(points: Point[], point: Point, addOrSubstract?: 'add' | 'substract'): Point[]; export declare function rotatePoint(point: Point, angle?: number, anchor?: Point | undefined, cosAngle?: number, sinAngle?: number): Point; export declare function rotatePoints(points: Point[], angle?: number, anchor?: Point | undefined, cosAngle?: number, sinAngle?: number): Point[]; export declare function triangleAngles(triangle: Triangle): [number, number, number]; /** * Return angle alpha made at point A by points B and C */ export declare function threePointsToAngle(pointA: Point, pointB: Point, pointC: Point): number;