And lo and behold, I resolve one bug and can now generate this
The actual input for this is two rectangles. Here’s the cartesian points that describe them.
// Interlocking squares
var points17 = [
[
125,125,30,
275,125,30,
275,175,30,
125,175,30,
125,125,30
] ,
[
250,100,20,
320,100,20,
320,200,20,
250,200,20,
250,100,20
]
];
The program has worked out that the first rectangle in the array has a depth of 30 and therefore its deeper than the second rectangl which only has a depth of 20. Therefore it automatically cuts out a chunk of the second rectangle. The program generates the cut lines as well as the inner path to make a clean edge.
Here’s a more complex shape with three rectangles that intersect.
More complex polygons will also work, I use rectangles as that only has four points and I can do the maths in my head, whereas a complex star shaped polygon might have 12 points and I have no idea what the ‘right’ answer is.
A lot of this is new to me, so I have to go back to first principles to work out what I need to do, so it’s a bit slow, but it is coming along. The aim is to see how much I can do automatically before the user steps in.
Rob