POV-Ray : Newsgroups : povray.advanced-users : Random tree position, without duplicates? : Re: Random tree position, without duplicates? Server Time: 28 Sep 2020 22:05:33 GMT
  Re: Random tree position, without duplicates?  
From: SharkD
Date: 4 Jun 2010 19:48:50
On 6/4/2010 3:45 PM, SharkD wrote:
> Is there a good way to, for instance, place a number of trees randomly
> without having them overlap?
> Currently, I use an array to store the positions and compare each new
> tree to all the previous ones. This is however very slow.
> I could also create a multi-dimensional B-tree array that divides the
> world into a grid, thereby reducing the number of items to look up. I
> wonder if that would speed things.

On second thought I don't think this will work because array sizes must 
be known beforehand, and with a B-tree sorting method there's no 
guarantee how many items a node will hold.


Post a reply to this message

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