I use the following simple ASCII STL file as input for

*self-intersection*mesh repair. It's basically five triangles on the same plane i.e. co-planar. Triangle `4` is intersecting with triangle `1`. FreeCAD

**cannot**detect the self-intersection of facets `4` and `1`.

Code: Select all

```
solid Simple
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.0e1 0.0e1 1.0e1
vertex 0.0e1 +1.0e1 1.0e1
vertex +1.0e1 0.0e1 1.0e1
endloop
endfacet
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.0e1 +1.0e1 1.0e1
vertex +1.0e1 0.0e1 1.0e1
vertex 1.0e1 1.0e1 1.0e1
endloop
endfacet
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.0e1 0.0e1 1.0e1
vertex 0.0e1 +1.0e1 1.0e1
vertex -1.0e1 1.0e1 1.0e1
endloop
endfacet
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.0e1 0.0e1 1.0e1
vertex +1.0e1 0.0e1 1.0e1
vertex +1.0e1 -1.0e1 1.0e1
endloop
endfacet
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.6e1 0.8e1 1.0e1
vertex +1.6e1 0.8e1 1.0e1
vertex +0.6e1 1.8e1 1.0e1
endloop
endfacet
endsolid Simple
```

3D

As another test, I use the following simple STL file. Just like previous STL, it consists of 5 facets but they are NOT on the same plane. In this case FreeCAD detects the intersection of facet `4` and `1` and deletes it properly.

Code: Select all

```
solid Simple
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.0e1 0.0e1 1.0e1
vertex 0.0e1 +1.0e1 1.0e1
vertex +1.0e1 0.0e1 1.0e1
endloop
endfacet
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.0e1 +1.0e1 1.0e1
vertex +1.0e1 0.0e1 1.0e1
vertex 1.0e1 1.0e1 1.0e1
endloop
endfacet
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.0e1 0.0e1 1.0e1
vertex 0.0e1 +1.0e1 1.0e1
vertex -1.0e1 1.0e1 1.0e1
endloop
endfacet
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.0e1 0.0e1 1.0e1
vertex +1.0e1 0.0e1 1.0e1
vertex +1.0e1 -1.0e1 1.0e1
endloop
endfacet
facet normal 0.0e0 0.0e0 1.0e1
outer loop
vertex 0.6e1 0.8e1 1.2e1
vertex +1.6e1 0.8e1 0.0e1
vertex +0.6e1 1.8e1 0.0e1
endloop
endfacet
endsolid Simple
```

Question

The 2D case above is just like the 3D case with some minor differences in `Z` coordinates of some vertices.

I wonder why FreeCAD can detect self-intersection in 3D case? But not in 2D case?

FreeCAD info

Here is the content of `Help > About FreeCAD > "Copy to clipboard"`:

Code: Select all

```
OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United States (en_US)
```