POV-Ray : Newsgroups : povray.general : Isofunctions and meshes : Re: Isofunctions and meshes Server Time
20 Apr 2024 03:25:12 EDT (-0400)
  Re: Isofunctions and meshes  
From: Tor Olav Kristensen
Date: 1 Dec 2016 07:10:01
Message: <web.5840129bb9cec73d28cdfe180@news.povray.org>
"John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Am 01.12.2016 um 11:34 schrieb John Greenwood:
> >
> > > Yes I think so. It seems that the x,y,z is needed when it is a function within a
> > > function as in R_Surface.  I am nesting functions 5 deep and it looks like the
> > > x,y,z needs to be "passed down" but I am not clear exactly what the rules are.
> > > The x,y,z is a bit of clutter for the user.
> >
> > That shouldn't be the case -- unless the functions further down the
> > rabbit hole actually try to access x,y,z.
> >
> > There's essentially just one special case with regards to x,y,z: If you
> > specify a function without a parameter list, it will default to (x,y,z).
>
> In the line:
>   #declare R_Surface =
>
function(p,r,L,xo,yo,zo,x,y,z,Fm){R_S_function(p,x,y,z,((x*xo+y*yo+z*zo)/sqrt(pow(xo,2)+pow(yo,2)+pow(zo,2))
> +L+Fm) /-r)}
>
> Substituting R_function for R_S_function no longer works. I think this is
> because Fm is a function that contains functions of x,y,z.

This works:

#declare R_Surface =
  function(p, r, L, xo, yo, zo, x, y, z, Fm) {
    R_function(
      p,
      ((x*xo + y*yo + z*zo)/sqrt(pow(xo,2) + pow(yo,2) + pow(zo,2)) + L + Fm)/-r
    )
  }

Fm is not a function, it is a parameter that already contains a value when the
R_Surface function is evaluated, so x, y and z is not needed within the
R_Surface function for the purpose of calculating Fm.


Btw.:

If you do this:

#include "functions.inc"

Then you can replace this:

sqrt(pow(xo,2) + pow(yo,2) + pow(zo,2))

- with this:

f_r(xo, yo, zo)

--
Tor Olav
http://subcube.com


Post a reply to this message

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