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

01 Oct, 2024 07:59 AM
30 Sep, 2024 11:37 PM
30 Sep, 2024 11:11 AM
30 Sep, 2024 02:37 AM
28 Sep, 2024 10:33 AM

 

26 Sep, 2024 06:41 AM
24 Sep, 2024 12:32 AM
24 Sep, 2024 12:27 AM
13 Sep, 2024 12:07 AM
12 Sep, 2024 11:54 PM
07 Sep, 2024 05:16 AM