The problem of finding intersection point of triangle mesh

4 ビュー (過去 30 日間)
Vivaldi
Vivaldi 2019 年 11 月 21 日
コメント済み: Vivaldi 2019 年 11 月 25 日
Now I have drawn a triangle mesh. (The function to generate image I use are as follows. )I want to ask for the intersection point, as shown in the figure(Red line with the mesh). But I don't know how to solve it.
PS:You can define the expression of a line at will,like "x=5".
If you want, I have some expression here.
Inked LI.jpg
In.jpg
trimesh(face', vertex(1,:), vertex(2,:), vertex(3,:),'LineWidth',1,'EdgeColor','k');
hold off;
vertex0=vertex';
V=vertex0(:,1:2);
x1=V(:,1);
y1=V(:,2);
z1=repmat(-20,1380,1);
tr = triangulation(face',x1,y1,z1); %x1.y1.z1 is a set of three coordinates of vertices
trimesh(tr);
axis equal;
colorbar('vert');
brighten(-0.1);axis on; % 'face' is the index list of triangle patch vertices;'vertex' is the index list of triangle vertex coordinates.
  2 件のコメント
darova
darova 2019 年 11 月 21 日
What about in-built function such as polyxpoly?
Vivaldi
Vivaldi 2019 年 11 月 24 日
Thanks for your answer. But I dont know how this function should I use. Cloud you write a function?Sorry to bother you.

サインインしてコメントする。

採用された回答

darova
darova 2019 年 11 月 24 日
編集済み: darova 2019 年 11 月 24 日
To check every edge:
for j = 1:size(face,2)
i1 = 1;
for i2 = [2 3 1]
% checking edges [1 2], [2 3], [3 1]
xx = [V(face(i2,j),1) V(face(i1,j),1)];
yy = [V(face(i2,j),2) V(face(i1,j),2)];
% intersection of edge and line x = [20 -150], y = [-40 -40]
[xc,yc] = polyxpoly(xx,yy,[20 -150],[-40 -40]);
i1 = i1+1;
% if intersection exists
if ~isempty(xc)
plot(xc,yc,'.r')
end
end
end
  1 件のコメント
Vivaldi
Vivaldi 2019 年 11 月 25 日
Its so cool! Thanks for your answer . Wishing your life delectation!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by