From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/56636 Path: news.gmane.org!not-for-mail From: James Fisher Newsgroups: gmane.comp.tex.context Subject: Re: METAPOST's superellipse with superness<0.5 does not give a superellipse Date: Tue, 2 Mar 2010 21:40:40 +0000 Message-ID: <771da05a1003021340v30779479pbb79c80a61e7464e@mail.gmail.com> References: <771da05a1003010754x6638a08dnb898df3c6766cc8@mail.gmail.com> <771da05a1003010804i409db847tdfe45c7626dea6c8@mail.gmail.com> <9db72ac71003010820s7e6f8545ta7399b2c8c4e4f6b@mail.gmail.com> <771da05a1003010957k30a4c4c0tc4a494dbe5188618@mail.gmail.com> <9db72ac71003011115u3f22df2ag54e904fc67217a8e@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2019150307==" X-Trace: dough.gmane.org 1267566057 20169 80.91.229.12 (2 Mar 2010 21:40:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 2 Mar 2010 21:40:57 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Mar 02 22:40:52 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from [195.12.62.10] (helo=balder.ntg.nl) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NmZpj-0008Gz-Qa for gctc-ntg-context-518@m.gmane.org; Tue, 02 Mar 2010 22:40:51 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 50633C9D9B; Tue, 2 Mar 2010 22:40:51 +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 TC+FZ7iv1N1C; Tue, 2 Mar 2010 22:40:46 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 88395C9D1E; Tue, 2 Mar 2010 22:40:46 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D24B8C9D1E for ; Tue, 2 Mar 2010 22:40: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 ZKQTmTLntvDm for ; Tue, 2 Mar 2010 22:40:41 +0100 (CET) Original-Received: from ey-out-1920.google.com (ey-out-1920.google.com [74.125.78.148]) by balder.ntg.nl (Postfix) with ESMTP id 9A02AC9CF7 for ; Tue, 2 Mar 2010 22:40:41 +0100 (CET) Original-Received: by ey-out-1920.google.com with SMTP id 3so537364eyh.2 for ; Tue, 02 Mar 2010 13:40:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=hSZEU+ATOSjD7O516TJp2B3y3HoouWCCsyzhmIzatIk=; b=bwnKT+YWz51T+uyKg56DFvyayx1LdU+iTmGNMPJiSAted4kXLR/wRlAxmGO5PeYEA8 bHxkKYMfdYCkJhPQYXxb5HQR/j8NJLqBSc2sBa2b5GH97AM5uXCwyUtBGoucPhul62hf UfosmIeLtSaGnE2AEVOgXvgIkCW6fsZ+1aUMQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=feOSo/OqDzAM2umLj1UcYmsSeMUoHPsf1miPhd5IJ0UgA9FnUUYgNMXNc/N0k+DBEZ rncLl7Wk1qROOKF2TwH6PtQxT3XYeckjqF00gMIlzuTm0O1BDayo0Su+njaT2zvFnV/i uEBc7WxlSN0/9ZiMADeib0CtaLzweyvY1iftQ= Original-Received: by 10.213.100.231 with SMTP id z39mr4994233ebn.39.1267566041087; Tue, 02 Mar 2010 13:40:41 -0800 (PST) In-Reply-To: <9db72ac71003011115u3f22df2ag54e904fc67217a8e@mail.gmail.com> 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:56636 Archived-At: --===============2019150307== Content-Type: multipart/alternative; boundary=001636c5b90f9bc1080480d837c3 --001636c5b90f9bc1080480d837c3 Content-Type: text/plain; charset=ISO-8859-1 Thanks, Rory. In hind-sight I guess my presumptions look pretty silly. The reason I'm making mistakes like this is that I can't find any introductory text along the lines of 'TeX for programmers'; i.e. people coming from your typical modern imperative languages, who will (after looking at TeX code and concluding that it *is* a programming language) expect things like variables, flow control, classes, and the kind of and syntax of library documentation that comes with these languages. Perhaps the texts I've seen should have included some content taken from function vs. macrodiscussions elsewhere. Best James On Mon, Mar 1, 2010 at 7:15 PM, Rory Molinari wrote: > For 2: I think Metafont makes more sense if you don't think of a macro > as a function that does some work in its own context and returns a > value, but as something that expands textually in place. So there > isn't any concept of "return" as there aren't separate stack frames to > return "from" or "to". > > So you could try something like this (completely untested, and I am a > Metafont beginner. This is from memory, so check the book for the > right syntax, especially for the semicolons.) > > def myPath() = > begingroup > save tr, tl, bl, br; > pair tr, tl, bl, br; > ; > > ; > endgroup; > enddef; > > path aPath; > aPath := myPath(); > fill aPath; > > The construction > > begingroup > ; > ; > endgroup; > > lets you do some work in , and then give an . > The value of the group is the value of the . The value > isn't really "returned"; it just appears wherever a "call" to myPath > appears. Then the assignment to aPath is expanded by the interpreter > as > > aPath := begingroup endgroup; > > Cheers, > Rory > > On Mon, Mar 1, 2010 at 9:57 AM, James Fisher > wrote: > > I've come up with a crude function that's doing more like what I want. I > > have two problems with it: > > > > 1. The most important: I need to differentiate the equations that > generate a > > superellipse, in order to find the tangent at the defined vertices. I > have > > failed to do this and so use a crude arbitrary power function. > > 2. Less important: what is the equivalent in METAFONT of the 'return' > > keyword? I just want superellipse() to return the shape, rather than > draw > > it. > > > > James > > > > def superellipse(expr r,t,l,b,s)= > > pair tr, tl, bl, br; > > tr = (s[xpart t,xpart r],s[ypart r,ypart t]); > > tl = (s[xpart t,xpart l],s[ypart l,ypart t]); > > bl = (s[xpart b,xpart l],s[ypart l,ypart b]); > > br = (s[xpart b,xpart r],s[ypart r,ypart b]); > > > > numeric theta; > > > > > > if s > 0.5: > > % Behave as in the normal superellipse function > > theta = 0; > > else: > > % This is a crude mockup of the kind of function that is required > > % to generate shapes with s<0.5 (apparently called astroids). > > % This satisfies: > > % > > % s = 0.5, theta = 0.5 > > % s = 0, theta = 90 > > % > > % But to find the actual function, > > % we need to differentiate, at an endpoint, > > % the equation that would produce one quadrant of the shape. > > > > theta = 90 - (s*s*s*7.11378661); > > fi > > > > fill r{dir(90+theta)} ... tr{t-r} ... {dir(180-theta)}t & > > t{dir(180+theta)} ... tl{l-t} ... {dir(270-theta)}l & > > l{dir(270+theta)} ... bl{b-l} ... {dir(-theta)}b & > > b{dir(theta)} ... br{r-b} ... {dir(90-theta)}r & > > cycle; > > enddef; > > > > beginfig(0); > > superellipse( > > ( 100, 50 ), > > ( 50, 100 ), > > ( 0, 50 ), > > ( 50, 0 ), > > 0.6 > > ); > > endfig; > > > > end; > > > > > > On Mon, Mar 1, 2010 at 4:20 PM, Rory Molinari wrote: > >> > >> James's explanation appears to be right. > >> > >> On p 126 of the METAFONTbook Knuth says that the "superness should be > >> between 0.5 (when you get a diamond) and 1.0 (when you get a square)". > >> > >> Exercise 14.6 asks the reader to "Try superellimpse with superness > >> values less than 0.5 or greater than 1.0; explain why you get weird > >> shapes in such cases." The answer is "There are inflection points, > >> because there are no bounding triangles for the '...' operations in > >> the superellipse macro ... unless 0.5 \leq s \leq 1." > >> > >> Cheers, > >> Rory > >> > >> On Mon, Mar 1, 2010 at 8:04 AM, James Fisher > >> wrote: > >> > I should say that the vertices of the superellipse are calculated > >> > correctly. The problem, it seems, is that for the vertices at right, > >> > top, > >> > left, and bottom, the angles of entry and exit need to be explicitly > >> > defined, rather than just relying on the '...' which coincidentally > >> > works > >> > for s>=0.5. > >> > > >> > I should say at this point that I am no maths whiz. But, sticking > with > >> > the > >> > 'right ... topright ... top' line, the angle calculation needs to > >> > satisfy, > >> > for the exit angle of the first vertex: > >> > > >> > For s=0, angle = 180 degrees (vector to the left) > >> > For s = 0.5, angle = 135 degrees (45 degrees to the top left, > producing > >> > a > >> > straight line to create the diamond shape) > >> > For s>0.5, angle = 90 degrees (vector vertically upwards) > >> > > >> > Suffice to say that I don't know how to produce that elegantly. > >> > > >> > > >> > > >> > James > >> > > >> > > >> > On Mon, Mar 1, 2010 at 3:54 PM, James Fisher > >> > wrote: > >> >> > >> >> Hi again, > >> >> > >> >> > >> >> Another METAPOST problem. For the sake of curiosity, I've been > looking > >> >> at > >> >> and playing with the superellipse() function in plain METAPOST. This > >> >> is all > >> >> fine and dandy until I try values of 'superness' less than 0.5, in > >> >> which > >> >> case it generates shapes that are seemingly not superellipses. At > >> >> s=0.5, > >> >> the function generates a diamond shape -- which, AFAIK, is correct. > >> >> However, s<0.5, the points of the diamond immediately turn to curves. > >> >> (My > >> >> knowledge of superellipses here is just from > >> >> http://en.wikipedia.org/wiki/Superellipse -- try the image at > >> >> http://en.wikipedia.org/wiki/File:Lame_anima.gif to see how I expect > >> >> the > >> >> shape to change with varying values of superness). > >> >> > >> >> Some code follows -- perhaps someone could run it and tell me if, for > >> >> starters, they get the same as me. (See > >> >> http://i49.tinypic.com/2ijqatl.jpg > >> >> for superellipse() with s=0.3). > >> >> > >> >> > >> >> Best, > >> >> > >> >> > >> >> James > >> >> > >> >> > >> >> > >> >> % The following is a superellipse function at > >> >> > >> >> < > http://lists.foundry.supelec.fr/pipermail/metapost-commits/2008-June/000340.html > >; > >> >> % I think it's the superellipse function in my copy of METAPOST; it > at > >> >> least has the same behaviour. > >> >> % It seems to calculate the vertices correctly, but not the way they > >> >> join > >> >> (try changing all ... to --). > >> >> % > >> >> %def superellipse(expr r,t,l,b,s)= > >> >> % r ... (s[xpart t,xpart r],s[ypart r,ypart t]){t-r} ... > >> >> % t ... (s[xpart t,xpart l],s[ypart l,ypart t]){l-t} ... > >> >> % l ... (s[xpart b,xpart l],s[ypart l,ypart b]){b-l} ... > >> >> % b ... (s[xpart b,xpart r],s[ypart r,ypart b]){r-b} ... cycle > >> >> %enddef; > >> >> > >> >> def supertest expr s = > >> >> superellipse( > >> >> ( 100, 50 ), > >> >> ( 50, 100 ), > >> >> ( 0, 50 ), > >> >> ( 50, 0 ), > >> >> s > >> >> ); > >> >> enddef; > >> >> > >> >> % These >0 supernesses are fine, I think ... > >> >> > >> >> beginfig(0); > >> >> draw supertest 2; > >> >> endfig; > >> >> > >> >> beginfig(1); > >> >> draw supertest 1.01; > >> >> endfig; > >> >> > >> >> % The following, 0.5>=superness<=1, > >> >> % are from visual reference definitely right > >> >> > >> >> beginfig(2); > >> >> draw supertest 1; > >> >> endfig; > >> >> > >> >> beginfig(3); > >> >> draw supertest 0.99; > >> >> endfig; > >> >> > >> >> beginfig(4); > >> >> draw supertest 0.7; > >> >> endfig; > >> >> > >> >> beginfig(5); > >> >> draw supertest 0.51; > >> >> endfig; > >> >> > >> >> beginfig(6); > >> >> draw supertest 0.5; > >> >> endfig; > >> >> > >> >> % Now, for <0.5, > >> >> % things get problematic -- > >> >> % the points in the shape generated by s=0.5 > >> >> % should stay 'pointy' > >> >> > >> >> beginfig(7); > >> >> draw supertest 0.49; > >> >> endfig; > >> >> > >> >> beginfig(8); > >> >> draw supertest 0.3; > >> >> endfig; > >> >> > >> >> beginfig(9); > >> >> draw supertest 0.01; > >> >> endfig; > >> >> > >> >> beginfig(10); > >> >> draw supertest 0; > >> >> endfig; > >> >> > >> >> end; > >> >> > >> > > >> > > >> > > >> > > ___________________________________________________________________________________ > >> > 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 > >> > >> > ___________________________________________________________________________________ > > > > > > > ___________________________________________________________________________________ > > 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 > > ___________________________________________________________________________________ > --001636c5b90f9bc1080480d837c3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks, Rory.=A0 In hind-sight I guess my presumptions look pretty silly.= =A0 The reason I'm making mistakes like this is that I can't find a= ny introductory text along the lines of 'TeX for programmers'; i.e.= people coming from your typical modern imperative languages, who will (aft= er looking at TeX code and concluding that it *is* a programming language) = expect things like variables, flow control, classes, and the kind of and sy= ntax of library documentation that comes with these languages.=A0 Perhaps t= he texts I've seen should have included some content taken from function vs. macro disc= ussions elsewhere.

Best

James

On Mon, Mar 1, 2010= at 7:15 PM, Rory Molinari <quokka@gmail.com> wrote:
For 2: I think Metafont makes more sense if you don't think of a macro<= br> as a function that does some work in its own context and returns a
value, but as something that expands textually in place. =A0So there
isn't any concept of "return" as there aren't separate st= ack frames to
return "from" or "to".

So you could try something like this (completely untested, and I am a
Metafont beginner. =A0This is from memory, so check the book for the
right syntax, especially for the semicolons.)

def myPath(<args>) =3D
=A0begingroup
=A0 =A0save tr, tl, bl, br;
=A0 =A0pair tr, tl, bl, br;
=A0 =A0<some equations involving tr, tl, bl, br, and the args>= ;

=A0 =A0<a path expression>;
=A0endgroup;
enddef;

path aPath;
aPath :=3D myPath(<args>);
fill aPath;

The construction

begingroup
=A0<statements>;
=A0<expression>;
endgroup;

lets you do some work in <statements>, and then give an <expressio= n>.
The value of the group is the value of the <expression>. =A0The value=
isn't really "returned"; it just appears wherever a "cal= l" to myPath
appears. =A0Then the assignment to aPath is expanded by the interpreter
as

aPath :=3D begingroup <etc> endgroup;

Cheers,
Rory

On Mon, Mar 1, 2010 at 9:57 AM, James Fisher <jameshfisher@gmail.com> wrote:
> I've come up with a crude function that's doing more like what= I want.=A0 I
> have two problems with it:
>
> 1. The most important: I need to differentiate the equations that gene= rate a
> superellipse, in order to find the tangent at the defined vertices.=A0= I have
> failed to do this and so use a crude arbitrary power function.
> 2. Less important: what is the equivalent in METAFONT of the 'retu= rn'
> keyword?=A0 I just want superellipse() to return the shape, rather tha= n draw
> it.
>
> James
>
> def superellipse(expr r,t,l,b,s)=3D
> =A0 pair tr, tl, bl, br;
> =A0 tr =3D (s[xpart t,xpart r],s[ypart r,ypart t]);
> =A0 tl =3D (s[xpart t,xpart l],s[ypart l,ypart t]);
> =A0 bl =3D (s[xpart b,xpart l],s[ypart l,ypart b]);
> =A0 br =3D (s[xpart b,xpart r],s[ypart r,ypart b]);
>
> =A0 numeric theta;
>
>
> =A0 if s > 0.5:
> =A0=A0=A0 % Behave as in the normal superellipse function
> =A0=A0=A0 theta =3D 0;
> =A0 else:
> =A0=A0=A0 % This is a crude mockup of the kind of function that is req= uired
> =A0=A0=A0 % to generate shapes with s<0.5 (apparently called astroi= ds).
> =A0=A0=A0 % This satisfies:
> =A0=A0=A0 %
> =A0=A0=A0 %=A0=A0 s =3D 0.5,=A0 theta =3D 0.5
> =A0=A0=A0 %=A0=A0 s =3D 0,=A0=A0=A0 theta =3D 90
> =A0=A0=A0 %
> =A0=A0=A0 % But to find the actual function,
> =A0=A0=A0 % we need to differentiate, at an endpoint,
> =A0=A0=A0 % the equation that would produce one quadrant of the shape.=
>
> =A0=A0=A0 theta =3D 90 - (s*s*s*7.11378661);
> =A0 fi
>
> =A0 fill=A0 r{dir(90+theta)} ... tr{t-r} ... {dir(180-theta)}t & > =A0=A0=A0=A0=A0=A0=A0 t{dir(180+theta)} ... tl{l-t} ... {dir(270-theta= )}l &
> =A0=A0=A0=A0=A0=A0=A0 l{dir(270+theta)} ... bl{b-l} ... {dir(-theta)}b= &
> =A0=A0=A0=A0=A0=A0=A0 b{dir(theta)} ... br{r-b} ... {dir(90-theta)}r &= amp;
> =A0=A0=A0=A0=A0=A0=A0 cycle;
> enddef;
>
> beginfig(0);
> =A0 superellipse(
> =A0=A0=A0 ( 100, 50=A0 ),
> =A0=A0=A0 ( 50,=A0 100 ),
> =A0=A0=A0 ( 0,=A0=A0 50=A0 ),
> =A0=A0=A0 ( 50,=A0 0=A0=A0 ),
> =A0=A0=A0 0.6
> =A0=A0=A0 );
> endfig;
>
> end;
>
>
> On Mon, Mar 1, 2010 at 4:20 PM, Rory Molinari <quokka@gmail.com> wrote:
>>
>> James's explanation appears to be right.
>>
>> On p 126 of the METAFONTbook Knuth says that the "superness s= hould be
>> between 0.5 (when you get a diamond) and 1.0 (when you get a squar= e)".
>>
>> Exercise 14.6 asks the reader to "Try superellimpse with supe= rness
>> values less than 0.5 or greater than 1.0; explain why you get weir= d
>> shapes in such cases." =A0The answer is "There are infle= ction points,
>> because there are no bounding triangles for the '...' oper= ations in
>> the superellipse macro ... unless 0.5 \leq s \leq 1."
>>
>> Cheers,
>> Rory
>>
>> On Mon, Mar 1, 2010 at 8:04 AM, James Fisher <jameshfisher@gmail.com>
>> wrote:
>> > I should say that the vertices of the superellipse are calcul= ated
>> > correctly.=A0 The problem, it seems, is that for the vertices= at right,
>> > top,
>> > left, and bottom, the angles of entry and exit need to be exp= licitly
>> > defined, rather than just relying on the '...' which = coincidentally
>> > works
>> > for s>=3D0.5.
>> >
>> > I should say at this point that I am no maths whiz.=A0 But, s= ticking with
>> > the
>> > 'right ... topright ... top' line, the angle calculat= ion needs to
>> > satisfy,
>> > for the exit angle of the first vertex:
>> >
>> > For s=3D0, angle =3D 180 degrees (vector to the left)
>> > For s =3D 0.5, angle =3D 135 degrees (45 degrees to the top l= eft, producing
>> > a
>> > straight line to create the diamond shape)
>> > For s>0.5, angle =3D 90 degrees (vector vertically upwards= )
>> >
>> > Suffice to say that I don't know how to produce that eleg= antly.
>> >
>> >
>> >
>> > James
>> >
>> >
>> > On Mon, Mar 1, 2010 at 3:54 PM, James Fisher <jameshfisher@gmail.com>
>> > wrote:
>> >>
>> >> Hi again,
>> >>
>> >>
>> >> Another METAPOST problem.=A0 For the sake of curiosity, I= 've been looking
>> >> at
>> >> and playing with the superellipse() function in plain MET= APOST.=A0 This
>> >> is all
>> >> fine and dandy until I try values of 'superness' = less than 0.5, in
>> >> which
>> >> case it generates shapes that are seemingly not superelli= pses.=A0 At
>> >> s=3D0.5,
>> >> the function generates a diamond shape -- which, AFAIK, i= s correct.
>> >> However, s<0.5, the points of the diamond immediately = turn to curves.
>> >> (My
>> >> knowledge of superellipses here is just from
>> >> http://en.wikipedia.org/wiki/Superellipse -- try the ima= ge at
>> >> http://en.wikipedia.org/wiki/File:Lame_anima.gif = to see how I expect
>> >> the
>> >> shape to change with varying values of superness).
>> >>
>> >> Some code follows -- perhaps someone could run it and tel= l me if, for
>> >> starters, they get the same as me.=A0 (See
>> >> http://i49.tinypic.com/2ijqatl.jpg
>> >> for superellipse() with s=3D0.3).
>> >>
>> >>
>> >> Best,
>> >>
>> >>
>> >> James
>> >>
>> >>
>> >>
>> >> % The following is a superellipse function at
>> >>
>> >> <http://lists.foun= dry.supelec.fr/pipermail/metapost-commits/2008-June/000340.html>; >> >> % I think it's the superellipse function in my copy o= f METAPOST; it at
>> >> least has the same behaviour.
>> >> % It seems to calculate the vertices correctly, but not t= he way they
>> >> join
>> >> (try changing all ... to --).
>> >> %
>> >> %def superellipse(expr r,t,l,b,s)=3D
>> >> %=A0 r ... (s[xpart t,xpart r],s[ypart r,ypart t]){t-r} .= ..
>> >> %=A0 t ... (s[xpart t,xpart l],s[ypart l,ypart t]){l-t} .= ..
>> >> %=A0 l ... (s[xpart b,xpart l],s[ypart l,ypart b]){b-l} .= ..
>> >> %=A0 b ... (s[xpart b,xpart r],s[ypart r,ypart b]){r-b} .= .. cycle
>> >> %enddef;
>> >>
>> >> def supertest expr s =3D
>> >> =A0 superellipse(
>> >> =A0=A0=A0 ( 100, 50=A0 ),
>> >> =A0=A0=A0 ( 50,=A0 100 ),
>> >> =A0=A0=A0 ( 0,=A0=A0 50=A0 ),
>> >> =A0=A0=A0 ( 50,=A0 0=A0=A0 ),
>> >> =A0=A0=A0 s
>> >> =A0=A0=A0 );
>> >> enddef;
>> >>
>> >> % These >0 supernesses are fine, I think ...
>> >>
>> >> beginfig(0);
>> >> =A0 draw supertest 2;
>> >> endfig;
>> >>
>> >> beginfig(1);
>> >> =A0 draw supertest 1.01;
>> >> endfig;
>> >>
>> >> % The following, 0.5>=3Dsuperness<=3D1,
>> >> % are from visual reference definitely right
>> >>
>> >> beginfig(2);
>> >> =A0 draw supertest 1;
>> >> endfig;
>> >>
>> >> beginfig(3);
>> >> =A0 draw supertest 0.99;
>> >> endfig;
>> >>
>> >> beginfig(4);
>> >> =A0 draw supertest 0.7;
>> >> endfig;
>> >>
>> >> beginfig(5);
>> >> =A0 draw supertest 0.51;
>> >> endfig;
>> >>
>> >> beginfig(6);
>> >> =A0 draw supertest 0.5;
>> >> endfig;
>> >>
>> >> % Now, for <0.5,
>> >> % things get problematic --
>> >> % the points in the shape generated by s=3D0.5
>> >> % should stay 'pointy'
>> >>
>> >> beginfig(7);
>> >> =A0 draw supertest 0.49;
>> >> endfig;
>> >>
>> >> beginfig(8);
>> >> =A0 draw supertest 0.3;
>> >> endfig;
>> >>
>> >> beginfig(9);
>> >> =A0 draw supertest 0.01;
>> >> endfig;
>> >>
>> >> beginfig(10);
>> >> =A0 draw supertest 0;
>> >> endfig;
>> >>
>> >> end;
>> >>
>> >
>> >
>> >
>> > _____________________________________________________________= ______________________
>> > 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 =A0: http://www.pragma-ade.nl / http://tex.aanhet.net
>> > archive =A0: http://foundry.supelec.fr/projects/contextrev/=
>> > wiki =A0 =A0 : http://contextgarden.net
>> >
>> > _____________________________________________________________= ______________________
>> >
>> >
>>
>> __________________________________________________________________= _________________
>> If your question is of interest to others as well, please add an e= ntry to
>> the Wiki!
>>
>> maillist : ntg-context@ntg.n= l /
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage =A0: http://www.pragma-ade.nl / http://tex.aanhet.net
>> archive =A0: http://foundry.supelec.fr/projects/contextrev/<= br> >> wiki =A0 =A0 : 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 =A0: ht= tp://www.pragma-ade.nl / http://tex.aanhet.net
> archive =A0: http://foundry.supelec.fr/projects/contextrev/
> wiki =A0 =A0 : = http://contextgarden.net
> ______________________________________________________________________= _____________
>
>
___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-context@ntg.nl / <= a href=3D"http://www.ntg.nl/mailman/listinfo/ntg-context" target=3D"_blank"= >http://www.ntg.nl/mailman/listinfo/ntg-context
webpage =A0: http://= www.pragma-ade.nl / http://tex.aanhet.net
archive =A0: http://foundry.supelec.fr/projects/contextrev/
wiki =A0 =A0 : http:= //contextgarden.net
___________________________________________________________________________= ________

--001636c5b90f9bc1080480d837c3-- --===============2019150307== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============2019150307==--