Legacy
Mapbox.js is no longer in active development. To learn more about our newer mapping tools see Mapbox GL JS.
Transformation
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.
var transformation = new L.Transformation(2, 5, -1, 10),
p = L.point(1, 2),
p2 = transformation.transform(p), // L.point(7, 8)
p3 = transformation.untransform(p2); // L.point(1, 2)
Creation
Creation | Description |
---|---|
|
Creates a transformation object with the given coefficients. |
Methods
Method | Returns | Description |
---|---|---|
transform(
|
Point |
Returns a transformed point, optionally multiplied by the given scale. Only accepts real L.Point instances, not arrays. |
untransform(
|
Point |
Returns the reverse transformation of the given point, optionally divided by the given scale. Only accepts real L.Point instances, not arrays. |