From 907d6c0954d4de1f8652b78e3add8f4d49d35bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 26 Nov 2011 12:04:44 +0100 Subject: [PATCH] Implement Matrix#equals(). --- src/basic/Matrix.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/basic/Matrix.js b/src/basic/Matrix.js index 31704908..1c1cdbe0 100644 --- a/src/basic/Matrix.js +++ b/src/basic/Matrix.js @@ -492,6 +492,17 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{ ? angle1 * 180 / Math.PI : undefined; }, + /** + * Checks whether the two matrices describe the same transformation. + * + * @param {Matrix} matrix the matrix to compare this matrix to + * @return {Boolean} {@true if the matrices are equal} + */ + equals: function(mx) { + return this._a == mx._a && this._b == mx._b && this._c == mx._c + && this._d == mx._d && this._tx == mx._tx && this._ty == mx._ty; + }, + /** * @return {Boolean} Whether this transform is the identity transform */