how to find a normal vector?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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 で 2-D and 3-D Plots についてさらに検索
参考
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
