POV-Ray : Newsgroups : povray.general : 3.2.1.6.5 in docs--clarification needed : Re: 3.2.1.6.5 in docs--clarification needed Server Time
29 Jul 2024 10:27:57 EDT (-0400)
  Re: 3.2.1.6.5 in docs--clarification needed  
From: Trevor G Quayle
Date: 27 Feb 2013 14:30:00
Message: <web.512e5e74ef3a5b5981c811d20@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
> On 27/02/2013 4:14 PM, Warp wrote:
> > Kenneth <kdw### [at] gmailcom> wrote:
> >> Here are the two code lines given there:
> >
> >> #declare Vec = foo(1,2,3)
> >
> >> and
> >
> >> #declare Val = foo(2,3,4).gray
> >
> >> What do the values (1,2,3) and (2,3,4) represent?
> >
> > They mean whatever the function wants them to mean. The function
> > constructs the vector from those values.
> >
>
> Do you mean that you could write:
>
> #declare Vec = foo(A,B,C)
> #declare Val = foo(X,Y,Z).gray
> or
> #declare Val = foo(1,2,3).gray
> even
>
> And that would the same as writing:
>
> #declare Vec = foo(1,2,3)
> #declare Val = foo(2,3,4).gray
> ?
>
> --
> Regards
>      Stephen

Only so much as A,B,C  or X,Y,Z have defined values.
The A,B,C represent where in 3-space you want to evaluate the underlying pigment
function foo().

for the very simple example in the docs:
#declare foo = function {
  pigment {
    color red 1
    }
  }

as the pigment is red anywhere, any value will return rgb value <1,0,0>.

Where it becomes useful for one example is in building scenes.  Lets say you
want to set down a 100x100 array of spheres.  You could set up a pattern
function (bump for example), then when you go to place each sphere, evaluate the
value of foo() at the center coordinates of each sphere and size it based on
that value.

Or perhaps you have a number of different flowers in a field (lets say five).
Each time you check a spot where you want to place the flower, you can evaluate
foo() at those coordinates and: 1) pick which flower you want to use out of the
5 based on the .red value 2) scale the sizing based on the .green value 3)
roatet the flower based on the .blue value.
This can be better than just random selection, as it allows you to have some
flow and transition continuity (i.e. you'll have distinct patches of each flower
type)

-tgq


Post a reply to this message

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