POV-Ray : Newsgroups : povray.general : Isosurface oddity : Re: Isosurface oddity Server Time
30 Jul 2024 06:19:39 EDT (-0400)
  Re: Isosurface oddity  
From: Warp
Date: 13 Jul 2009 11:06:28
Message: <4a5b4d74@news.povray.org>
Doctor John <joh### [at] homecom> wrote:
> I've just come across an unusual bit of behaviour when rendering a large
> number of similar isosurfaces.
> When I use the code:
> > #declare Index = 0;
> > #while (Index<29)
> >       isosurface {
> >               function {f_rounded_box(x, y, z, 0.1, 1.19, 0.3,
0.4)+f_granite(x+rand(Seed),
> >               y+rand(Seed), z+rand(Seed))*0.09}
> I get the message:
> > Parse Error: Expected 'function identifier', } found instead
> However, when I use:
> > #declare Index = 0;
> > #while (Index<29)
> > #local RX=rand(Seed);
> > #local RY=rand(Seed);
> > #local RZ=rand(Seed);
> >       isosurface {
> >               function {f_rounded_box(x, y, z, 0.1, 1.19, 0.3,
0.4)+f_granite(x+RX,
> >               y+RY, z+RZ)*0.09}
> Everything works as expected.
> What's happening? Surely Pov's only got to look up the next number in
> the random stream which can't be much different from looking up the
> values of the declared variables.

  rand() is not a function supported inside user-defined functions, it's
that simple.

  (While user-defined functions and SDL math expressions might look similar,
they are completely separate. It can get a bit confusing sometimes.)

-- 
                                                          - Warp


Post a reply to this message

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