schupf 221 Report post Posted June 19, 2009 Hello! As you might know, a cubic hermite curve in parametric form looks like this (Equation 1): p(t) = (2t³ - 3t² +1)P_1 + (-2t³ + 3t²)P_2 + (t³ - 2t² + t)P_1' + (t³ - t²)P_2' or in short form: p(t) = F_1(t)P_1 + F_2(t)P_2 + F_3(t)P_1' + F_4(t)P_2' P_1 is the start point, P_2 the end point of the curve. P_1' and P_2' are the 1. derivative of the first and last point, respectively. t goes from 0 to 1 The 1. derivative p' of the curve can be expressed by the 1. derivatives of the blending functions F (Equation 2): p'(t) = F_1'(t)P_1 + F_2'(t)P_2 + F_3'(t)P_1' + F_4'(t)P_2' = (6t² - 6t)P_1 + (-6t² + 6t)P_2 + (3t² - 4t + 1)P_1' + (3t² - 2t)P_2' Nothing special as you can see. Lets assume I have a cubic hermite curve p(t) with the following values: P_1 = (0,0), P_2 = (4,0), P_1' = (0,2), P_2'=(0,-2) This curve will approximately look like this: Now I want to calculate the tangent (= 1. derivative) in the middle of the curve (t=0.5). So I just plug t=0.5 into equation 2, which gives me: (6*0.5^2 - 6*0.5)*(0,0) + (-6*0.5^2 + 6*0.5)*(4,0) + (3*0.5^2 - 4*0.5 + 1)*(0,2) + (3*0.5^2 - 2*0.5)*(0,-2) = (6,0) So the tangent at t=0.5 is (6,0). If you look at the figure the direction seems to fit. But my first question is: Why is the magnitude of the tangent 6? Why is the tangent not (3,0) or (1,0)? What influences the tangent? My 2. question: Lets take the same curve and just swap P_1' and P_2', so we have: P_1 = (0,0), P_2 = (4,0), P_1' = (0,-2), P_2'=(0,2). The figure is exactle the same except the direction of the start and end tangent. Now if I calculate the tangent at t=0.5 I get a tangent of (6,0) again. This is something I don't understand: I expected a tangent of (-6, 0). I thought while t goes from 0 to 1 the tangent P_1' of the start point goes along the curve and finally ends in P_2'. Since the start tangent P_1' = (0,-2) and the end tangent P_2' = (0,2) I thought the tangent in the middle shows to the left! Can anyone explain why the tangent is again (6,0) and points to the right? Thanks! 0 Share this post Link to post Share on other sites
Sneftel 1788 Report post Posted June 19, 2009 Quote:Original post by schupfWhy is the magnitude of the tangent 6? Why is the tangent not (3,0) or (1,0)? What influences the tangent?The derivative of the curve is the derivative of the curve, not the tangent. At that point, the value of the curve is locally changing by (6,0) per unit change in t. The tangent is the normalized derivative.Quote:I thought while t goes from 0 to 1 the tangent P_1' of the start point goes along the curve and finally ends in P_2'.The control tangents don't move anywhere. They stay where they are. They're parameters, not objects. If you want to think of it like that, though, note that the curve is now below the endpoints. The left tangent turns counterclockwise as it moves, going from pointing down at the beginning to pointing right in the middle to pointing up at the end.Quote:Can anyone explain why the tangent is again (6,0) and points to the right?You haven't swapped the endpoints. The curve starts on the left and ends on the right. Of course it has to go forwards in the x axis. 0 Share this post Link to post Share on other sites
schupf 221 Report post Posted June 20, 2009 Quote:Original post by SneftelQuote:Original post by schupfQuote:I thought while t goes from 0 to 1 the tangent P_1' of the start point goes along the curve and finally ends in P_2'.The control tangents don't move anywhere. They stay where they are. They're parameters, not objects. If you want to think of it like that, though, note that the curve is now below the endpoints. The left tangent turns counterclockwise as it moves, going from pointing down at the beginning to pointing right in the middle to pointing up at the end.Actually the tangent DOES move from point P_1 to P_2 while t goes from 0 to 1. My problem was: I swapped the start and end tangents of the 2. curve and said that it looks the same except for the directions of the start and end tangent; this is wrong! The curve with P_1 = (0,0), P_2 = (4,0), P_1' = (0,2), P_2'=(0,-2) looks like the one on the figure but P_1 = (0,0), P_2 = (4,0), P_1' = (0,-2), P_2'=(0,2) is an arc BELOW the x-axis (so basically its the curve on the figure mirrowed at the x-axis)! Thus it absolutely makes sense that this curve also has a tangent of norm( (6,0) ) 0 Share this post Link to post Share on other sites
gpu_fem 208 Report post Posted June 20, 2009 The tangent vector T tells you how far you would move for a given increment dt. So at t = 0.5, if you moved by (infinitesimal) dt, your new position would be P(0.5)+T(0.5)*dt. So the magnitude of T is related to the parameterization of the curve. If t=[0...6] instead of [0...1], then T(0.5) would be (1,0) instead of (6,0). As far as your second question, switching the directions of the tangents inverts the curve, so that it opens up instead of down. But the tangent still goes in the same direction. 0 Share this post Link to post Share on other sites