From: Johan Engelen <jbc.engelen@sw...>  20121016 18:25:01

On 16102012 13:43, Jasper van de Gronde wrote: > On 121012 23:11, Johan Engelen wrote: >> On 12102012 14:59, Jasper van de Gronde wrote: >>> ... >>> To deal with zerolength handles, the easiest (and correct) method is >>> probably to specify that the curvature is zero at the endpoint with the >>> zerolength handle (if both handles are zerolength, then the Bézier >>> curve forms a line segment). That this is correct can be derived from >>> the fact that the unit tangent vector at the endpoint with a zerolength >>> handle points in the same direction as the second derivative (so locally >>> it's a straight line). This is a consequence of l'Hôpital's rule btw. >> I don't think this is correct. > That observation /is/ :) > > Note that the case of two zerolength handles or two coinciding handles > of which one has zerolength gives a straight line (segment), though. So > for that case it makes perfect sense to have zero curvature throughout > (and this actually follows from the description below). Taking a very special case does not make for a very strong argument ;) ;) Technically I guess you are correct (perhaps depending on the definition of curvature?). I think we should use a more intuitive definition of curvature perhaps... If one would arclengthreparametrise a zerolength handle segment, would it result in zerocurvature? In other words: if one reparametrises a segment, does that change the curvature, without visual differences? >> It is possible to make segments with and >> without a zerolength handle that look exactly the same. > It should not be, in general. (Fewer degrees of freedom.) I meant: zerolength handle segment > nonzero length handles segment. That goes in the direction of increasing degrees of freedom, so at least no worries for that matter. But perhaps it is indeed mathematically impossible. See attachment. >> Also, as you >> are moving the handle closer and closer to the knot, it does not >> converge to zero curvature, in fact it tends to lead to higher curvature >> instead of lower curvature. > There is essentially a bit of instability here. Yes, if you approach it > from most angles, then the curvature increases. However, if you follow > l'Hôpital's rule to compute the unit tangent vector at t=0 (so the > derivative divided by the norm of the derivative), or (which is a bit > easier), the derivative of y w.r.t. x, then you see that the unit > tangent vector at t=0 points to the second handle. If you then take the > limit as P2 approaches P1 from the direction of P2 (or opposite), you > get zero curvature. > > Also (just as an observation), as the handle gets smaller, its influence > decreases. So although locally you have a very large curvature, it's > only over a very small portion of the curve. Does that mean that as the handle goes to zero, it's region of influence tends to zero too and hence perhaps it is not very indicative of the visual curvature any more? >> Wouldn't l'Hopital imply that you can get >> away by using +1 higher derivs instead? > You're completely right. (If you intended taking the derivative of the > numerator and denominator and dividing those.) However, higher > derivatives can (and will) still be zero in this case, so this > complicates things a bit. (simply do the same "trick" again in those cases? ;) > > However, if you make the first handle zerolength, and then compute the > limit of the curvature as t goes to zero, then you find that the > curvature is equal to det([P3P1,P4P1]) divided by something that is > zero at t=0 and positive for t slightly above zero, as long as P3P1 is > not zerolength. Thus, if det([P3P1,P4P1])=0, (all points and handles > on a line), then the curvature at t=0 is zero, and otherwise it is > infinite with the sign of det([P3P1,P4P1]). > > So, I stand corrected, the rule isn't zerolength=zerocurvature, but > rather, a zerolength P1P0 implies that the curvature at P0 is either > infinity, zero or +infinity, depending on the sign of > det([P3P1,P4P1])=0. (Assuming at least some point does not coincide > with P1.) > I have an example attached where there are two paths: one with zerolength handle, and one 'normal' path. They are visually *very* similar; if you zoom in you will notice a small difference in angle and the end of the path on the righthand side. I think the normal path has a nonzero curvature (it is not straight at the end), so I thought the zerolength path would have the same curvature. Now there are two different viewpoints to a solution:  math. SVG definition  user Don't know which one to take... Cheers, Johan 