|
![](/i/fill.gif) |
Warp <war### [at] tag povray org> wrote:
> W0RLDBUILDER <nomail@nomail> wrote:
> > > #declare Star = /* your star object here */;
> > >
> > > #declare Amount = 500;
> > > #declare Seed = seed(0); // Try integer values other than 0 for other
> > > // distributions
> > > #declare MinExtent = <-100, -100, -100>;
> > > #declare MaxExtent = <100, 100, 100>; // Modify as desired
> > >
> > > #declare Index = 0;
> > > #while(Index < Amount)
> > > object
> > > { Star
> > > #declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
> > > translate MinExtent + (MaxExtent - MinExtent) * RandVector
> > > }
> > > #declare Index = Index + 1;
> > > #end
> > >
> > > --
> > > - Warp
>
> > Thanks. Would that work if I copy/pasted it several times for different types of
> > stars?
>
> Better to use a macro for that, like:
>
> #macro CreateStars(StarObject, Amount, Seed)
> #local MinExtent = <-100, -100, -100>;
> #local MaxExtent = <100, 100, 100>; // Modify as desired
>
> #local Index = 0;
> #while(Index < Amount)
> object
> { StarObject
> #declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
> translate MinExtent + (MaxExtent - MinExtent) * RandVector
> }
> #local Index = Index + 1;
> #end
> #end
>
> #declare Seed = seed(0);
> CreateStars(Star1, 100, Seed)
> CreateStars(Star2, 100, Seed)
> CreateStars(Star3, 100, Seed)
>
> --
> - Warp
I can't get that to work. I know I'm doing something wrong here. It's probably
not a good idea to drop a macro on top of a semi-n00bish casual user who just
wants to place some random stars. :-P
Post a reply to this message
|
![](/i/fill.gif) |