2 * L.Transformation is an utility class to perform simple point transformations through a 2d-matrix.
5 L
.Transformation
= L
.Class
.extend({
6 initialize: function(/*Number*/ a
, /*Number*/ b
, /*Number*/ c
, /*Number*/ d
) {
13 transform: function(point
, scale
) {
14 return this._transform(point
.clone(), scale
);
17 // destructive transform (faster)
18 _transform: function(/*Point*/ point
, /*Number*/ scale
) /*-> Point*/ {
20 point
.x
= scale
* (this._a
* point
.x
+ this._b
);
21 point
.y
= scale
* (this._c
* point
.y
+ this._d
);
25 untransform: function(/*Point*/ point
, /*Number*/ scale
) /*-> Point*/ {
28 (point
.x
/scale - this._b) / this._a
,
29 (point
.y
/scale - this._d) / this._c
);