# Why does this work in 2D, but not in 3D?

5 messages
Open this post in threaded view
|

## Why does this work in 2D, but not in 3D?

 This code works as expected in 2D (except for some surfaces sharing the same plane, but we can ignore that for now), but not in 3D. I can't see why it shouldn't work, and when I pick it apart, each step works, but when it do it all, it does not behave as expected. module xor(){         difference(){                 union(){                         children();                 }                                 intersection(){                         children(0);                                                 children(1);                 }         } } translate([30,0,0]) //2D xor(){         square([20,10]);         square([10,20]); } xor(){ //3D, should just be a thicker variant of the 2D result         cube([20,10,10]);         cube([10,20,10]); } Am I missing something stupid here? -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Why does this work in 2D, but not in 3D?

 I think because the resulting shape is non-manifold because the two remaining cubes share an edge. F6 gives this.Top level object is a 3D object: Simple: no Vertices: 14 Halfedges: 46 Edges: 23 Halffacets: 24 Facets: 12 Volumes: 3 UI-WARNING: Object may not be a valid 2-manifold and may need repair! On Thu, 24 Dec 2020 at 18:36, Troberg <[hidden email]> wrote:This code works as expected in 2D (except for some surfaces sharing the same plane, but we can ignore that for now), but not in 3D. I can't see why it shouldn't work, and when I pick it apart, each step works, but when it do it all, it does not behave as expected. module xor(){         difference(){                 union(){                         children();                 }                 intersection(){                         children(0);                         children(1);                 }         } } translate([30,0,0]) //2D xor(){         square([20,10]);         square([10,20]); } xor(){ //3D, should just be a thicker variant of the 2D result         cube([20,10,10]);         cube([10,20,10]); } Am I missing something stupid here? -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Why does this work in 2D, but not in 3D?

 This bodge works.eps = 1/1024;module xor(){        difference(){                union(){                        children();                }                translate([-eps, -eps, , -eps])                    scale(1 + 2 * eps)                        intersection(){                                children(0);                                children(1);                        }        }}On Thu, 24 Dec 2020 at 18:49, nop head <[hidden email]> wrote:I think because the resulting shape is non-manifold because the two remaining cubes share an edge. F6 gives this.Top level object is a 3D object: Simple: no Vertices: 14 Halfedges: 46 Edges: 23 Halffacets: 24 Facets: 12 Volumes: 3 UI-WARNING: Object may not be a valid 2-manifold and may need repair! On Thu, 24 Dec 2020 at 18:36, Troberg <[hidden email]> wrote:This code works as expected in 2D (except for some surfaces sharing the same plane, but we can ignore that for now), but not in 3D. I can't see why it shouldn't work, and when I pick it apart, each step works, but when it do it all, it does not behave as expected. module xor(){         difference(){                 union(){                         children();                 }                 intersection(){                         children(0);                         children(1);                 }         } } translate([30,0,0]) //2D xor(){         square([20,10]);         square([10,20]); } xor(){ //3D, should just be a thicker variant of the 2D result         cube([20,10,10]);         cube([10,20,10]); } Am I missing something stupid here? -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org