Hi guys,
I need an algorithm to find intersections between two triangulation.
I do not need the polygons definition, only the couples of faces partecipating to an intersection.
I have 2 meshes, each with vertices and faces.
I tried this (https://www.mathworks.com/matlabcentral/fileexchange/48613-surface-intersection) that works in a small range of cases it seems.
For example if I have something like:
s1.vertices
ans =
0 0 0
0.8000 0 0
1.0000 0 0
0 0.2000 0
0.5000 0.4000 0
1.0000 0.7000 0
0 1.0000 0
0.2000 1.0000 0
1.0000 1.0000 0
s1.faces
ans =
1 2 5
2 3 6
1 5 4
2 6 5
4 8 7
4 5 8
5 9 8
5 6 9
as first mesh, and:
s2.vertices
ans =
0 0 0
1 0 0
0 1 0
1 1 0
s2.faces
ans =
1 2 4
1 4 3
I get this:
Error using assert
The condition input argument must be a scalar logical.
Error in SurfaceIntersection>TriangleIntersection2D (line 531)
assert(max(faces(:))<=size(vertices,1), 'Bad surface definition')
Because faces is an empty list
It only works when I have a surface that is the refinement of the other, but in that case the intersections are trivial.
Do you know the solution to this problem, or du you have some other code that can solve my issue ?
Thank you