Hi Aditya, Thanks for the alternative method, which comes handy if one wishes to extend the straight line by a different amount at either end: \starttext \startMPcode z1 = (1cm,3cm) ; z2 = (5cm, 9cm) ; z3 = 1cm * dir(angle (z2 - z1)) shifted z2 ; z4 = -.5cm*dir(angle(z2 - z1)) shifted z1 ; draw z1 -- z3 ; draw z4 -- z1 ; draw z1 -- z2 withcolor red ; \stopMPcode \stoptext Best regards: Otared
On 9 Dec 2020, at 18:37, Aditya Mahajan
wrote: On Wed, 9 Dec 2020, Otared Kavian wrote:
Thanks a lot ! Indeed that does the job, which shows how wonderful Metafun is !
Or, if you want to use high school algebra:
\starttext \startMPcode z1 = (1cm,3cm) ; z2 = (5cm, 9cm) ; z3 = 1cm * dir(angle (z2 - z1)) shifted z2; draw z1 -- z3 ; draw z1 -- z2 withcolor red; \stopMPcode \stoptext
Aditya ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@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 ___________________________________________________________________________________