About polygons winding
-
Hello, as winding reversal for polygons having a negative area works in v2, I tried to do the same on the V1 scripts that I have on my website, but it isn't that easy.

I have a polyhedron with polygons having positive and negative areas, when reverse negative areas polygons, and display the volume, it has lots of missing faces , and surprisingly if I negate all polygons, it is correctly displayed. Maybe is my measureArea function wrong ? I took if from csg.js and adapt it ( vertices.. [0] changes to vertices... .pos.x and so on). Seems that I'd better start to change my website to V2.
-
@gilboonet interesting.
are the set of points and triangles always the same? V1 version versus V2 version?
-
@gilboonet there's a slight difference in the polyhedron() function of V1 versus V2.
in V1, the global polyhedron() function expects polygons which have the normals facing 'inward', which is the OpenSCAD convention.
in V2, the polyhedron() function can accept either 'outward' or 'inward' facing polygons. By default the polygons are expected to face 'outward'.
const shape = polyhedron({orientation: 'outward', points: vertices, ...})Is this the issue?
-
@z3dev I'm making some tests, apparently, with V1 specifying orientation doesn't correct the issue. With two differents obj files, I tried 4 kinds of polyhedron :
- orientation 'inward', faces order unchanged
- orientation 'outward', faces order unchanged
- orientation 'inward', faces order reversed
- orientation 'outward', faces order reversed
and the only ones that work (visually) are those with faces order reversed. I will try to do some CSG on them to see it deeper. And I will do the same with v2 asap, one thing I can say about v2 is that it measureArea returns 0 for 3d polygons, and work than I make them 2d.

-
@z3dev The same data applied to V2 gives the same results, the visually correct polyhedra are those having faces order reversed.

-
@gilboonet thanks for investigating further.
There may be some issues with the OBJ deserializer. Can you attach the OBJ files?
I'd like to make sure this functionality is working well at least. -
@z3dev Indeed, for those examples I didn't use serializer but import data from obj files exported to .jscad format by Wings 3d. When imported on V2 using require (I suppose that's the way to use serializer), it's visually correct. I will try to do some csg to see if it ok. Anyway, here are the files.
https://github.com/gilboonet/gilboonet.github.io/blob/master/demos/objs.zip -
I'm trying now csg on a .obj file imported (require) into V2. It works fine with an intersect, but when I try to make lots of intersect, the return statement has errors.

On my example, height is 104 units, I can return a slice every 3 units, but when I try to return a slice every 2 units (and my real process needs smaller slices) it bugs :elapse for solid generation: 39 design.js
total time for design regeneration 7015 17 design.js
Uncaught (in promise) TypeError: a is undefined (2 times)
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