POV-Ray : Newsgroups : povray.binaries.images : Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p? : Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p? Server Time
19 Aug 2024 06:26:34 EDT (-0400)
  Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?  
From: Greg M  Johnson
Date: 2 Jan 2001 17:13:41
Message: <3A525138.1FB64302@my-dejanews.com>
Why can't I get a working superellipse?

See code below and image below.  It looks like I'm losing two quadrants
of the s-e. Note that when the n2 is changed to 1.0 I get a nice sphere.

I then read in a web page for CS from U of Western Australia:
http://www.cs.uwa.edu.au/undergraduate/units/600.105/Lab6.html

> Note for this representation to work `exponentiation' must be defined
as
>      p                   p
>    x   =  sign(x) |x|
>
> Where the sign function returns +1 for +ve x, 0 for 0 x, and -1 for
-ve x.
> This allows exponentiation to `work' for  arbitrary x and p.
>

I tried coding this into my parametric using the abs() function, BUT
mega said I had too many parameters.....

I remember asking about exactly how povray did the exponents ages ago,
and perhaps here we have a concrete problem. Any pointers?

/////------------------------------------
#declare n1=1;
#declare n2=0.99;

parametric {
                function
               (cos(u)^n1)*(cos(v)^n2),
               ((cos(u)^n1))*(sin(v)^n2),
                ((sin(u))^n1)
                <-pi*1,-2*pi>, <pi*1,pi*2>
                <-20,-20,-20>, <20,20,20>
                accuracy 0.001
                precompute 15, [x,y, z]
                pigment{SeaGreen*0.8}
                finish{ambient 0.3}
                 }


Post a reply to this message


Attachments:
Download 'superelllipse.jpg' (3 KB)

Preview of image 'superelllipse.jpg'
superelllipse.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.