# polyhedron difference renders ok but bad preview Classic List Threaded 3 messages Open this post in threaded view
|

## polyhedron difference renders ok but bad preview

 Hi, I'm intersecting two polyedrons (I double checked their faces definiftions), both taken singularly are previewed and rendered ok, but when I difference them the preview fails from certain angles, while the render is ok. Am I missing something or could be a bug? \$vpr = [85, 0, 50]; //------------------------------------- module single_roof(dim, sp)    {     // P2  P8    p2 +-------------+ p3       P9  P3     //    \\        |      Y+     |           //     //     \\    p1 +-------------+ p4 ->X   //     //  P1 //P7     |      Y-     |       P10\\ P4     //    //     p0 +-------------+ p5        \\     // P0  P6                               P11  P5     p0 = [-dim.x/2, -dim.y/2, 0];     p1 = [p0.x, 0, dim.z];     p2 = [p0.x, dim.y/2, p0.z];     p3 = [dim.x/2, p2.y, p0.z];     p4 = [p3.x, p1.y, p1.z];     p5 = [p3.x, p0.y, p0.z];     p6 = [p0.x, p0.y, p0.z+sp];     p7 = [p1.x, p1.y, p1.z+sp];     p8 = [p2.x, p2.y, p2.z+sp];     p9 = [p3.x, p3.y, p3.z+sp];     p10 = [p4.x, p4.y, p4.z+sp];     p11 = [p5.x, p5.y, p5.z+sp];     points = [p0, p1, p2, p3, p4,  p5,               p6, p7, p8, p9, p10, p11];     // faces are defined by points indices (CW)     faces =        [         [ 0, 5, 4, 1 ], // Under Y-         [ 6, 7,10,11 ], // Over Y-         [ 1, 4, 3, 2 ], // Under Y+         [ 7, 8, 9,10 ], // Over Y+         [ 5,11,10, 4 ], // Side Y- X+         [ 4,10, 9, 3 ], // Side Y+ X+         [ 1, 7, 6, 0 ], // Side Y- X-         [ 2, 8, 7, 1 ], // Side Y+ X-         [ 0, 6,11, 5 ], // Side Y-         [ 3, 9, 8, 2 ]  // Side Y+        ];     polyhedron(points, faces);    } //------------------------------------- module single_roof_vol(dim)    {     dz = 0.001;     //  p2 +-------------+ p3     //     |      Y+     |     //  p1 +-------------+ p4 ->X     //     |      Y-     |     //  p0 +-------------+ p5     p0 = [-dim.x/2, -dim.y/2, 0-dz];     p1 = [p0.x, 0, dim.z-dz];     p2 = [p0.x, dim.y/2, p0.z];     p3 = [dim.x/2, p2.y, p0.z];     p4 = [p3.x, p1.y, p1.z];     p5 = [p3.x, p0.y, p0.z];     points = [p0,  p1,  p2,  p3,  p4,  p5];     faces =        [         [ 0, 5, 3, 2 ], // Under         [ 0, 1, 4, 5 ], // Over Y+         [ 1, 2, 3, 4 ], // Over Y-         [ 5, 4, 3 ], // Front X+         [ 2, 1, 0 ]  // Front X-        ];     polyhedron(points, faces);    } // Intersection difference()    {     color("DarkRed") single_roof([13,11,3], 0.3);     rotate([0,0,90]) single_roof_vol([12,6,3]);    } _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org