POV-Ray : Newsgroups : povray.newusers : Internal Function Details? Server Time
25 Dec 2024 13:28:50 EST (-0500)
  Internal Function Details? (Message 1 to 2 of 2)  
From: D Matthews
Subject: Internal Function Details?
Date: 22 Oct 2002 18:27:53
Message: <3db5d0e9@news.povray.org>
OK, I think I've searched all the easily available help files, and I can't
find the answer to this one.  Is there some place where the actual formulas
for the internal functions are available (without trying to puzzle out the
source code)?

Something like:
f_sphere = x^2 + y^2 + z^2 - P0^2, but for all, or at least many, of the
other functions.

I teach math, and when a student or colleague asks me:
"What is that?"  it seems a bit inadequate to answer as they do in POVRay
Help:

"f_spikes(x,y,z, P0, P1, P2, P3, P4)

P0 : Spikiness. Set this to very low values to increase the spikes. Set it
to 1 and you get a sphere
P1 : Hollowness. Increasing this causes the sides to bend in more
P2 : Size. Increasing this increases the size of the object
P3 : Roundness. This parameter has a subtle effect on the roundness of the
spikes
P4 : Fatness. Increasing this makes the spikes fatter "

This is of great practical help, but not very mathematically informative.


Post a reply to this message

From: Christoph Hormann
Subject: Re: Internal Function Details?
Date: 23 Oct 2002 04:27:03
Message: <3DB65D56.4B0C52F5@gmx.de>
D Matthews wrote:
> 
> OK, I think I've searched all the easily available help files, and I can't
> find the answer to this one.  Is there some place where the actual formulas
> for the internal functions are available (without trying to puzzle out the
> source code)?

No, but finding it in the source isn't really that difficult.  Just look
into 'fnintern.cpp':

DBL f_spikes(DBL *ptr, unsigned int) // 62
{
  DBL r,x2,y2,z2;
  x2=PARAM_X*PARAM_X; y2=PARAM_Y*PARAM_Y; z2=PARAM_Z*PARAM_Z;
  r= exp(-(x2+y2+z2)*PARAM(3))*PARAM(4)         
-exp(-(x2*PARAM(0)+y2*PARAM(0)+z2)*PARAM(1))
    -exp(-(x2*PARAM(0)+y2+z2*PARAM(0))*PARAM(1))
-exp(-(x2+y2*PARAM(0)+z2*PARAM(0))*PARAM(1));
  return(-r*PARAM(2));
}

I think that's pretty self explanatory.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

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