POV-Ray : Newsgroups : povray.binaries.images : city buildings-- WIP 9_29_2020 : Re: city buildings-- WIP 9_29_2020 Server Time
28 Apr 2024 00:48:54 EDT (-0400)
  Re: city buildings-- WIP 9_29_2020  
From: Kenneth
Date: 30 Sep 2020 16:50:05
Message: <web.5f74ee3232341a55d98418910@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:

> > I still don't know the algorithm or technique for placing randomly-located
> > objects that don't overlap, each object having its own space...
>
> You can store objects in an array, and check each new one against existing
> positions and bounds, for example in dodgy pseudocode:
[snip]
>
> Alternatively, you can subdivide your region of interest, then pick a single
> random location in each sub-region. This has the advantage of not requiring
> extensive looping and testing, although subdivision might be non-trivial. For
> rectangles it's not too bad.
>
> If your objects are all roughly the same sort of size, you can lay a grid
> down, perturb the grid positions by some distance smaller than the grid
> spacing, then place objects at the perturbed grid positions. Using only
> a subset of the grid positions makes it look more random.
>
 Thanks a bunch! You've given me some good ideas to pursue. Btw, while trying to
come up with workable schemes 'on my own', I'm happy to say that the
grid-subdivision idea(s) did occur to me at various times, in rather fuzzy
ways-- but I didn't follow up on them. :-( It's nice to know that I wasn't too
far off in my thinking.

And it looks like POV-ray's  min_extent(...) and   max_extent(...) tools will be
useful here, especially since my greebles are of various sizes and shapes.


Post a reply to this message

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