Find intersection between two 2D meshes

14 visualizaciones (últimos 30 días)
Claudio Tomasi
Claudio Tomasi el 17 de Nov. de 2020
Editada: Amrtanshu Raj el 5 de Feb. de 2021
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

Respuestas (1)

Amrtanshu Raj
Amrtanshu Raj el 5 de Feb. de 2021
Editada: Amrtanshu Raj el 5 de Feb. de 2021
Hi,
Your task can be performed by
  1. Using collisionMesh to create a collision geometry.
  2. using checkCollision to check if the geometries are in collision.
However as of now this function does not give the points of intersection.
Hope this helps !!

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by