# Picking circles by the # of circles each circle intersects

**URL:** <https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251>\
**Category:** Grasshopper\
**Tags:** windows, python, grasshopper2, grasshopperrhino\
**Created:** [July 25, 2023, 4:38pm UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251 "2023-07-25T16:38:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cooper\_Copetas](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cooper_copetas/32/485205_2.png) [@Cooper\_Copetas](https://discourse.mcneel.com/u/Cooper_Copetas)\
**Post date:** [July 25, 2023, 4:38pm UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251/1 "2023-07-25T16:38:19Z")

</div>

Hello,

I am attempting to create a system where I can filter out circles based on the number of other circles they intersect.

Input 1 – circles (CNR)  
Input 2 – given value of circles to use as filter

Output – all circles that are greater than or equal to input 2

I am close to the solution, but I can’t get the “curve | curve” component to stop the self intersection. The ideal intersections are what are created with the “MCX”.

How do I get the “curve | curve” intersection to match the “MCX” for instance?

It’s rather basic, but I think I’m missing a graft procedure somewhere.

[Circle Selection By Intersecting Points.gh](https://discourse.mcneel.com/uploads/short-url/faLbCveu0ZGQ6B0MwW5blWRLjeK.gh) (18.7 KB)

---

<div class="post-metadata">

**Author:** ![Quan\_Li](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/quan_li/32/679256_2.png) [@Quan\_Li](https://discourse.mcneel.com/u/Quan_Li)\
**Post date:** [July 25, 2023, 11:32pm UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251/2 "2023-07-25T23:32:51Z")

</div>

[Circle Selection By Intersecting Points Edited V0 Rtree.gh](https://discourse.mcneel.com/uploads/short-url/zYjLpAUrvXAW0fDl9WDW16WZx9h.gh) (30.3 KB)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/8/a/f/8aff461bb706f1f693730890aca360c2213f68b2.png)

---

<div class="post-metadata">

**Author:** ![Quan\_Li](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/quan_li/32/679256_2.png) [@Quan\_Li](https://discourse.mcneel.com/u/Quan_Li)\
**Post date:** [July 26, 2023, 5:28am UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251/3 "2023-07-26T05:28:44Z")

</div>

[Circle Selection By Intersecting Points Edited V1 simplified.gh](https://discourse.mcneel.com/uploads/short-url/8GR4ZIHUU1VARPZvA2WSars75p4.gh) (15.0 KB)  
simplified

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/f/9/9f98a600ea8af5b15d11a9594a28b330ad1e0a5b.jpeg)

---

<div class="post-metadata">

**Author:** ![inno](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/inno/32/544036_2.png) [@inno](https://discourse.mcneel.com/u/inno)\
**Post date:** [July 26, 2023, 8:18am UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251/4 "2023-07-26T08:18:40Z")

</div>

if all circles lie on the very same plane and all circles have very same radius, then you can also use Proximity2D, which might be a tad faster than RTree but would only work if both the above conditions are met

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/3/4/1/341f3421fcd18dd78626205be4713b296fd257cd.png)

[Circle Selection By Intersecting Points\_Re.gh](https://discourse.mcneel.com/uploads/short-url/rL2XUFh135EP0GWb4XMHqspPzPC.gh) (16.2 KB)

---

<div class="post-metadata">

**Author:** ![Cooper\_Copetas](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cooper_copetas/32/485205_2.png) [@Cooper\_Copetas](https://discourse.mcneel.com/u/Cooper_Copetas)\
**Post date:** [July 26, 2023, 2:43pm UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251/5 "2023-07-26T14:43:22Z")

</div>

Thank you both for the input and for providing gh examples.  
I never considered the “Proximity 2D” component. I’ll take it for a spin and see how I can apply it.

Now I’m curious, as a follow up, could this also be used to filter points (without generating circles) based on the number of neighbor points the have.

ex. given a grid with an even distribution of points where some points are missing, have the ability to select only the points that have 1, 2, 3, etc closest neighbors surrounding them. I’ve Included a screenshot as an example. (the doodle is a loose example)

Thanks for any additional feedback!

 ![Screenshot 2023-07-26 102756](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/0/c/f0c05926fdc9eafab523666580bc2f687fdb62ff.png)  
 ![Screenshot 2023-07-26 102756 doodled](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/f/7/4f77598cd68eb36c6d645b1f0789449f3cac116d.png)

---

<div class="post-metadata">

**Author:** ![inno](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/inno/32/544036_2.png) [@inno](https://discourse.mcneel.com/u/inno)\
**Post date:** [July 26, 2023, 2:50pm UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251/6 "2023-07-26T14:50:19Z")

</div>

> [@Cooper\_Copetas](#):
>
> Now I’m curious, as a follow up, could this also be used to filter points (without generating circles) based on the number of neighbor points the have.
> 
> ex. given a grid with an even distribution of points where some points are missing, have the ability to select only the points that have 1, 2, 3, etc closest neighbors surrounding them

this part of the definition is allowing to select all points with “n or more” intersections

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/7/d/f7d07f2e047f09d87cf7b0c083cc2552ed27e9c0.jpeg)

but if you trim it out you will chose only points with exactly that amount of intersections:

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/d/2/6/d26bbf77dea8c019dd672b044cf388e2c31b473f.jpeg)  
[Circle Selection By Intersecting Points\_Re\_Re.gh](https://discourse.mcneel.com/uploads/short-url/cbYvw3r1EaKAIn3ugg3a0EPuXbz.gh) (15.4 KB)

* * *

if you want to recreate a complete data tree with all the points divided in branches, where branch address {n} contains all the points with n neighbors:

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/2/6/e/26e2ca150b293339ffecff7eca55e35e72433d22.png)

---

<div class="post-metadata">

**Author:** ![Cooper\_Copetas](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cooper_copetas/32/485205_2.png) [@Cooper\_Copetas](https://discourse.mcneel.com/u/Cooper_Copetas)\
**Post date:** [July 26, 2023, 3:37pm UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251/7 "2023-07-26T15:37:52Z")

</div>

Yeah I had a look.

The real question now is would you have insight on how to perform the procedure I described without generating circles to calculate the number of neighbor points?

Thanks again for taking an interest in this.

---

<div class="post-metadata">

**Author:** ![inno](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/inno/32/544036_2.png) [@inno](https://discourse.mcneel.com/u/inno)\
**Post date:** [July 26, 2023, 4:35pm UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251/8 "2023-07-26T16:35:25Z")

</div>

yeah, you can do like this:

[https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/c/1/6/c16e41c2d80baac6efe89af6d36dda762f897626.mp4](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/c/1/6/c16e41c2d80baac6efe89af6d36dda762f897626.mp4)

circles are just not part of the definition at all 🙂

---

<div class="post-metadata">

**Author:** ![Cooper\_Copetas](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cooper_copetas/32/485205_2.png) [@Cooper\_Copetas](https://discourse.mcneel.com/u/Cooper_Copetas)\
**Post date:** [July 26, 2023, 4:36pm UTC](https://discourse.mcneel.com/t/picking-circles-by-the-of-circles-each-circle-intersects/163251/9 "2023-07-26T16:36:26Z")

</div>

haha yes I realized that just moments after following up 😃

Thank you haha
