tag:support.nodebox.net,2012-11-01:/discussions/nodebox-2-3/6479-scattering-ellipses-without-overlappingNodeBox: Discussion 2021-11-30T04:00:29Ztag:support.nodebox.net,2012-11-01:Comment/495167552021-11-30T04:00:25Z2021-11-30T04:00:25ZScattering Ellipses Without Overlapping<div><p>Seohyo asks "Is it possible to make scattered ellipses without overlapping?" She provides an example with ellipses of different sizes.</p>
<p>Attached is one way of doing this using the "Scatter_Evenly" node from my Cartan Node Library. This node requires a custom code module, poisson.py (included in the zipped example).</p>
<p>Scatter_Evenly fills a rectangular space (defined by the width and height parameters) with points that are guaranteed to be a minimum distance apart (based on a supplied "Point Size" parameter) using a Poisson distribution. The smaller the point size, the more points you get. Each seed produces a different random distribution.</p>
<p>You cannot predict ahead of time exactly how many points you will get. So if this matters to you, adjust the point size to produce more points than you need and then use a slice node to use just the first N points.</p>
<p>In the example shown here, I use a numbers node to define the total number of points and feed that both into a slice node and a random_numbers node. The random_number node defines the size (diameter) of each object. If all the objects were the same size you would not need the random_numbers node.</p>
<p>To get an attractive distribution you can adjust the seed value in the scatter_evenly node to produce different scatters and the seed value in the random_numbers node to try different size distributions. Of course you can also adjust the total number of points and the size range of each point.</p>
<p>If you want to produce a tightly packed distribution of randomly-sized objects you can set the point size parameter to a value slightly smaller than the maximum size of the objects and then reduce this value until overlaps begin to occur.</p>
<p>If this method doesn't work for you, please respond to this thread with your additional constraints and I will attempt another method.</p>
<p>John</p></div>john