POV-Ray : Newsgroups : povray.general : Macros and arrays : Re: Macros and arrays Server Time
7 Aug 2024 17:26:29 EDT (-0400)
  Re: Macros and arrays  
From: Gail Shaw
Date: 13 Aug 2001 08:52:20
Message: <3b77cd84@news.povray.org>
"JRG" <jrg### [at] hotmailcom> wrote in message
news:3b77c829@news.povray.org...
> > I'm guessing (not knowing exactly how macros work) that
> > when the objects are put into the first array the macros are
> > executed and the results put in the array. Is there any way inside
> > pov-ray to have the macros storred in the array and only executed
> > when the objects are written out?
>
> You guessed well. Why don't you just write as foolows:
>

As I said, that was simplified code. I'm writing
a macro to pile objects up (planning later to take
gravity and friction into account.) I want to allow
any number of different objects with different probabilities.
The macro as currently written takes an array of objects and an array of
probailities

eg

// very pseudo-code

#declare ObjectsArray=array[4] {Object1,Object2,Object3,Object4}
#declare ProbArray = array[4] {0.5,0.2,0.2,0.1}

Pile(ObjectsArray,ProbArray)

In the above case 50% of the pile will be object1, 20% object2 etc

Gail
--
*************************************************************************
* gsh### [at] monotixcoza                *   Step into the abyss,           *
* http://www.rucus.ru.ac.za/~gail/   *   and let go.          Babylon 5 *
*************************************************************************
* The difficult we do immediately, the impossible takes a little longer *
*************************************************************************


Post a reply to this message

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