Arc travel of a line in 3D space.
2 views (last 30 days)
Show older comments
Darren Marcelino on 22 Dec 2022
Commented: Darren Marcelino on 20 Jan 2023
So I have a code that moves apoint in an arc throught a 3d space. I thought with my code that the line segment between the points would stay constant since the point just moves in an arc. I tested the arc travel of a line segment in a plane. the line segment would stay constant then.
How come when I try it in a 3d space the line segment length between my two points get smaller? is there a way to keep my line segment constant? am i calculating the travel of the point wrong?
%to find beta the angle that the camber links actualyl travel
a=[ax(i) ay(i) az(i)];
b=[0 0 0];
Karim on 22 Dec 2022
Hi, if I understand you correclty you want to verify the distance between two positions of the point and prefferbaly have it constant? Note that this distance will depend on the input angle (i.e. LowerTheta).
In the code below I modified your code a bit to work vectorized, I plotted the trajectory of the point and evaluate the distance between the consecutive positions.
Looking at your original code, I think the mistake is that you do not update point 'b'. You are always evaluating the length with respact to the origin (i.e. [0,0,0]).
L = 9;
% define some random angles, OP did not provide them
LowerTheta = linspace(0,2*pi,50);
% evaluate the position of the point
ax = 8*cos(LowerTheta);
az = 8*sin(LowerTheta);
ay = L*cosd(asin(az./L));
% create a figure of the trajectory of the point
xlabel('X'); ylabel('Y'); zlabel('Z')
% merge the coordinates into a grid
a = [ax(:) ay(:) az(:)];
% now determine the distance between the consecutive points
SegLength = sqrt( sum( (a(1:end-1,:) - a(2:end,:)).^2 ,2 ))
More Answers (0)
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!