how to find a normal vector?

110 vues (au cours des 30 derniers jours)
Sierra
Sierra le 25 Juin 2022
Commenté : Sierra le 25 Juin 2022
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

Réponse acceptée

Matt J
Matt J le 25 Juin 2022
Modifié(e) : Matt J le 25 Juin 2022
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 commentaires
Sierra
Sierra le 25 Juin 2022
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 le 25 Juin 2022
To Matt J
I thought P1 is V0, P1 in this function.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by