how to know 'y' values perpendicular to a line?
1 view (last 30 days)
Sierra on 30 May 2022
I have longitude, latitude, altitude data of aircraft. and I plotted trajectoris of aircrafts(I only drawed mean trajecorty here. and drawed 2D)
a left image is what I plotted with patch(using percentile). but it's something wrong.
percentile ex) If percentile is 100, the patch contain every trajectory. In my case, I use 97.5 percentile.
I need to plot like a right image. the line between two y values should be perpendicular to a mean trajectory(black line).
I know it's because I assgin two y values(not to mean trajetroy's y value) to same value as mean trajectory's y value.
but I don't know how to get a two y values which is perpendicular to each mean trajectory point.
I will attach my code for your understanding.
for i = 1:length(33R)
yv = ;
yv = [yv;mean_trajectory.Latitude]; % I fixed 'y' values I think it's a problem.
for i = 1:length(trajectory) % trajectory is every trajectory of aicraft incluing mean trajectory.
xptcl = prctile(trajectory(i).Longitude,[2.5 97.5]); % I used percentile when making a patch
zptcl = prctile(trajectory(i).Altitude,[2.5 97.5]); % same
xl(i,:) = xptcl;
zl(i,:) = zptcl;
patch([xptcl flip(xptcl)], [0 0 0 0]+yv(i), [[1 1]*zptcl(1) [1 1]*zptcl(2)],'r', 'FaceAlpha',0.5)
plot3(xl(:,1), yv(:), zl(:,1), '-k', 'LineWidth',2)
plot3(xl(:,1), yv(:), zl(:,2), '-k', 'LineWidth',2)
plot3(xl(:,2), yv(:), zl(:,1), '-k', 'LineWidth',2)
plot3(xl(:,2), yv(:), zl(:,2), '-k', 'LineWidth',2)
Sai Charan Sampara on 22 Jun 2022
A line is defined uniquely by a point and a slope or by two points. If you are looking for a line that is perpendicular to the line segment joining the two points, the slope is already fixed in 2 Dimensional space. For three dimensional space find a line that is in the plane containing both the line segments such that it is perpendicular to the first line segment. If the slope is known from this condition then the line can be drawn from any point on the first line segment. Preferably the mid-point of the first line segment.