Polyhedron rendering with missing faces

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Polyhedron rendering with missing faces

matt_391
Hi All

I'm new to OpenSCAD, so apologies if this is a rookie error or a know issue,
but I haven't been able to find any references to searching the forum or
github bug tracker. I'm posting here to try and find out if this is a true
bug or if I'm making a mistake!

My issue is that a polyhedron will often render missing some faces; consider
the following minimal example (screenshot of my result at the bottom):

polyhedron( points = [[0,0,0] , [10,0,0] , [0,10,0] , [0,0,10]] , faces =
[[0,1,2],[0,1,3],[0,2,3],[1,2,3]]);
translate([20,0,0]) cube(5);

Note that if I render the polyhedron without the cube afterward (i.e. just
the first line), it renders correctly. My workaround has been two wrap the
polyhedron in a  "hull", but this seems dangerous; what if a more complex
polyhedron fails such that one of the vertices has no faces meeting it? It
would get miss off the hull, I suspect.

Thanks in advance for any help or advice.

screenshot:
<http://forum.openscad.org/file/t2415/screenshot.png>



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Polyhedron rendering with missing faces

cacb
On 2018-11-30 15:09, matt_391 wrote:
> polyhedron( points = [[0,0,0] , [10,0,0] , [0,10,0] , [0,0,10]] , faces
> =
> [[0,1,2],[0,1,3],[0,2,3],[1,2,3]]);
> translate([20,0,0]) cube(5);
>
> Note that if I render the polyhedron without the cube afterward (i.e.
> just
> the first line), it renders correctly.

Actually, it does not. Press F12 (View -> Thrown Together) to see if any
faces are inside-out, indicated by red color. In this case the triangle
in the XZ-plane and the one that touches each global axis are both
inside-out, making it an invalid polyhedron. All face normals should
point out of the polyhedron to make it valid. To achieve this, the face
vertices must be listed in CW order as seen from outside the polyhedron
(this is opposite convention to other software, but anyway).

Wrapping the polyhedron in a hull will work in this case as the hull
will discard the faces and define new ones with proper orientations.
This will be ok as long as the polyhedron is convex, but will as you
undicate not work for polyhedra with concavities.

Regards
Carsten Arnholm

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Polyhedron rendering with missing faces

matt_391
Hi Carsten

Thanks for the help! I guess I'll have to be more careful defining my faces
in future...

Cheers



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Polyhedron rendering with missing faces

matt_391
In reply to this post by cacb
Hi Carsten

Thanks for the help! I guess I'll have to be more careful defining my faces
in future...

Cheers



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org