POV-Ray : Newsgroups : povray.general : Help with random object placement Server Time
10 Aug 2024 13:23:22 EDT (-0400)
  Help with random object placement (Message 1 to 9 of 9)  
From: Ryan Twitchell
Subject: Help with random object placement
Date: 28 Dec 1999 11:35:00
Message: <3868e6b4@news.povray.org>
Hello,
 For the current project I'm working on (see post 'More mushies' in p.b.i), 
I've put a lot of small mushrooms around the base of some larger ones. This 
was done using a while loop to place them all randomly. The problem is, some 
of them intersect with the stems of the larger mushrooms and also with 
themselves. Can anyone here suggest a way to place them (semi) randomly 
without this happening?

Thanks,
 Ryan Twitchell


Post a reply to this message

From: Bill DeWitt
Subject: Re: Help with random object placement
Date: 28 Dec 1999 11:40:13
Message: <3868e7ed@news.povray.org>
I don't know yet if it can be done with some of Povray's new features, but
what you might try is using your #while loop to build an #array, then have
it check each new value against the previous array values, then try again if
it is within a range of any previous number.

"Ryan Twitchell" <try### [at] rochesterrrcom> wrote in message
news:3868e6b4@news.povray.org...
> Hello,
>  For the current project I'm working on (see post 'More mushies' in
p.b.i),
> I've put a lot of small mushrooms around the base of some larger ones.
This
> was done using a while loop to place them all randomly. The problem is,
some
> of them intersect with the stems of the larger mushrooms and also with
> themselves. Can anyone here suggest a way to place them (semi) randomly
> without this happening?
>
> Thanks,
>  Ryan Twitchell


Post a reply to this message

From: Gilles Tran
Subject: Re: Help with random object placement
Date: 28 Dec 1999 14:26:10
Message: <38690EDD.CB8AF483@inapg.inra.fr>
I just put a scene that's doing something like this in text.scene-files. It's
not fully tested but it seems to work.
I hope this helps.
G.

Ryan Twitchell wrote:

> Hello,
>  For the current project I'm working on (see post 'More mushies' in p.b.i),
> I've put a lot of small mushrooms around the base of some larger ones. This
> was done using a while loop to place them all randomly. The problem is, some
> of them intersect with the stems of the larger mushrooms and also with
> themselves. Can anyone here suggest a way to place them (semi) randomly
> without this happening?


Post a reply to this message

From: Alf Peake
Subject: Re: Help with random object placement
Date: 31 Dec 1999 14:17:05
Message: <386d0131@news.povray.org>
I had a similar type of problem with a tray of glass marbles. When pov 3.1 and arrays
arrived I solved the problem with a pair of nested #while loops. The outer loop
generated
a random position in the current element of the array, and the 2nd loop checked that
previous entries were more than one diameter away. An OK entry allowed the outer loop
to
increment.
Can't find my old source right now but will have another look if you don't get a
response.

Alf

http://www.peake42.freeserve.co.uk
http://ourworld.compuserve.com/homepages/Alf_Peake/



Ryan Twitchell <try### [at] rochesterrrcom> wrote in message
news:3868e6b4@news.povray.org...
> Hello,
>  For the current project I'm working on (see post 'More mushies' in p.b.i),
> I've put a lot of small mushrooms around the base of some larger ones. This
> was done using a while loop to place them all randomly. The problem is, some
> of them intersect with the stems of the larger mushrooms and also with
> themselves. Can anyone here suggest a way to place them (semi) randomly
> without this happening?
>
> Thanks,
>  Ryan Twitchell


Post a reply to this message

From: Bill DeWitt
Subject: Re: Help with random object placement
Date: 31 Dec 1999 18:38:27
Message: <386d3e73@news.povray.org>
"Alf Peake" <alf### [at] peake42freeservecouk> wrote in message
news:386d0131@news.povray.org...
> I had a similar type of problem with a tray of glass marbles. When pov 3.1
and arrays
> arrived I solved the problem with a pair of nested #while loops. The outer
loop generated
> a random position in the current element of the array, and the 2nd loop
checked that
> previous entries were more than one diameter away. An OK entry allowed the
outer loop to
> increment.
> Can't find my old source right now but will have another look if you don't
get a response.
>

    I played with this and although my debug statements seem to say that it
was working, I still got some coincident placements. I would like to see how
you did it, I must be overlooking something obvious. It seems like a simple
thing.


Post a reply to this message

From: Chris Huff
Subject: Re: Help with random object placement
Date: 31 Dec 1999 18:52:47
Message: <chrishuff_99-7BEE40.18534331121999@news.povray.org>
In article <386d3e73@news.povray.org>, "Bill DeWitt" 
<the### [at] earthlinknet> wrote:

>     I played with this and although my debug statements seem to say that 
>     it
> was working, I still got some coincident placements. I would like to see 
> how
> you did it, I must be overlooking something obvious. It seems like a 
> simple thing.

Hmm, make sure to check for 1 diameter(double the radius) instead of the 
radius. This can be easy to miss.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Bill DeWitt
Subject: Re: Help with random object placement
Date: 31 Dec 1999 23:26:18
Message: <386d81ea@news.povray.org>
"Chris Huff" <chr### [at] yahoocom> wrote :
>
> Hmm, make sure to check for 1 diameter(double the radius) instead of the
> radius. This can be easy to miss.
>

    <chuckle> I did actually miss this to begin with, but it was the first
thing I fixed. I haven't really put that much time into it yet, and I
usually need solid blocks of time to get anything right. I am too scattered
to keep track of where I was otherwise.

    Basically I am building an array in a loop, and inside the loop I
re-check the previous entries and keep choosing new values until I get one
that doesn't match any of the previous ones... should be simple enough, I
have done the same thing before in making card games in BASIC and C... I
just need to sit down and work on it till it's fixed...


Post a reply to this message

From: Alf Peake
Subject: Re: Help with random object placement
Date: 1 Jan 2000 17:56:44
Message: <386e862c@news.povray.org>
Bill, I decided its easier to re-invent than look for it at the moment so have just
posted
Random object placement in pov.t.s-f
There's plenty of scope to play about with it.

Alf

Bill DeWitt <the### [at] earthlinknet> wrote in message
news:386d3e73@news.povray.org...
>
> "Alf Peake" <alf### [at] peake42freeservecouk> wrote in message
> news:386d0131@news.povray.org...
> > I had a similar type of problem with a tray of glass marbles. When pov 3.1
> <cut>
>
>     I played with this and although my debug statements seem to say that it
> was working, I still got some coincident placements. I would like to see how
> you did it, I must be overlooking something obvious. It seems like a simple
> thing.
>
>


Post a reply to this message

From: Bill DeWitt
Subject: Re: Help with random object placement
Date: 1 Jan 2000 20:58:04
Message: <386eb0ac@news.povray.org>
"Alf Peake" <alf### [at] peake42freeservecouk> wrote :
>
> Bill, I decided its easier to re-invent than look for it at the moment so
have just posted
> Random object placement in pov.t.s-f
> There's plenty of scope to play about with it.
>

    Yeah! Pretty cool. Good Idea about that red/green status hoop thingie...
    I'm still trying to find time to work on mine, but yours works very much
like what I am trying to do.


Post a reply to this message

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