From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/82370 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: command for a MP graphic Date: Tue, 7 May 2013 13:05:43 +0200 Message-ID: References: <20130507075149.GM663@homerow> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1367924761 27023 80.91.229.3 (7 May 2013 11:06:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 May 2013 11:06:01 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue May 07 13:06:02 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UZfib-0001FX-L4 for gctc-ntg-context-518@m.gmane.org; Tue, 07 May 2013 13:06:01 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E6451101E7; Tue, 7 May 2013 13:06:00 +0200 (CEST) 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 SK1gqLlhFvop; Tue, 7 May 2013 13:05:59 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 1BA64101E4; Tue, 7 May 2013 13:05:59 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 521BC101E4 for ; Tue, 7 May 2013 13:05:57 +0200 (CEST) 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 CDvEVqMx6ISO for ; Tue, 7 May 2013 13:05:56 +0200 (CEST) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by balder.ntg.nl (Postfix) with ESMTP id 52F03101E0 for ; Tue, 7 May 2013 13:05:46 +0200 (CEST) Original-Received: from mail-ea0-x234.google.com (mail-ea0-x234.google.com [IPv6:2a00:1450:4013:c01::234]) by filter2-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r47B5jib005680 for ; Tue, 7 May 2013 13:05:45 +0200 Original-Received: by mail-ea0-f180.google.com with SMTP id g14so214641eak.25 for ; Tue, 07 May 2013 04:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=qSoViv6oIhUEmifOOgtFAPAG7/ILjmcoqIyNTPr2QA4=; b=gjMp4A5+y7yJpaGO/T8OJb1olK2nLVCb6rQ9dgfJSfOsq9HhkIuE9Kx5OEQcbeIo8Y vOolGrQIpTB4DrCihcPrLQD0+lw/JAM0Wet2TdV0JYJe2P0tZs+kW2xbHEcIafF8+yw1 5USzg90ENULqWTAZx47xAYemhJp3PvUV0Ypvh+5y4u25qcne4AoHqK8LvIsM3vorZPo3 A+riYctsFcNr7aJ2/icetJDw1cSGpR0GELHtwBMZr86Yg2B2vzbUmHpLtuIgp+fkVaiF Z2P2DYETkMClp3crYIbHyRswVJGfk77bOVW2tsUspOIodNaV2AacKHqhcE3+QGcPyJLz OPIA== X-Received: by 10.14.108.1 with SMTP id p1mr4245080eeg.31.1367924744166; Tue, 07 May 2013 04:05:44 -0700 (PDT) Original-Received: from keima.localdomain (nrbg-4d07269a.pool.mediaWays.net. [77.7.38.154]) by mx.google.com with ESMTPSA id i3sm38657882eev.1.2013.05.07.04.05.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 May 2013 04:05:43 -0700 (PDT) In-Reply-To: <20130507075149.GM663@homerow> X-Mailer: Apple Mail (2.1503) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=2a00:1450:4013:c01::234; country=IE X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0TJwX5J99 - 0be238548117 - 20130507 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:82370 Archived-At: Am 07.05.2013 um 09:51 schrieb Marco Patzer : > On 2013=9605=9607 Roland Thiers wrote: > = >> Hi, >> I did this code to get a regular polygon with metafun, it works but >> I would like to have an user command like \define or \def >> to be able to choose the number of sides, n. I don't know how to do >> that ... > = > Here's one way to do it: > = > \startuniqueMPgraphic{polygoneregulier}{sides} > drawoptions (withpen pencircle scaled 2pt); > numeric u ; u:=3D1*cm ; > numeric n ; n:=3D\MPvar{sides}; > pair a[]; > a[0]:=3D(0,3u); > path polygone[] ; > for i=3D1 upto n : > a[i]:=3Da[0] rotatedaround(origin,i*360/n) ; > polygone[i]:=3Da[i-1]--a[i]; > draw polygone[i]; endfor; > draw fullcircle scaled 6u withcolor blue; > \stopuniqueMPgraphic > = > %% \polyreg{} > \define[1]\polyreg > {\setupMPvariables[polygoneregulier][sides=3D#1]%% > \uniqueMPgraphic{polygoneregulier}} \define[1]\polyreg {\uniqueMPgraphic{polygoneregulier}{sides=3D#1}} Wolfgang ___________________________________________________________________________= ________ 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 ___________________________________________________________________________= ________