mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-10 10:25:36 +01:00
fix normales planes
This commit is contained in:
parent
76ec1cd8c8
commit
1237cef4a0
1 changed files with 7 additions and 3 deletions
|
|
@ -537,20 +537,24 @@ TCAD.geom.extrude = function(source, sourceNormal, target, expansionFactor) {
|
|||
poly.push(face);
|
||||
}
|
||||
|
||||
var bottomNormal, topNormal;
|
||||
if (negate) {
|
||||
lid.reverse();
|
||||
bottomNormal = sourceNormal;
|
||||
topNormal = sourceNormal.negate();
|
||||
} else {
|
||||
source = source.slice(0);
|
||||
source.reverse();
|
||||
bottomNormal = sourceNormal.negate();
|
||||
topNormal = sourceNormal;
|
||||
}
|
||||
|
||||
function vecToVertex(v) {
|
||||
return new CSG.Vertex(TCAD.utils.csgVec(v));
|
||||
}
|
||||
|
||||
var negateNormal = sourceNormal.negate();
|
||||
var sourcePlane = new CSG.Plane(negateNormal.csg(), negateNormal.dot(source[0]));
|
||||
var lidPlane = new CSG.Plane(sourceNormal.csg(), sourceNormal.dot(lid[0]));
|
||||
var sourcePlane = new CSG.Plane(bottomNormal.csg(), bottomNormal.dot(source[0]));
|
||||
var lidPlane = new CSG.Plane(topNormal.csg(), topNormal.dot(lid[0]));
|
||||
|
||||
poly[0] = new CSG.Polygon(source.map(vecToVertex), TCAD.utils.createShared(), sourcePlane);
|
||||
poly[1] = new CSG.Polygon(lid.map(vecToVertex), TCAD.utils.createShared(), lidPlane);
|
||||
|
|
|
|||
Loading…
Reference in a new issue