From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/67322 Path: news.gmane.org!not-for-mail From: Otared Kavian Newsgroups: gmane.comp.tex.context Subject: Re: Metfun macro for triangle Date: Thu, 24 Mar 2011 10:57:31 +0100 Message-ID: <00DC3FB2-8584-4D72-9DA3-12319B000906@gmail.com> References: <33B6C5DE-9240-4A26-9AE9-F0C362769AB2@gmail.com> <4D8B0EE1.2050506@gmx.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1300960960 1512 80.91.229.12 (24 Mar 2011 10:02:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 24 Mar 2011 10:02:40 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Mar 24 11:02:34 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 1Q2hNB-0007Iq-Dx for gctc-ntg-context-518@m.gmane.org; Thu, 24 Mar 2011 11:02:33 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 94EC7CAB43; Thu, 24 Mar 2011 11:02:09 +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 SRgvJbfetT+V; Thu, 24 Mar 2011 11:02:09 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A5B31CAB49; Thu, 24 Mar 2011 11:01:46 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C97F5CAB44 for ; Thu, 24 Mar 2011 11:01:45 +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 uBqFb3xaMe67 for ; Thu, 24 Mar 2011 11:01:43 +0100 (CET) Original-Received: from filter5-til.mf.surf.net (filter5-til.mf.surf.net [194.171.167.221]) by balder.ntg.nl (Postfix) with ESMTP id E4E2BCAB49 for ; Thu, 24 Mar 2011 11:01:43 +0100 (CET) Original-Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) by filter5-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p2OA1u7b021054 for ; Thu, 24 Mar 2011 11:01:57 +0100 Original-Received: by wwb28 with SMTP id 28so9796904wwb.2 for ; Thu, 24 Mar 2011 03:01:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id:references:to :x-mailer; bh=UxoL/SZGblXddunV9bsURlE6SbpJImmCpd3JopzAs8E=; b=Xt4EidOIvNR9d7Y/iLN+nUxhCGSzJ8gbd9CzB3jeBmhZU3GoKLMQyKllwLUxeehas9 yF1qlu5jTTT6I+J5nWdOXJ5fEmCCJ2nU037tmyy9ADj47IyrUsTid6X93DySD+or2yQ7 qQRtn6WaxUH2v5qUsGAoKuvOQXMUeAx0HxdVQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=i8HMRAc24b+WEnHD5BF5OWM7jkiyqH2++PvV41IItaX3hL0BNMhmP8kqDjZf6ZV34d ynsFyRSS+jm+GjZueyDzhy14bJSqTVm5dtWpEu76KTVDAq2d5aIguh9nl7lbivTBQWU6 z/V/txNeNlCVDNDTqMelYWyn7djExWnHyZPZY= Original-Received: by 10.227.131.9 with SMTP id v9mr9630wbs.6.1300960654418; Thu, 24 Mar 2011 02:57:34 -0700 (PDT) Original-Received: from [192.168.0.10] (mna75-3-82-66-231-76.fbx.proxad.net [82.66.231.76]) by mx.google.com with ESMTPS id h19sm4237263wbc.7.2011.03.24.02.57.32 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Mar 2011 02:57:33 -0700 (PDT) In-Reply-To: <4D8B0EE1.2050506@gmx.de> X-Mailer: Apple Mail (2.1084) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=74.125.82.45; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0xEmW1UaL - 2ce908f2b6b3 - 20110324 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.221 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:67322 Archived-At: Hi Stefan, Thanks for the quick answer and solution! Your solution works perfectly in mkiv; however typesetting with mkii result= s in ! Undefined control sequence. l.3 \startMPdefinitions Is there a solution with mkii? May I ask one more question? In the macro you wrote Triangle((0cm,0cm), (5cm,0cm), 8cm, 6cm) one has to specify the double of the length of each side (because a unit ci= rcle in MetaPost is a circle having diameter one). Would it be possible to = change slightly the lines p :=3D fullcircle scaled la shifted za ; q :=3D fullcircle scaled lb shifted zb ; so that la and lb are replaced with their doubled values? I tried p :=3D fullcircle scaled 2*la shifted za ; but this does not work. Thanks for your attention: OK On 24 mars 2011, at 10:29, Stefan M=FCller wrote: > Hi, > = > what about > = > \startMPdefinitions > vardef Triangle(expr za, zb, la, lb) =3D > path p, q ; > pair zc ; > pickup pencircle scaled 2mm ; > drawdot za ; > drawdot zb ; > p :=3D fullcircle scaled la shifted za ; > q :=3D fullcircle scaled lb shifted zb ; > zc =3D 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 s= ummits, say z0, z1, and the length of the two other sides are known, so tha= t the third summit, say z2, is completly determined. >> In order to draw one triangle the following works fine: >> = >> \setupcolors[state=3Dstart] >> \starttext >> \startMPcode >> z0 =3D (0cm,0cm) ; >> z1 =3D (5cm,0cm) ; >> path p, q ; = >> pickup pencircle scaled 2mm ; >> drawdot z0 ; >> drawdot z1 ; >> p :=3D halfcircle scaled 8 cm ; % twice the length of the second side a= t z0 >> p :=3D p shifted z0 ; >> q :=3D halfcircle scaled 6 cm ; % twice the length of the second side = at z1 >> q :=3D q shifted z1 ; >> z2 =3D 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 co= de 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 t= o the Wiki! >> = >> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-c= ontext >> 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-co= ntext > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > _________________________________________________________________________= __________ %%%%%%%%%%%%%%%%%% Otared Kavian D=E9partement de Math=E9matiques Universit=E9 de Versailles Saint-Quentin B=E2timent Fermat 45 avenue des Etats Unis 78035 Versailles cedex T=E9l=E9phone: +33 1 39 25 46 42 Secr=E9tariat: +33 1 39 25 46 44 = Secr=E9tariat: +33 1 39 25 46 46 e-mail: Otared.Kavian@math.uvsq.fr ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________