# [metapost] quadratic bezier paths ?

Dan Luecking luecking at uark.edu
Wed Apr 29 23:22:15 CEST 2009

```At 01:21 AM 4/29/2009, you wrote:

>    *** quadratic bezier paths ?
>
>Hi all,
>
>Jacko has proposed that linear paths be somehow known as linear to
>metapost (=MP). What are the motivations?  I'm not sure I could
>guess Jacko's.
>
>Actually, I would go at least one step further:-  make quadratic
>bezier curves known to MP.  One motivation might be to
>facilitate conversions between type1 fonts based on cubic bezier
>curves and truetype fonts based on quadratic bezier curves.
>
>Then one would have
>(where A,B,C,D,...,Z are points and t, u are numerics):
>
>  ** point = 0-bezier path  at a point, say A
>
>  ** linear path = 1-bezier path, A---D = A controls B and C .. D
>                                 where B = (2/3)*A + (1/3)*D and
>                                       C = (1/3)*A + (2/3)*D
>     I will use the symbol " --- ", which is (hopefully) foreign to MP.

It is a macro in plain.mp meaning "..tension infinity..". It puts
the control points within about epsilon of the endpoints. Maybe --
is better. It is a macro meaning "{curl 1}..{curl 1}". For some
reason {curl 1} forces the second derivative to be zero at that end.
(Why "curl 1" and not "curl 0"?) Of course, if it is zero at both ends
the bezier is linear.

>  ** parabolic path = 2-bezier path, with quadratic control vector
>     that I denote A---B---C (the MP notation is given below).
>
>  ** cubic path = 3-bezier path,  A---B---C---D, which is
>     A .. controls B and C .. D in MP notation.

It is unclear if you are proposing new data types. I am already
finding it hard to update my MP stuff to handle the new color
data types with backward compatability. I have to replace every
color assignment
A:=B;
and every color declaration
color A;
and every color test
if color A:
with macros that check what color type is needed before running
the appropriate command. Having to do that with paths too would
defeat me.

While there do exist straightforward conversions, it is almost
sure they cannot always be exactly undone. For example, if
cubicpath A is equated to parabolicpath B and the appropriate
cubic controls are computed for A, and then A is transformed
in a way that should preserve quadraticity, it is almost
certain that roundoff errors will make it no longer exactly