[metapost] Some observations on turning and self intersection

Werner LEMBERG wl at gnu.org
Sat Feb 5 04:19:25 CET 2005


> I attempted to find all possible ways a cubic Bezier could behave.
> [...]

Thanks for your analysis!

> The formula for k(t) is
>    k(t)/6 = (a x b)(1-t)^2 + (a x c)(1-t)t (b x c)t^2
> where a = postcontrol 0 of f - point 0 of f
>        b = precontrol 1 of f - postcontrol 0 of f
> and   c = point 1 of f - precontrol 0 of f
> 
> The condition for a loop is then  (a x c)^2 < 4(a x b)(b x c).

This is basically the same what Giuseppe has posted a few days ago.
The disadvantage of computing the cross product is that its components
can become very large.

In an answer to Giuseppe's mail I provided a simpler (less time
consuming) constraint which must be fulfilled so that a
self-intersection can happen, but maybe this is not necessary if
clever reformulation of your result can avoid overflows.


    Werner



More information about the metapost mailing list