2018-05-28 09:49:45 +08:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2018-06-06 17:23:22 +08:00
|
|
|
var Matrix2 = /** @class */ (function () {
|
|
|
|
function Matrix2() {
|
2018-05-28 09:49:45 +08:00
|
|
|
this.el = [1, 0, 0, 1];
|
|
|
|
}
|
2018-06-06 17:23:22 +08:00
|
|
|
Matrix2.prototype.set = function (n11, n12, n21, n22) {
|
|
|
|
var te = this.el;
|
2018-05-28 09:49:45 +08:00
|
|
|
te[0] = n11;
|
|
|
|
te[1] = n21;
|
|
|
|
te[2] = n12;
|
|
|
|
te[3] = n22;
|
|
|
|
return this;
|
2018-06-06 17:23:22 +08:00
|
|
|
};
|
|
|
|
Matrix2.prototype.applyVector = function (vec) {
|
|
|
|
var x = vec.x, y = vec.y;
|
|
|
|
var e = this.el;
|
2018-05-28 09:49:45 +08:00
|
|
|
vec.x = e[0] * x + e[2] * y;
|
|
|
|
vec.y = e[1] * x + e[3] * y;
|
|
|
|
return this;
|
2018-06-06 17:23:22 +08:00
|
|
|
};
|
|
|
|
Matrix2.prototype.setRotate = function (theta) {
|
|
|
|
var el = this.el;
|
|
|
|
var c = Math.cos(theta), s = Math.sin(theta);
|
2018-05-28 09:49:45 +08:00
|
|
|
this.set(c, -s, s, c);
|
|
|
|
return this;
|
2018-06-06 17:23:22 +08:00
|
|
|
};
|
|
|
|
return Matrix2;
|
|
|
|
}());
|
2018-05-28 09:49:45 +08:00
|
|
|
exports.Matrix2 = Matrix2;
|
|
|
|
//# sourceMappingURL=Matrix2.js.map
|