From cb37bb15a9797dc325badda2a930210a369cff48 Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Wed, 2 Dec 2015 21:40:29 -0800 Subject: [PATCH] fix plane bugs --- web/app/engine.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/app/engine.js b/web/app/engine.js index d570d379..80318fcb 100644 --- a/web/app/engine.js +++ b/web/app/engine.js @@ -164,15 +164,18 @@ TCAD.utils.createPlane = function(basis, depth) { var plane = new TCAD.Solid(CSG.fromPolygons([polygon]), material, 'PLANE'); plane.wireframeGroup.visible = false; plane.mergeable = false; + var _3d = tr.invert(); function setBounds(bbox) { var corner = new TCAD.Vector(bbox.minX, bbox.minY, 0); var size = new TCAD.Vector(bbox.width(), bbox.height(), 1); - tr.invert()._apply(size); - tr.invert()._apply(corner); + _3d._apply(size); + _3d._apply(corner); plane.mesh.scale.set(size.x, size.y, size.z); plane.mesh.position.set(corner.x, corner.y, corner.z); currentBounds = bbox; + var poly = new CSG.Polygon(bbox.toPolygon().map(function(p){return new CSG.Vertex(TCAD.utils.csgVec( _3d._apply(p) ))}), shared); + plane.csg = CSG.fromPolygons([poly]); } var bb = new TCAD.BBox(); bb.checkBounds(-400, -400);