<p>I think flocking can be in help to create those groups here. Because it seems like different entitys that would like to flock with each other should be part of a group.</p>

<p><a href="http://arxiv.org/abs/math?papernum=0502342" rel="nofollow noreferrer">http://arxiv.org/abs/math?papernum=0502342</a></p>

<p><a href="http://flashorbit.com/?page_id=40" rel="nofollow noreferrer">http://flashorbit.com/?page_id=40</a></p>

<p>"Boids" seems to be in the same neighborhood when calculate flocks.
<a href="http://www.red3d.com/cwr/boids/" rel="nofollow noreferrer">http://www.red3d.com/cwr/boids/</a></p>
Fast Entity Grouping (by location) algorithm
<p>I'm dealing with a large group of entities that store locations. They are displayed on a map. I'm trying to come up with an efficient way to group near located entities into one entity when viewed from a higher location. So, for example, if you are very high, when looking down, you will see one entity that represents a group of closely located entities in an area. Zooming in close enough would split that entity out into its contained entities.</p>

<p>Is there an efficient algorithm for doing this? I thought about just griding off the view based on height and dropping entities into grid boxes based on location then rendering the box point. My only concern is if all the entities are in the upper right of that box, the entity rendered to represent them might be centered in the middle instead of the location of the group of entities.</p>

<p>Any thoughts or ideas?</p>