1
votes

I used Tim Lamber's algorithm to draw a natural spline cubic curve.

NatCubic class

NatCubic class compute the coefficients of the cubics (a b c d) of an array of points.

a + b*u + c*u^2 + d*u^3 0<=u <1

and Cubic class compute the points on the curve at time t in [0-1].

b in Cubic class is the derivatives at the knots at i

My question is: how to find the tangent at t >0 <1

Thank you!

PS :

for clarify my question, I search the tangent at time t, eg 0.5 to using pre-computed coeficients (abcd) of each control point. This is to avoid calculating the point(t+1) to find the tangent by, y(i +1) - y(i-1)

sorry for my poor english.

you can see in this picture that I want to do

1
Did Sir Isaac Newton die just so that questions like this could be asked? - Ignacio Vazquez-Abrams
t> 0 <1 ?? Did you mean: 0<t<1 ? Each point gives you a vector in 3D. Usually the normal to that vector gives you tangent to that point. If you want tangent on surface then any two adjacent points give you a vector which is actually a tangent on the surface between these two points. - Usman.3D

1 Answers

-1
votes

Sont know if I well understood your question.

(EDIT)

Slope = b + 2c*u + 3d*u^2

then for the tanget use

(y - yo) = m * (x - x0)

where y0 is your spline value at point x0 and m is the slope at x0