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:22:18 EDT (-0400)
  Megpov: how to do a superelipse? Do we need x^p=sign(x)*|x|^p? (Message 11 to 13 of 13)  
<<< Previous 10 Messages Goto Initial 10 Messages
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 10 Messages Goto Initial 10 Messages

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