CADViewComponent/dist/Matrix2.js

31 lines
875 B
JavaScript
Raw Permalink Normal View History

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