taking into account coordinate system direction for surface inverting

This commit is contained in:
Val Erastov 2018-09-27 23:16:17 -07:00
parent 163022b427
commit e6e4cc0402
2 changed files with 19 additions and 0 deletions

View file

@ -25,6 +25,10 @@ export default class BBox {
this.checkBounds(p.x, p.y, p.z);
}
checkData([x, y, z]) {
this.checkBounds(x, y, z);
}
center() {
return new Vector(this.minX + (this.maxX - this.minX) / 2,
this.minY + (this.maxY - this.minY) / 2,

View file

@ -190,6 +190,21 @@ Matrix3.prototype.__apply = function(vector, out) {
return out;
};
Matrix3.prototype.apply3 = function(data) {
return this.__apply3(data, [])
};
Matrix3.prototype._apply3 = function(data) {
return this.__apply3(data, data);
};
Matrix3.prototype.__apply3 = function([x, y, z], out) {
out[0] = this.mxx * x + this.mxy * y + this.mxz * z + this.tx;
out[1] = this.myx * x + this.myy * y + this.myz * z + this.ty;
out[2] = this.mzx * x + this.mzy * y + this.mzz * z + this.tz;
return out;
};
Matrix3.rotateMatrix = function(angle, axis, pivot) {
var sin = Math.sin(angle);
var cos = Math.cos(angle);