Legacy

Mapbox.js is no longer in active development. To learn more about our newer mapping tools see Mapbox GL JS.

You are viewing an older version of Mapbox.js. Check out v3.3.1 for the latest.

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
new L.Transformation( <Number> a, <Number> b, <Number> c, <Number> d ) Creates a transformation object with the given coefficients.

Methods

Method Returns Description
transform( <Point> point, <Number> scale? ) Point Returns a transformed point, optionally multiplied by the given scale. Only accepts real L.Point instances, not arrays.
untransform( <Point> point, <Number> scale? ) Point Returns the reverse transformation of the given point, optionally divided by the given scale. Only accepts real L.Point instances, not arrays.