How to find tangent vector or velocity vector and unit tangent vector of Space curve (3D)?
6 views (last 30 days)
Show older comments
I have the curvature of a curve, start point P1(x1,y1,z1) and end point P2(x2,y2,z2), radius of curvature, arc length, and a cord length of a curve. Now I want to find the tangent or velocity vector and unit tangent vector of this curve. I am developing a code for continuum robot dynamics.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/331130/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/331133/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/331136/image.png)
The orange colour shows the curvature created by spline and while blue line shows the cord or vector from Pi-1 to Pi.
%Kappas,thetas, phis%
%%--------------------------------------------------------------
%kappa -- magnitudes (beta and gamma) of segments
k1 = kappa_vec(1,1);
k2 = kappa_vec(1,2);
k3 = kappa_vec(1,3);
%theta -- the subsegment bending angle ?i
th1 = theta_vec(1,1);
th2 = theta_vec(1,2);
th3 = theta_vec(1,3);
%phi -- the bending plane angle ?i
phi1 = phi_vec(1,1);
phi2 = phi_vec(1,2);
phi3 = phi_vec(1,3);
%epsilon - the subsegment twist angle ?i
e1 = epsilon_list(1,1);
e2 = epsilon_list(1,2);
e3 = epsilon_list(1,3);
%%--------------------------------------------------------------
%Rotation matrices%
%%--------------------------------------------------------------
R_1 = rot(phi1, th2, e1);
R_2 = R_1* rot(phi2, th2, e2);
R_3 = R_2* rot(phi3, th3, e3);
%%--------------------------------------------------------------
% POsition vectors%
%%--------------------------------------------------------------
if k1 == 0
p1 = [0;0;L0];
else
p1 = p_lcl(k1,th1,phi1);
end
%%-------------------------------------
p_vec = [B p1 p2 p3 p4 p5 p6 p7 p8 p9 p10]; % B is base position, and rest are position eacg disk center.
p_vec(isinf(p_vec)|isnan(p_vec)) = 0; %to remove infinity and NaN
%%-------------------------------------
0 Comments
Answers (1)
Aditya Srikar
on 28 Apr 2023
Edited: Aditya Srikar
on 28 Apr 2023
Hi Hussain
Let the position vector be P(t)
Let P′(t) = d[P(t)] / dt
The tangent vector of curve is P′(t)
The unit tangent vector of curve is T(t) = P′(t) / |P′(t)|
Where |P′(t)| represents magnitude of vector P′(t)
Hope it helps !
0 Comments
See Also
Categories
Find more on Splines 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!