gumyr / build123d

A python CAD programming library
Apache License 2.0
574 stars 94 forks source link

Inconsistent intersection results for same shape based on method of creation #519

Closed MatthiasJ1 closed 9 months ago

MatthiasJ1 commented 10 months ago
r = (ShapeList() + (PolarLocations(1, 4) * Line((0,-1),(0,1)))).edges()
l = Line(1,2).edge()
i = l.intersect(*r)
a
r = Rectangle(2,2).edges()
l = (Pos(1) * Line(0,1)).edge()
i = l.intersect(*r)
b
gumyr commented 10 months ago

Related to Issue #328

bernhard-42 commented 9 months ago

I think the issue is that after OCCT found the right intersection, the filter in Edge.intersections does a exact comparison instead of taking the tolerance again into account.

I think the following change should be applied:

image

gumyr commented 9 months ago

Thanks @MatthiasJ1 and @bernhard-42, tolerance was indeed the problem, fixed now.