how to find a normal vector?

156 次查看(过去 30 天)
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

采纳的回答

Matt J
Matt J 2022-6-25
编辑:Matt J 2022-6-25
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
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
Sierra 2022-6-25
To Matt J
I thought P1 is V0, P1 in this function.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by