Hi, what about \startMPdefinitions vardef Triangle(expr za, zb, la, lb) = path p, q ; pair zc ; pickup pencircle scaled 2mm ; drawdot za ; drawdot zb ; p := fullcircle scaled la shifted za ; q := fullcircle scaled lb shifted zb ; zc = p intersectionpoint q ; drawdot zc ; pickup pencircle scaled 1mm ; za--zb--zc--cycle enddef; \stopMPdefinitions \starttext \startMPcode draw Triangle((0cm,0cm), (5cm,0cm), 8cm, 6cm) withcolor blue ; \stopMPcode \stoptext Stefan On 24.03.2011 09:59, Otared Kavian wrote:
Hi all,
I have a document in which I must draw several triangles for which two summits, say z0, z1, and the length of the two other sides are known, so that the third summit, say z2, is completly determined. In order to draw one triangle the following works fine:
\setupcolors[state=start] \starttext \startMPcode z0 = (0cm,0cm) ; z1 = (5cm,0cm) ; path p, q ; pickup pencircle scaled 2mm ; drawdot z0 ; drawdot z1 ; p := halfcircle scaled 8 cm ; % twice the length of the second side at z0 p := p shifted z0 ; q := halfcircle scaled 6 cm ; % twice the length of the second side at z1 q := q shifted z1 ; z2 = p intersectionpoint q ; drawdot z2 ; pickup pencircle scaled 1mm ; draw z0--z1--z2--cycle withcolor blue ; \stopMPcode \stoptext
However I would like to have a macro, for instance named Triangle, which accepts four arguments z0,z1, length_1, length_2, so that in a MetaPost code i can use draw Triangle(z0,z1, 4, 3) withcolor blue ; in order to draw the above triangle. Has anyone any idea about how to do this?
Thanks in advance for your help: OK ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________