Self-intersection is not detected when intersecting triangles are on the same plane

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
m3g1dd0
Posts: 7
Joined: Sat Aug 28, 2021 4:41 am

Re: Self-intersection is not detected when intersecting triangles are on the same plane

Post by m3g1dd0 »

Thanks guys. I'd like to test the patch, but I guess it requires building and running FreeCAD along with all its dependencies. Is there a quick way to test the patch without setting up FreeCAD build environment? Probably not! I'll test when I have the opportunity... =)
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Self-intersection is not detected when intersecting triangles are on the same plane

Post by wmayer »

For coplanar triangles the two intersection points may show garbage values. This means it doesn't just have arbitrary values but some of the coordinates might be NaN.

Now if creating a line and adding it to the scene graph may invalidate the view frustum and this leads to the observed behaviour.

With git commit 8d0d149b5be5d there is now a function to get the intersection points of the edges of triangles.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Self-intersection is not detected when intersecting triangles are on the same plane

Post by wmayer »

The self-intersection function fails again when rotating the mesh with:

Code: Select all

from FreeCAD import Base

mat = Base.Matrix()
mat.rotateX(1.0)
mat.rotateY(1.0)
mat.rotateZ(1.0)

mesh = App.ActiveDocument.ActiveObject.Mesh.copy()
mesh.transformGeometry(mat)
App.ActiveDocument.ActiveObject.Mesh = mesh
With git commit 30ba396a82 it works as expected now. The problem was that tri_tri_intersect_with_isectline() doesn't work very reliably for coplanar triangles.
Post Reply