POV-Ray : Newsgroups : povray.binaries.images : Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p? Server Time
19 Aug 2024 10:18:42 EDT (-0400)
  Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p? (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: Greg M  Johnson
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 4 Jan 2001 09:08:41
Message: <3A548297.54B63D54@my-dejanews.com>
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

From: Chris Huff
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 4 Jan 2001 16:39:13
Message: <chrishuff-40AC94.16404504012001@news.povray.org>
In article <3A548297.54B63D54@my-dejanews.com>, 
gre### [at] my-dejanewscom 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] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 4 Jan 2001 17:06:21
Message: <3A54F274.BD9EC2D5@my-dejanews.com>
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

From: Peter J  Holzer
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 4 Jan 2001 18:14:09
Message: <slrn959rm9.2k0.hjp-usenet@teal.h.hjp.at>
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] wsracat      | doesn't make them not flames
__/   | http://www.hjp.at/ |	-- Ron Parker in povray.general


Post a reply to this message

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>
"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] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

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>
Chris Huff wrote:
> 
> In article <3A53D643.959D0047@online.no>, Tor Olav Kristensen
> <tor### [at] onlineno> 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] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

From: Chris Huff
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 4 Jan 2001 23:13:51
Message: <chrishuff-463D71.23152304012001@news.povray.org>
In article <3A551CB5.7A4B4E1F@online.no>, Tor Olav Kristensen 
<tor### [at] onlineno> 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] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Christoph Hormann
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 5 Jan 2001 04:41:59
Message: <3A5596E8.6A443CE0@gmx.de>
Tor Olav Kristensen wrote:
> 
> > >
> > > 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 ?
> 

<remembering something>
<digging through harddisk>

\Delphi4\Source\Rtl\Sys\Math.pas:

function Power(Base, Exponent: Extended): Extended;
begin
  if Exponent = 0.0 then
    Result := 1.0               { n**0 = 1 }
  else if (Base = 0.0) and (Exponent > 0.0) then
    Result := 0.0               { 0**n = 0, n > 0 }
  else if (Frac(Exponent) = 0.0) and (Abs(Exponent) <= MaxInt) then
    Result := IntPower(Base, Integer(Trunc(Exponent)))
  else
    Result := Exp(Exponent * Ln(Base))
end;

Seems Tor is right, since i guess the C function pow(x,y) computes the
same (maybe apart from the optimization done here) this again answers the
questions about where it is defined.  

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 5 Jan 2001 08:32:08
Message: <3A55CB79.96817286@my-dejanews.com>
Christoph Hormann wrote:

> Seems Tor is right, since i guess the C function pow(x,y) computes the
> same (maybe apart from the optimization done here) this again answers the
> questions about where it is defined.

Yall are getting almost over my head.

I'd once again assert that in parametrics Chris Huff's statement is NOT true
for parametrics:
 > It is defined as "x raised to the power of n", and works fine with
 > negative x and fractional values of n.

albeit it appears to work fine in isosurfaces.

OR perhaps for isosurfaces:   x^n=abs(x)^n* sign(x); whereas parametrics have
something else.

Would parametrics and isosurfaces use different math code for exponents?

Hope I'm not being too much of a pain. But I would suggest "something is
wrong" if we get an image like that in the top of this thread.


Post a reply to this message

From: Chris Huff
Subject: Re: Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p?
Date: 5 Jan 2001 19:28:34
Message: <chrishuff-8CF8B2.19300705012001@news.povray.org>
In article <3A55CB79.96817286@my-dejanews.com>, 
gre### [at] my-dejanewscom wrote:

> I'd once again assert that in parametrics Chris Huff's statement is NOT 
> true for parametrics:

I highly doubt function evaluation is significantly different between 
the two...I think it's much more likely that it is a problem with the 
parametric solving code.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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