필터 지우기
필터 지우기

How to understand if a line cut a surface plot

조회 수: 8 (최근 30일)
ENRICO FAIELLA
ENRICO FAIELLA 2023년 3월 30일
편집: Antoni Garcia-Herreros 2023년 3월 30일
Hi everyone:
I have a surface plot which represents a plane parallel to XY reference frame. I would like to understand if a straight line which pass through two arbitrary points intersects or not.
Is there anyone who knows how to face this kind of problem or can give me some tips?
Thanks.

답변 (1개)

Antoni Garcia-Herreros
Antoni Garcia-Herreros 2023년 3월 30일
편집: Antoni Garcia-Herreros 2023년 3월 30일
If you have a plane parallel to XY reference frame (Z=a) , the line connecting the two points (p1 and p2) will cross the plane if the z component of the vector of that line (v=p2-p1) is nonzero, a.k.a not parallel to the plane.
%Orthogonal case
p1=[1 3 4];
p2=[5 6 8];
v=p2-p1;
v(3)==0 %If 0 it crosses the plane otherwise the plane and the line are parallel to each other
ans = logical
0
%Parallel case
p1=[1 3 4];
p2=[5 6 4];
v=p2-p1;
v(3)==0 %If 0 it crosses the plane otherwise the plane and the line are parallel to each other
ans = logical
1

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by