|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi everybody
I would like to have an object "explode". In order to enhance the effect, since
it's a union, I'd like to know if there's a way , given a union object, to
parse its components.
Something like
for (every component in the union) do
translate <>...
etc etc
It would be faster than putting the translation code in every object in the
union declaration. Is it possible?
Thanks
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Delfo" <nomail@nomail> wrote in message
news:web.4947620f89bfa4d998813760@news.povray.org...
> Hi everybody
> I would like to have an object "explode". In order to enhance the effect,
> since
> it's a union, I'd like to know if there's a way , given a union object, to
> parse its components.
> Something like
> for (every component in the union) do
> translate <>...
> etc etc
>
> It would be faster than putting the translation code in every object in
> the
> union declaration. Is it possible?
> Thanks
>
I don't believe that you can't do this in quite the way you're asking for.
What you can do is create an array of translation vectors, or may I suggest
an array of transformations, so that you can readily add rotations and other
transformations later if you wish. You could then paste the following
statement into each object defiintion (or you may be able to do a global
find/replace in an editor if there are lots of objects and you can find a
sufficiently unique character string in each object definition):
transform {T[N]} #local N=N+1;
Before your union declaration you can then loop through and declare each of
the transformations using a #while loop.
You'd end up with something like this:
#declare MySeed = seed(1);
#declare ObjectCount = 100;
#declare T = array[ObjectCount];
#local N = 0;
#while (N<ObjectCount)
#declare T[N] = transform {translate 100*clock*<rand(MySeed),
rand(MySeed), rand(MySeed)>}
#local N=N+1;
#end
#local N = 0;
union {
sphere ... transform {T[N]} #local N=N+1;}
box {... transform {T[N]} #local N=N+1;}
....
}
Another option would be to call a macro from within each object definition,
then define whatever transformation you want inside the macro.
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Delfo" <nomail@nomail> wrote:
> I would like to have an object "explode". In order to enhance the effect, since
> it's a union, I'd like to know if there's a way , given a union object, to
> parse its components.
> Something like
> for (every component in the union) do
> translate <>...
> etc etc
>
> It would be faster than putting the translation code in every object in the
> union declaration. Is it possible?
Not with POV-ray's own Scene Description Language.
You could, however, assign the component objects to an array, which you can then
loop through to build your union, adding translations along the way.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|