

So, as I was coding this little scene up, I realized that I needed a "proper"
mod function to behave regularly and consistently across the origin.
The user defined function I use to do this is:
#declare fmod = function (T) {select (T, 1mod (abs(T), 1), mod (abs(T), 1))}
(This just creates a sawtooth function that treats every integer along the
relevant axis as 0, progressing up to 0.9999999999999.... and then it starts
over at 0 at the next integer value. So that's how the plane gets divided up
into unit squares. Then everything just gets offset by 0.5 to bring the origin
of each square to the center.)
It would be a useful thing to make such a function available in source, in
functions.inc, or perhaps add a note in the documentation about how the stock
mod () function probably doesn't do what a new user might expect it to.
Using floor () gives me a constant integer value inside of each unit square, so
that the value I get from f_noise3d stays the same inside of each square.
Then I can just write "standard" equations for things like circles, and use Mike
Williams' abs (f(n)  val) trick to give the infinitely thin line resulting from
the mathematical solution some width.
Just in case anyone was interested in experimenting with rolling their own
pigment pattern functions.
 BW
Post a reply to this message

