![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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](/povray.binaries.images/attachment/%3C3A525138.1FB64302%40my-dejanews.com%3E/superelllipse.jpg?ttop=443840&toff=11400&preview=1)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Tor Olav Kristensen
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 3 Jan 2001 20:49:01
Message: <3A53D643.959D0047@online.no>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Greg M. Johnson" wrote:
>
> 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.....
See code below.
> I remember asking about exactly how povray did the exponents ages ago,
> and perhaps here we have a concrete problem. Any pointers?
Maybe it is done like this ?
x^n = exp(n*ln(x))
If so, then ln(x) may not be defined for x <= 0
I'm too tired to write more, so I'm going to sleep now.
Regardzzzzz,
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#version unofficial MegaPov 0.5;
#include "colors.inc"
global_settings { ambient_light color White*2 }
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare n1 = 0.2;
#declare n2 = 0.2;
parametric {
function
abs(cos(u))^n1*if(cos(u), 1, -1)*abs(cos(v))^n2*if(cos(v), 1, -1),
abs(cos(u))^n1*if(cos(u), 1, -1)*abs(sin(v))^n2*if(sin(v), 1, -1),
abs(sin(u))^n1*if(sin(u), 1, -1)
<-pi, -pi>, <pi, pi>
<-1.1, -1.1, -1.1>, <1.1, 1.1, 1.1>
accuracy 0.001
precompute 15, [x, y, z]
pigment { color White }
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
background { color Blue/2 }
light_source { <-3, 1, -1>*10 color White*2 }
camera {
location <1, 1, -2>*1.5
look_at <0, 0, 0>
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <3A53D643.959D0047@online.no>, Tor Olav Kristensen
<tor### [at] online no> wrote:
> Maybe it is done like this ?
>
> x^n = exp(n*ln(x))
Uh, I think "x^n = pow(x, n)" is more likely...
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Chris Huff wrote:
> Uh, I think "x^n = pow(x, n)" is more likely...
And is that undefined for negative x and noninteger n? That would
explain my missing quadrants on my superellipsoid. Will try Tor's code,
but have you any examples of working s-e's, too?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <3A548297.54B63D54@my-dejanews.com>,
gre### [at] my-dejanews com wrote:
> > Uh, I think "x^n = pow(x, n)" is more likely...
>
> And is that undefined for negative x and noninteger n?
It is defined as "x raised to the power of n", and works fine with
negative x and fractional values of n.
> That would explain my missing quadrants on my superellipsoid. Will
> try Tor's code, but have you any examples of working s-e's, too?
Not for parametrics...I never messed with them very much. I think your
problem is more of a problem with the parametric shape than the function
evaluation. For isosurfaces, I usually use something like:
function {Radius - sqrt(x^c1 + y^c2 + z^c3)}
Which isn't the same as the superellipsoid primitive, but works.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Chris Huff wrote:
> It is defined as "x raised to the power of n", and works fine with
> negative x and fractional values of n.
>
> > That would explain my missing quadrants on my superellipsoid. Will
> > try Tor's code, but have you any examples of working s-e's, too?
>
> Not for parametrics...I never messed with them very much. I think your
> problem is more of a problem with the parametric shape than the function
> evaluation. For isosurfaces, I usually use something like:
> function {Radius - sqrt(x^c1 + y^c2 + z^c3)}
>
> Which isn't the same as the superellipsoid primitive, but works.
Thanks, but just to make sure you understand that predicament.
When I set up parametric equations for a superellipsoid and set my e,n, as
<1,1> I got a perfect sphere. When I set them as <0.99, 1.0>, I got
something which was very close to a sphere where it existed but was missing
in 2 quadrants. So you see I wasn't trying to set up a sphere (hence your
suggestion for the sphere equation?) but was showing how the parametric
bombs out strangely in certain cases; my question is whether the parametric
cannot handle x^n with negative x and noninteger n.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Thu, 04 Jan 2001 09:03:03 -0500, Greg M. Johnson wrote:
>Chris Huff wrote:
>
>> Uh, I think "x^n = pow(x, n)" is more likely...
>
>And is that undefined for negative x and noninteger n?
It is undefined for negative x and nonintegral _values_ of n.
pow(-3.14, 2.0) is well defined (apart from rounding effects).
hp
--
_ | Peter J. Holzer | Just because nobody in off-topic was
|_|_) | Sysadmin WSR | particularly creative with their flames
| | | hjp### [at] wsr ac at | doesn't make them not flames
__/ | http://www.hjp.at/ | -- Ron Parker in povray.general
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Tor Olav Kristensen
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 4 Jan 2001 19:46:24
Message: <3A551904.B668FF96@online.no>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Greg M. Johnson" wrote:
>
> Chris Huff wrote:
>
> > Uh, I think "x^n = pow(x, n)" is more likely...
>
> And is that undefined for negative x and noninteger n?
My HP-48 says this:
-2.5^1.2 = -2.42932519862 - i*1.76500807116
(I.e.: That the result is a complex number.)
And in "The C Library Reference Guide"
http://www.xs4all.nl/~pvl/c/
I found this page:
http://www.xs4all.nl/~pvl/c/2.7.html#pow
(It describes briefly the functions in C's math.h)
It says this about the range of pow()
x cannot be negative if y is a fractional value.
x cannot be zero if y is less than or equal to zero.
And then I found this page:
http://www.informatik.uni-hamburg.de/RZ/software/gnu/libraries/libc_13.html#SEC255
that also mentions the range for the arguments of pow()
(in glibc GNU C library)
Index page here:
http://www.informatik.uni-hamburg.de/RZ/software/gnu/libraries/libc_toc.html
But I don't know how correct the above pages are
and if POV uses C's pow function.
Regards,
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Tor Olav Kristensen
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 4 Jan 2001 20:02:09
Message: <3A551CB5.7A4B4E1F@online.no>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Chris Huff wrote:
>
> In article <3A53D643.959D0047@online.no>, Tor Olav Kristensen
> <tor### [at] online no> wrote:
>
> > Maybe it is done like this ?
> >
> > x^n = exp(n*ln(x))
>
> Uh, I think "x^n = pow(x, n)" is more likely...
Yes, but do you know how this is actually computed ?
Regards,
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <3A551CB5.7A4B4E1F@online.no>, Tor Olav Kristensen
<tor### [at] online no> wrote:
> > Uh, I think "x^n = pow(x, n)" is more likely...
>
> Yes, but do you know how this is actually computed ?
With the standard C "pow(x, n)" function, I assume...
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |