POV-Ray : Newsgroups : povray.newusers : bicubic patch editor : Re: bicubic patch editor Server Time
13 Apr 2025 07:07:28 EDT (-0400)
  Re: bicubic patch editor  
From: Bald Eagle
Date: 1 Apr 2025 12:15:00
Message: <web.67ec104041fe044a911b6e125979125@news.povray.org>
"gulino" <nomail@nomail> wrote:

> error in: function 1, 2 { f_ridged_mf(x,y,z, 0.6, 3.0, 6.0, -1.0, 3.0, 3.0, 1) }
>
> "Expected 'operator', ( found instead"
>
> What is wrong?

Like MichaelJF pointed out, you need to put
#include "functions.inc" in a line preceding your use of the function.

Why?
Because all functions.inc does is give a more human-readable and memorable name
to internal function #59:
#declare f_ridged_mf = function { internal(59) }

So, alternatively, you could just get right down to it and use
#declare f_ridged_mf = function { internal(59) }
in your scene _instead of_
#include "functions.inc"

You can't do BOTH, unless you
#undef _ridged_mf
since you can't declare a function twice.

With regard to the number of arguments in your function call, when I'm using a
new language, syntax, or function with a large number of anonymous/magic
arguments, I tend to copy/paste the documentation for the function into my
scene, and then I have some identification/explanation/meaning for each of the
arguments, as well as a proper count.

So I would
#declare P0 = 0.5;  // explanatory comment
.....
#declare P5 = 3; // noise generator

And then you can easily use and edit your function call as you experiment with
your scene:

f_ridged_mf(x,y,z, P0, P1, P2, P3, P4, P5):

I also tend to just copy the documentation into a comment block at the end of my
scene so I don't have to constantly be switching editor windows to go look up
what the heck the 7th argument in my function controls (in case I read it wrong
or misunderstood the first time)...

/*
P0 : H is the negative of the exponent of the basic noise frequencies used in
building these functions (each frequency f's amplitude is weighted by the factor
fE- H ). When H is 1, the fractalization is relatively smooth. As H nears 0, the
high frequencies contribute equally with low frequencies
P1 : Lacunarity is the multiplier used to get from one octave to the next in the
fractalization. This parameter affects the size of the frequency gaps in the
pattern. (Use values greater than 1.0)
P2 : Octaves is the number of different frequencies added to the fractal. Each
octave frequency is the previous one multiplied by Lacunarity. So, using a large
number of octaves can get into very high frequencies very quickly
P3 : Offset gives a fractal whose fractal dimension changes from altitude to
altitude. The high frequencies at low altitudes are more damped than at higher
altitudes, so that lower altitudes are smoother than higher areas
P4 : Gain weights the successive contributions to the accumulated fractal result
to make creases stick up as ridges
P5 : Generator type used to generate the noise3d. 0, 1, 2 and 3 are legal
values.
*/

- Hang in there - you'll get it.  :)

- BE


Post a reply to this message

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