leaflet
Version:
JavaScript library for mobile-friendly interactive maps
41 lines (40 loc) • 1.41 kB
TypeScript
import { Point } from './Point.js';
/**
* Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d` for transforming a point of a
* form `(x, y)` into `(a*x + b, c*y + d)` and doing the reverse. Used by Leaflet in its projections code.
*
* @example
* ```js
* const transformation = new Transformation(2, 5, -1, 10),
* p = new Point(1, 2),
* p2 = transformation.transform(p), // new Point(7, 8)
* p3 = transformation.untransform(p2); // new Point(1, 2)
* ```
*/
export declare class Transformation {
_a: number;
_b: number;
_c: number;
_d: number;
constructor(a: number, b: number, c: number, d: number);
constructor(coefficients: [number, number, number, number]);
/**
* Returns a transformed point, optionally multiplied by the given
* scale. Only accepts actual `Point` instances, not arrays.
* @param {Point} point
* @param {number} [scale]
*/
transform(point: Point, scale?: number): Point;
/**
* @param {Point} point
* @param {number} [scale]
*/
_transform(point: Point, scale?: number): Point;
/**
* Returns the reverse transformation of the given point, optionally divided
* by the given scale. Only accepts actual `Point` instances, not arrays.
* @param {Point} point
* @param {number} [scale]
*/
untransform(point: Point, scale?: number): Point;
}