Open WizardUli opened 1 year ago
I don't understand yet how all the pymadcad internals works but I think I've found something which may be of interest.
When I display the argument which crashes the triangulation_outline
function I see a self-intersecting wire (near the top left hole as seen on picture):
However if I move the cutting brick a little to the left (e.g. when instead of center=vec3(53.5, 0, 0)
I use center=vec3(43.5, 0, 0)
) then I see no self-intersection and the whole boolean operation completes OK:
Yes, I observed the same
I think the issue comes from madcad.triangulation.line_bridges
which is responsible for linking holes to outlines in faces
I can reproduce it even without the boolean operation, just from user-made webs:
base = parallelogram(236*X, 170*Y, align=vec2(0.5), fill=False)
hole_positions = [vec3(x, y, 0)
for x in linrange(-225 / 2, 225 / 2, div=3)
for y in [-155 / 2, 155 / 2]]
hole_cutouts = web([
Circle(Axis(pos,Z), radius=3 / 2)
for pos in hole_positions]).flip()
cable_cutouts = parallelogram(5*X, 20*Y, origin=53.5*X, align=vec2(0.5), fill=False).flip()
#f = flatsurface(web([base, hole_cutouts]))
f = flatsurface(web([base, hole_cutouts, cable_cutouts]))
So now we are sure it is not coming from the boolean operation itself but only the triangulation step
Ok I got the problem:
The algorithm I made for line_bridges
has a failure in case it is matching a point to a long edge
On the above picture we can see the current algorithm is creating to link unconnected components of a wire before triangulation. The edge crossing a circle is due to failure.
So ... I will work on a new algorithm for this. This may take some time before I have it ready so this issue will have to wait for it ...
Hello again. Any news on this? Since I'm hitting this issue with anything I try to do and any workaround I devise just delays the problem a few steps, I was thinking I could look into it myself. I guess what am I asking is: Have you been planning to look at it sometime soon?
Hello, to be honest I had no time in past month. I have slightly more time now.
So I only took some time few weeks ago and started something on branch triangulation
, but it is not ready yet.
Of course you can look into it if you want, but be warned that the constraints for the new triangulation algorithm are demanding:
O(n*k)
(with n
the number of vertices, k
the number of non-convex verticesSo to summarize it must work in every situation the current one is working, and this time with no side case (side case like we have in this topic)
fails with
I'm on revision 22437d1edc9e0c13df183ca046f79fcf4e0f958f but I also reproduced it on
v0.15.1
.