|
|
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'
|
|