ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Otared Kavian <otared@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Metfun macro for triangle
Date: Thu, 24 Mar 2011 09:59:09 +0100	[thread overview]
Message-ID: <33B6C5DE-9240-4A26-9AE9-F0C362769AB2@gmail.com> (raw)

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
___________________________________________________________________________________


             reply	other threads:[~2011-03-24  8:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24  8:59 Otared Kavian [this message]
2011-03-24  9:29 ` Stefan Müller
2011-03-24  9:57   ` Otared Kavian
2011-03-24 10:29     ` Stefan Müller
2011-03-24 13:16       ` Otared Kavian
2011-03-24 14:14       ` Aditya Mahajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33B6C5DE-9240-4A26-9AE9-F0C362769AB2@gmail.com \
    --to=otared@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).