[NTG-context] Metafun: how to draw a straight line past the end points
Otared Kavian
otared at gmail.com
Wed Dec 9 18:11:23 CET 2020
Hi Fabrice,
Thanks a lot ! Indeed that does the job, which shows how wonderful Metafun is !
Best regards: Otared
> On 9 Dec 2020, at 17:19, Fabrice L <fabrice.alpha at gmail.com> wrote:
>
> Hi,
>
>> Le 9 déc. 2020 à 10:57, Otared Kavian <otared at gmail.com> a écrit :
>>
>> Hi,
>>
>> I have a silly question: given two points in the plane
>> z1 = (1cm,3cm) ;
>> z2 = (5cm, 9cm) ;
>> the command
>> draw z1 -- z2 withpen pencircle scaled .5pt ;
>> draws the line segment joining z1 and z2. How could I draw the line segment which goes a little further (say 1cm) than both the end points of this segment (that is in this example, a point before z1 and a point after z2 on the straight line) .
>> Indeed it is possible to write the equation of the line and then compute by hand the coordinates of the new end points, but I think there is a simpler way in Metafun to do this.
>
> The shortened operation is the solution ! See MetaFun manual section 1.18
>
> \starttext
> \startMPpage
> z1 = (1cm,3cm) ;
> z2 = (5cm, 9cm) ;
> draw (z1--z2) shortened -1cm withcolor blue ;
> draw (z1--z2) withcolor red ;
>
> \stopMPpage
> \stoptext
>
> Fabrice.
>
>>
>> Thanks for any help: Otared
>>
>>
>> ___________________________________________________________________________________
>> If your question is of interest to others as well, please add an entry to the Wiki!
>>
>> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>> ___________________________________________________________________________________
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
More information about the ntg-context
mailing list