Scattering Ellipses Without Overlapping

john's Avatar

john

30 Nov, 2021 04:00 AM

Seohyo asks "Is it possible to make scattered ellipses without overlapping?" She provides an example with ellipses of different sizes.

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).

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.

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.

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.

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.

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.

If this method doesn't work for you, please respond to this thread with your additional constraints and I will attempt another method.

John

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • Scatter_Evenly_Screenshot.png 334 KB
  • scatter_evenly.zip 4.29 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Jan, 2022 12:03 AM
18 Jan, 2022 03:03 AM
18 Jan, 2022 12:51 AM
14 Jan, 2022 03:47 AM
08 Jan, 2022 04:58 PM

 

06 Jan, 2022 11:19 PM
05 Jan, 2022 07:05 PM
31 Dec, 2021 07:54 PM
26 Dec, 2021 01:34 PM
30 Nov, 2021 04:00 AM
27 Oct, 2021 08:07 PM