Non manifold geometry with polyhedron
-
I'm trying to generate threads and I'm there for the most part. As soon as I do any boolean operations with other geometries I end up with non-manifold geometries. I'm assuming that I am either misunderstanding how to use polyhedron() or I'm defining its polygons wrong. Does anybody know what I can do?
function main() {
const r = 10;
const fn = 32;
const h = 10;numSegments = (h+1)*fn;
const points = seq(numSegments+1).flatMap( i => threadTriangle(r,360/fn*i,i/fn-1) );
const closeFirst = [0,1,2];
const segments = seq(numSegments).flatMap( i => {
const m = i*3;
return [
[0,3,4,1].map(x => x+m),
[1,4,5,2].map(x => x+m),
[2,5,3,0].map(x => x+m)
];
})
const closeLast = [
points.length-1,
points.length-2,
points.length-3,
];const threadPoly = polyhedron({
points,
polygons: [ closeFirst, ...segments, closeLast ]
});const threadPolyTrimmed = intersection(
threadPoly,
cylinder({r:r+0.5,h,fn})
);return union(
threadPolyTrimmed,
cylinder({r:r,h,fn})
);}
function threadTriangle(r,a,z) {
const rad = a * Math.PI/180;
const x1 = r * Math.cos(rad);
const y1 = r * Math.sin(rad);const x2 = (r+0.475) * Math.cos(rad);
const y2 = (r+0.475) * Math.sin(rad);return [[x1,y1,z],[x1,y1,0.95+z],[x2,y2,0.5+z]];
}function seq(length) {
return Array.apply(null, {length}).map(Function.call, Number);
} -
I double checked my polygons and they are all clockwise if you are facing them.
-
It's completely fine until I operate on it with any other geometry.

-
Nevermind, I fixed everything simply by using triangles instead of polygons.
-
This post is deleted!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login