From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/67317 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Stefan_M=FCller?= Newsgroups: gmane.comp.tex.context Subject: Re: Metfun macro for triangle Date: Thu, 24 Mar 2011 10:29:05 +0100 Message-ID: <4D8B0EE1.2050506@gmx.de> References: <33B6C5DE-9240-4A26-9AE9-F0C362769AB2@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1300958967 22580 80.91.229.12 (24 Mar 2011 09:29:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 24 Mar 2011 09:29:27 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Mar 24 10:29:23 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2gr5-0006p3-Hb for gctc-ntg-context-518@m.gmane.org; Thu, 24 Mar 2011 10:29:23 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 71515CAB2F; Thu, 24 Mar 2011 10:29:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id vkA77fdBwF2H; Thu, 24 Mar 2011 10:29:06 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 27250CAB31; Thu, 24 Mar 2011 10:29:06 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 5C97DCAB31 for ; Thu, 24 Mar 2011 10:29:04 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Wh9EqqPIbq8e for ; Thu, 24 Mar 2011 10:29:02 +0100 (CET) Original-Received: from filter1-til.mf.surf.net (filter1-til.mf.surf.net [194.171.167.217]) by balder.ntg.nl (Postfix) with ESMTP id DCD29CAB2F for ; Thu, 24 Mar 2011 10:29:01 +0100 (CET) Original-Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by filter1-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with SMTP id p2O9TCFC001347 for ; Thu, 24 Mar 2011 10:29:15 +0100 Original-Received: (qmail invoked by alias); 24 Mar 2011 09:29:12 -0000 Original-Received: from 77-64-138-214.dynamic.primacom.net (EHLO [192.168.100.108]) [77.64.138.214] by mail.gmx.net (mp071) with SMTP; 24 Mar 2011 10:29:12 +0100 X-Authenticated: #11064435 X-Provags-ID: V01U2FsdGVkX1+QsA4j5xGQ4FSSNZ69+V3Ui/o6czRtylH4JQezaJ mTCTh3LCONFXUS User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: <33B6C5DE-9240-4A26-9AE9-F0C362769AB2@gmail.com> X-Y-GMX-Trusted: 0 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.165.64.23; country=DE; latitude=51.0000; longitude=9.0000; http://maps.google.com/maps?q=51.0000,9.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 08EmVtcic - 619d828fb4d1 - 20110324 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.217 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:67317 Archived-At: 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 > ___________________________________________________________________________________ > ___________________________________________________________________________________ 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 ___________________________________________________________________________________