Use matrix inversion to calculate pixel to coordinate matrix

This commit is contained in:
Tom Payne
2012-08-14 09:37:48 +02:00
parent 477dc0b92b
commit dafbd503a5

View File

@@ -976,26 +976,9 @@ ol.Map.prototype.updateMatrices_ = function() {
-center.y,
0);
goog.vec.Mat4.makeIdentity(this.pixelToCoordinateMatrix_);
goog.vec.Mat4.translate(this.pixelToCoordinateMatrix_,
center.x,
center.y,
0);
if (this.canRotate() && goog.isDef(rotation)) {
goog.vec.Mat4.rotate(this.coordinateToPixelMatrix_,
-rotation,
0,
0,
1);
}
goog.vec.Mat4.scale(this.pixelToCoordinateMatrix_,
resolution,
-resolution,
1);
goog.vec.Mat4.translate(this.pixelToCoordinateMatrix_,
-size.width / 2,
-size.height / 2,
0);
var inverted = goog.vec.Mat4.invert(
this.coordinateToPixelMatrix_, this.pixelToCoordinateMatrix_);
goog.asserts.assert(inverted);
this.matriciesDirty_ = false;