Add ol.vec.Mat4.equal2D

This commit is contained in:
Tom Payne
2013-11-21 10:03:34 +01:00
parent 760ee7c46f
commit 6872beb88a

View File

@@ -3,6 +3,29 @@ goog.provide('ol.vec.Mat4');
goog.require('goog.vec.Mat4');
/**
* Returns true if mat1 and mat2 represent the same 2D transformation.
* @param {goog.vec.Mat4.AnyType} mat1 Matrix 1.
* @param {goog.vec.Mat4.AnyType} mat2 Matrix 2.
* @return {boolean} Equal 2D.
*/
ol.vec.Mat4.equal2D = function(mat1, mat2) {
return (
goog.vec.Mat4.getElement(mat1, 0, 0) ==
goog.vec.Mat4.getElement(mat2, 0, 0) &&
goog.vec.Mat4.getElement(mat1, 1, 0) ==
goog.vec.Mat4.getElement(mat2, 1, 0) &&
goog.vec.Mat4.getElement(mat1, 0, 1) ==
goog.vec.Mat4.getElement(mat2, 0, 1) &&
goog.vec.Mat4.getElement(mat1, 1, 1) ==
goog.vec.Mat4.getElement(mat2, 1, 1) &&
goog.vec.Mat4.getElement(mat1, 0, 3) ==
goog.vec.Mat4.getElement(mat2, 0, 3) &&
goog.vec.Mat4.getElement(mat1, 1, 3) ==
goog.vec.Mat4.getElement(mat2, 1, 3));
};
/**
* Transforms the given vector with the given matrix storing the resulting,
* transformed vector into resultVec. The input vector is multiplied against the