Hi Adam,
In your case, the helix is a curve parameterized by
f(t) = <x(t), y(t), z(t)>
For any point f(t0) = < x(t0), y(t0), z(t0) > on the curve, the line through f(t0) in the gradient direction will be the tangent line to the curve. This will be true for all points xi, yi, zi on the curve.
For the given curve,
x = r*cos(omega*t)
y = r*sin(omega*t)
z = (q_pipe/pipe_rad*ones(size(vy)) * t
So, tangent direction < u,v,w > at point < x,y,z > can be calculated as the gradient of the above parameterized equations:
u = r*(-sin(omega*t))
v = r*(cos(omega*t))
w = q_pipe/pipe_rad
Now, any tangent line on this curve passing through a point < x,y,z > will be in direction of < u,v,w >. This modifies the above equations as follows:
u = x – y
v = y + x
w = z + q_pipe/pipe_rad
In order to draw a line passing through a given point < x,y,z > and in the gradient direction, Let s = linspace(-0.75, 0.75, 50).
The following code will draw the tangents at every 100th point on the helix curve:
for i = 1:100:length(x),
u=@(s)x(i)-y(i)*s;
v=@(s)y(i)+x(i)*s;
w=@(s)z(i)+q_pipe/pipe_rad*s;
plot3(u(s),v(s),w(s));
end
- Note: For better visualization, try drawing tangents on fewer points rather than all of the possible points on the curve. I have taken an interval of 100 points, it can be modified as needed.
When this graph is plotted with the script you provided, it produces following tangents:
Another view from a different angle: