How to find surface intersection of 2 surfaces created using trisurf function ?

조회 수: 3 (최근 30일)
Suraj Gurav
Suraj Gurav 2019년 11월 12일
댓글: darova 2019년 11월 25일
Hello All,
I have plotted two surfaces using trisurf function and now interested in getting a line or contour plot as the intersection of these two surfaces.
In the code given below,
fovsurface.vertex=[0 0 0;311.5 260 2562;311.5 -260 2562;-311.5 260 2562;-311.5 -260 2562];
fovsurface.face=[1 2 3;1 2 4;1 4 5;1 3 5];
surface1=trisurf(fovsurface.face, fovsurface.vertex(:,1), fovsurface.vertex(:,2), fovsurface.vertex(:,3),'FaceAlpha',0.5,'FaceColor','r')
daspect([1,1,1]);
hold on
% Creating box
ver = [1 1 0;
0 1 0;
0 1 1;
1 1 1;
0 0 1;
1 0 1;
1 0 0;
0 0 0];
% Define the faces of the unit cubic
fac = [1 2 3 4;
4 3 5 6;
6 7 8 5;
1 2 8 7;
6 7 1 4;
2 3 5 8];
origin=[0,0,2500]; % define vertex of the box, need to think about suitable origin
X=500;Y=500;Z=500; % length of the sides of the box
cube = [ver(:,1)*X+origin(1),ver(:,2)*Y+origin(2),ver(:,3)*Z+origin(3)];
box1=trisurf(fac,cube(:,1), cube(:,2), cube(:,3), 'EdgeColor','y', 'FaceColor','y','FaceAlpha',1.0);
direction=[1 0 0]
rotate(box1,direction,25) % rotate the box1 by 25° about x axis
I am trying to get the intersection of surface1 and the box1. Can anyone please help me or suggest me a solution for this problem.
Thanks in Advance
  댓글 수: 5
Suraj Gurav
Suraj Gurav 2019년 11월 25일
Hello darova,
Thank you for highlighting this triangulation of surface.
you are right, the cube was not triangulated and may be thats why I was not getting correct output.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by