Closed AlexExiv closed 2 years ago
@AlexExiv thanks for the information.
I’ll look at this. At first glance, the subtract() should function just fine.
There are issues with shapes with very close vertices (distance < 0.00001).
@z3dev Can it be related to the javascript engine, maybe numbers precision?
Possibly, as there are many cases of precision issues. For example, "z":-1.4210854715202002e-14.
Anyway, let me examine the example.
I have encountered that when looping too many times, I force exit the loop.
@AlexExiv i took a look at this in more detail.
This is the polyhedron as defined by the second set of points and faces. This 'solid' seems to have faces that cross. Is this correct?
Here's the code converted to V2 JSCAD.
(Down load, and rename to issue176csg.js to use properly)
This will not be fixed. Please reopen issues at OpenJSCAD.org
Has anyone ever met with such a problem?
This is an example of points of 2 shapes(json format) which I try to subtract and then fall to the loop.
First = {"faces":[{"c":2,"a":0,"b":1},{"c":1,"a":0,"b":3},{"c":6,"b":5,"a":4},{"a":4,"c":5,"b":7},{"c":0,"a":7,"b":3},{"b":4,"a":7,"c":3},{"a":8,"c":10,"b":9},{"c":9,"a":8,"b":11},{"c":13,"a":12,"b":11},{"a":12,"c":11,"b":9},{"a":14,"b":10,"c":15},{"a":14,"b":8,"c":10},{"a":7,"c":5,"b":12},{"b":9,"c":12,"a":7},{"b":16,"a":7,"c":9},{"c":15,"a":10,"b":15},{"b":10,"c":9,"a":16},{"c":10,"a":16,"b":17},{"b":2,"c":15,"a":17},{"c":2,"b":0,"a":17},{"b":14,"c":1,"a":3},{"b":18,"a":3,"c":14},{"c":14,"b":14,"a":8},{"b":11,"a":18,"c":8},{"c":11,"b":19,"a":18},{"b":13,"c":11,"a":19},{"b":6,"a":19,"c":13},{"c":6,"b":4,"a":19},{"b":2,"a":14,"c":1},{"c":2,"a":14,"b":15},{"b":12,"a":6,"c":13},{"a":6,"c":12,"b":5}],"vertices":[{"x":635,"y":31.75,"z":0},{"x":0,"y":31.75,"z":31.750000000000007},{"y":31.75,"x":0,"z":0},{"z":31.750000000000007,"y":31.75,"x":635},{"x":635,"y":374.64999999999998,"z":31.750000000000082},{"x":0,"y":374.64999999999998,"z":0},{"x":0,"y":374.64999999999998,"z":31.750000000000082},{"y":374.64999999999998,"z":0,"x":635},{"x":31.750112221948822,"y":45.607000005343465,"z":31.75},{"y":360.79299999342658,"x":31.750887778051123,"z":0},{"z":-1.0658141036401503e-14,"y":45.607000005343465,"x":31.750112221948822},{"x":31.750887778051123,"y":360.79299999342658,"z":31.750000000000078},{"y":360.79307812061109,"z":0,"x":0},{"y":360.79307812061109,"z":31.750000000000004,"x":0},{"y":45.607078130619584,"x":0,"z":31.750000000000014},{"x":0,"y":45.607078130619591,"z":-1.0658141036401503e-14},{"y":360.79299999342658,"z":0,"x":635},{"z":0,"y":45.607000005343465,"x":635},{"y":45.607000005343451,"x":635,"z":31.750000000000011},{"z":31.750000000000078,"y":360.79299999342658,"x":635}]}
Right = {"vertices":[{"z":1.2621774483536189e-29,"x":603.24911222194885,"y":360.79299999342658},{"z":1553.3693795073816,"x":1634.9991122188253,"y":360.79553874834829},{"y":360.79553874834795,"z":1.2621774483536189e-29,"x":1634.9991122188253},{"y":360.79299999342692,"x":603.24911222194885,"z":1553.3693795073816},{"y":45.609538760264499,"z":1553.3693795073816,"x":1634.9998877749276},{"x":603.24988777805117,"y":45.607000005343465,"z":-1.4210854715202002e-14},{"y":45.60953876026484,"z":-1.1332420028071772e-14,"x":1634.9998877749276},{"x":603.24988777805117,"y":45.607000005343124,"z":1553.3693795073816}],"faces":[{"b":1,"c":2,"a":0},{"c":1,"a":0,"b":3},{"b":5,"a":4,"c":6},{"a":4,"b":7,"c":5},{"c":4,"a":1,"b":7},{"b":3,"c":7,"a":1},{"c":7,"b":5,"a":3},{"b":0,"a":3,"c":5},{"b":2,"c":6,"a":5},{"c":2,"a":5,"b":0},{"a":1,"b":6,"c":2},{"b":4,"c":6,"a":1}]}
Result = First - Second
Thanks for any help.