[metapost] Fwd: Honza's puzzler

Laurence Finston lfinsto1 at gwdg.de
Mon Jan 17 22:08:05 CET 2005


------ Forwarded message -------


From: Larry Siebenmann <laurent at math.toronto.edu>
To: help-3dldf at gnu.org, laurent at math.toronto.edu, lfinsto1 at gwdg.de,  
metafont at ens.fr, pracj3am at mbox.troja.mff.cuni.cz
Date: Mon, 17 Jan 2005 15:41:56 -0500



On Mon, 17 Jan 2005 14:06:11, on the metapost at tug.org list, Honza
Prachar <pracj3am at mbox.troja.mff.cuni.cz> wrote :

 > Hello!
 > 
 > Do you have any idea how to do a tangent to path p from point z.
 > 
 > `Honza` Prachar

Hi 'Honza'!

That is a cherry-bomb in a tearoom  ;-)  We like to think that
MP/MF does simple things with gracefully!

     The condition of tangency is that the two vectors in R^2 that
are repectively the t-derivative  p'(t) and the difference 
 p(t) - z be linearly dependent. But linear dependency occurs if
and only if the following determinant condition holds:

      D(t) := det( p'(t) , p(t) - z ) = 0    

     This determinant is clearly of degree 5 in t, at most. But
inspection shows that the term of degree 5 in t vanishes. So the
degree is 4 or less.  D(t)  is, in fact, generically of degree 4 in
t. One can see this geometrically by considering any bezier cubic
with a double point. Taking arbitrary z in the region 'just below'
the double point there are obviously four distinct lines on point z
tangent to path p.

                      xxx
        
                xxxx        xxxx        
        
            xxx                   xxx        
        
           xx                       xx
        
            xxx                   xxx        
        
                xxxx        xxxx        
        
                     xxxxx
        
               xxxxx   Z    xxxxx       
        
        xxxxxx                     xxxxxx        
        
xxxxxx                                     xxxxxxx       

     Now if MP could intersect quartic bezier curves is would be a
simple matter to find the roots:- just intersect
the line x=0 with the curve q(t)=(t,D(t)). 

     Until then, since quartics are solvable by extraction of
square roots, one can squeeze an (excruciatingly boring?) solution
out of metafont -- using sqrt.

     But there may still exist an elegant geometrical solution
within MP ...

Cheers

Laurent S.



More information about the metapost mailing list