|
|
Am 25.02.2018 um 20:18 schrieb Kenneth:
> I'm familiar with using PIGMENT/PATTERN functions, although it has been awhile.
> But I was looking at 3.3.1.8.4 "Declaring User-Defined Vector Functions" in the
> docs, and it's not clear to me how to actually *use* the examples given there.
>
> The first example (a transform function) is described only like this:
>
> #declare foo = function {
> transform {
> rotate <90, 0, 0>
> scale 4
> }
> }
>
> #declare myvector = foo(4, 3, 7);
>
> How is "myvector" supposed to be used? My assumption is that it 'acts like' a
> transform-- just like any transform{..}-- but I can't get it to work. Maybe I'm
> using it in a totally wrong way?
You're using it totally wrong indeed: While the function does /apply/ a
transform to the parameters submitted, it /acts/ like a vector when
invoked (namely the vector you'd get if you applied the transform to the
vector corresponding to the three parameter values supplied).
E.g,
#declare T = transform { rotate <90,0,0> scale 4 }
#declare foo = function { transform { T } }
#declare myvector = foo(4,3,7);
sphere { myvector, .3 }
or
#declare T = transform { rotate <90,0,0> scale 4 }
#declare foo = function { transform { T } }
sphere { foo(4,3,7), .3 }
is equivalent to
#declare T = transform { rotate <90,0,0> scale 4 }
sphere { vtransform(<4,3,7>,T), .3 }
If you want something that acts like a transform, you must use a
transform. For example:
#declare T = transform { rotate <90,0,0> scale 4 }
sphere { 0, .3
transform { T }
}
Post a reply to this message
|
|