필터 지우기
필터 지우기

Find intersection between two 2D meshes

조회 수: 18 (최근 30일)
Claudio Tomasi
Claudio Tomasi 2020년 11월 17일
편집: Amrtanshu Raj 2021년 2월 5일
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

답변 (1개)

Amrtanshu Raj
Amrtanshu Raj 2021년 2월 5일
편집: Amrtanshu Raj 2021년 2월 5일
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 !!

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by