Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

removing a part of a polygon makes the entire thing not render

So, I make a prism:

width=30
thickness=15
polyhedron(
    points=[ 
        [width,0,0],[width,0,thickness],
        [width,width,0],[width,width,thickness],
        [0,width,0],[0,width,thickness]
    ],
    faces=[
        [1,3,5], [0,2,4],[1,0,2,3],[3,5,4,2],[1,5,4,0]
        ]
    );

Which renders just fine: enter image description here

Then, I remove a chunk of it:

difference () {
    <THAT PRISM>
    translate([0,0,thickness-5]) cylinder(r=width-10, h=6);
    }

what I get is, instead of a prism with a circular chunk taken out of it, I get a non-complete polygon:enter image description here Whats up with that? What am I doing wrong with the difference statement?

like image 718
blackcoat Avatar asked Dec 06 '25 07:12

blackcoat


1 Answers

your faces are mis-orientated, see documentation. The order of the points must be clockwise when looking from outside. Here the correct faces:

faces=[
    //[1,3,5], [0,2,4],[1,0,2,3],[3,5,4,2],[1,5,4,0]
    [1,5,3],[0,2,4],[0,1,3,2],[3,5,4,2],[0,4,5,1]
    // edit 27.07.2015 order of faces changed
    ]

edit 27.07.2015:

with Your faces there should be an output in console like this:

Top level object is a 3D object:
Simple: no
Vertices: 15
Halfedges: 30
Edges: 15
Halffacets: 4
Facets: 2
Volumes: 1
WARNING: Object may not be a valid 2-manifold and may need repair! 
Rendering finished.

"Simple: no" and the warning are hints , that Your polyhedron is invalid. If the object is valid, it would be "Simple: yes" without any warning.

like image 84
a_manthey_67 Avatar answered Dec 08 '25 04:12

a_manthey_67