how to find a normal vector?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
for example, there are 2 points. P0(4,3,2) ,P1(8,5,4) and the vector ->P0P1
I know that In three dimension, there are infinite number of vectors perpendicular to a given vector.
but i know the point which is on the plane.
To use this function, I need to find a normal vector of the plane.
In my case, P1 point wil be the V0 and P1 for this function.
[I,check]=plane_line_intersect(n,V0,P0,P1)
% n: normal vector of the Plane
% V0: any point that belong s to the Plane
% P0: end point 1 of the segment P0P1
% P1: end point 2 of the segment P0P1

채택된 답변
In my case, P1 point wil be the V0 and P1 for this function.
You need 3 distinct, non-colinear points in a the plane to calculate its normal. If V0,P0,V1 are such points, then you would do,
normal=cross(P1-P0,V-P0)
댓글 수: 10
Sierra
2022년 6월 25일
Thanks Matt J
as i said, i know one point which is on a plane. to do cross product i made two arbitrary point.
but when i used the function, it only returns x and y value. all z value is zero
do you have any idea to solve this problem?
Here is my code
intersection_point = [];
for i = 1:length(mean_trajectory_double)
O = [mean_trajectory_double(i,1),mean_trajectory_double(i,2),mean_trajectory_double(i,3)];
P = [mean_trajectory_double(i,1)+1,mean_trajectory_double(i,2)+1,mean_trajectory_double(i,3)-1000];
Q = [mean_trajectory_double(i,1)+2,mean_trajectory_double(i,2)+2,mean_trajectory_double(i,3)+1000];
OP = Q-O;
OQ = P-O;
normalvector = cross(OP,OQ);
for j = 1:length(RKSI_Arr_33R)
for k = 1:length(RKSI_Arr_33R(j).Latitude)-1
[I,check]=plane_line_intersect([normalvector(1) normalvector(2) normalvector(3)]...
,[mean_trajectory_double(i,1) mean_trajectory_double(i,2) mean_trajectory_double(i,3)]...
,[RKSI_Arr_33R(j).Longitude(k) RKSI_Arr_33R(j).Latitude(k) RKSI_Arr_33R(j).BAlt(k)]...
,[RKSI_Arr_33R(j).Longitude(k+1) RKSI_Arr_33R(j).Latitude(k+1) RKSI_Arr_33R(j).BAlt(k+1)]);
end
end
intersection_point = [intersection_point;I];
end
O is the point I know already and P, Q is what i made.
mean_trajectory_double(i,1) is longitude
mean_trajectory_double(i,2) is latitude
mean_trajectory_double(i,3) is altitude
I changed the P and Q's altitude several time, but it always returend zero.

and in making two arbitrary point(P,Q), if there are better way, tell me please.
Thanks.
I don't understand your question.
If P0P1 is perpendicular to the plane and P1 lies in the plane, then the equation of the plane is
(-P0 + P1).' * x = (-P0 + P1).' * P1
where P0, P1 are given as column vectors.
Sierra
2022년 6월 25일
I know that. What I'm asking is that to get the normal vector, I need 3 points on a plane.
but i know only one point on a plane. so how can i get the other two points?
Thanks Torsten.
P0 = [4 3 2];
P1 = [8 5 4];
normal_to_plane = (-P0 + P1);
% Generate two vectors that span the plane
in_plane = null(normal_to_plane)
% Generate two points in the plane
Q = P1.' + in_plane(:,1)
S = P1.' + in_plane(:,2)
% Test whether points Q, S are in plane
test_Q_in_plane = normal_to_plane*Q - normal_to_plane*P1.'
test_S_in_plane = normal_to_plane*S - normal_to_plane*P1.'
but i know only one point on a plane. so how can i get the other two points?
You said you know 3 points in the plane: P0,P1,V0
As I said in my original answer, you must be given 3 non-colinear points in the plane to determine its equaiton. It is a minimum requirement.
If you want to know only its normal, you must be given two vectors parallel to the plane. This is also a minimum requirement.
Sierra
2022년 6월 25일

All i know is P0 and P1. and I want to know Q and S point.
There is no relationship between S,Q and P0,P1 conveyed in your picture. Also, your question asked how to determine the normal to the plane. But the difference vector P1-P0 is the normal to the plane, so you already know it. S and Q have nothing to do with anything.
Also, what happened to V0? Where is V0 in your picture?
Torsten
2022년 6월 25일
I renamed the points in the plane as Q and S in the code above.
Sierra
2022년 6월 25일
Thanks Torsten, your code worked perfectly.
but I have one problem in 'z' value.


intersection_point = cell(30,3)
lon = [];
lat = [];
alt = [];
for i = 1:length(mean_trajectory_double)-1
P0 = [mean_trajectory_double(i,:)];
P1 = [mean_trajectory_double(i+1,:)];
normal_to_plane = (-P0 + P1);
P2_in_plane = P1.' + in_plane(:,1);
P3_in_plane = P1.' + in_plane(:,2);
lon = [];
lat = [];
alt = [];
for j = 1:100
for k = 1:100
[I,check]=plane_line_intersect([normal_to_plane(1) normal_to_plane(2) normal_to_plane(3)]...
,[mean_trajectory_double(i,1) mean_trajectory_double(i,2) mean_trajectory_double(i,3)]...
,[RKSI_Arr_33R(j).Longitude(k) RKSI_Arr_33R(j).Latitude(k) RKSI_Arr_33R(j).BAlt(k)]...
,[RKSI_Arr_33R(j).Longitude(k+1) RKSI_Arr_33R(j).Latitude(k+1) RKSI_Arr_33R(j).BAlt(k+1)]);
end
lon = [lon;I(1)];
lat = [lat;I(2)];
alt = [alt;I(3)];
end
intersection_point{i,1} = [lon];
intersection_point{i,2} = [lat];
intersection_point{i,3} = [alt];
end
there is no problem in x(lon),y(lat) value. but z(alt) value print same number.
Sierra
2022년 6월 25일
To Matt J
I thought P1 is V0, P1 in this function.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기
참고 항목
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
