POV-Ray : Newsgroups : povray.general : <no subject> : Re: <no subject> Server Time
30 Jul 2024 06:25:38 EDT (-0400)
  Re: <no subject>  
From: Chris B
Date: 8 Jul 2009 05:48:20
Message: <4a546b64$1@news.povray.org>
"MadKairon" <nomail@nomail> wrote in message 
news:web.4a546647c23a6d95fbac4ff0@news.povray.org...
> Hello everybody, I need a little help with this.
> The following code works fine:
>
>  #include "colors.inc"
>  background { color rgb <.5, .4, .3> }
>  #declare Rnd_1 = seed (1153);
>
>
>
>  camera {
>    location <3, 2, -3>
>    look_at  <0, 0,  0>
>  }
>
>  light_source {<100,200,-100> colour rgb 1}
>
>  #macro ship ()
>    #declare n = 1;
>    #while ( n < 800 )
>             box { <0,0,0>,<1,1,1>
>             pigment{rgb .5}
>             finish { phong 1 }
>             scale <rand(Rnd_1)/5,rand(Rnd_1)/2,rand(Rnd_1)*1.5>
>             translate <rand(Rnd_1)/2,rand(Rnd_1)/2,rand(Rnd_1)*4>
>             }
>      #declare n = n + 1  ;
>    #end
>  #end
>
>  ship()
>
> but if I try: object { ship () translate <.1,0,0> } on the last line I get 
> a
> parse error, whats wrong? thanks in advance!

With the #while loop in place your macro returns a number of objects (800 
boxes) rather than an object, so when it hits the second object it should 
complain. You can use a union:
union { ship () translate <.1,0,0> }

or you could wrap your #while loop in a union statement within the macro, in 
which case it returns a single consolidated object which is a union of your 
800 boxes and your object statement should then work fine.

Regards,
Chris B.


Post a reply to this message

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