I am trying to sample an area into hexagonal grids. And based on the where the roadways(shown in green) are I want to separate out those hexagons.
I tried to divide the roadway curves into parts and check if the points fall within any hexagonal cell or not. However I am fairly new to grasshopper and couldn’t figure how work with trees? Also if anyone has any other suggestion on how it could be done I would greatly appreciate. Thank you.
Purely for fun get the attached as well: is not suitable - at all - for you (unless you have plans to learn C#) but outlines 3 ways to cluster your hexagons (Note: LunchBox is used for these).
BTW: Open curves are rejected plus hex Polylines with count != 7.
As I said is just for fun (unless … blah, blah). Plus is a very entry level take (thus is very slow) on a very challenging task: if you have lot’s of curves and lot’s of “pixels” (i.e. hexagons in this case) you’ll need a totally different approach in order to slash elapsed times.
Added an open/close curve support if the policy is CCX.
Closest point seems unreliable to me:
it might miss some hexagon and also sometime pick hexagons almost completely detached from the input curve (see top left).
Doing a distance + vector check might result the same as inscribed hexagon collision but with lighter calc…
I was able to make it work thanks to all the inputs. But I am still getting inconsistent width in-spite of using the inscribed hexagon method. More so, some hexagons which do not intersect are also being considered. Is it because of the scale of the drawing? Because the shapefile I got was very small. Is there any way i can fix the dimensions?
hex-pixels4.gh (15.6 KB)
(Inside also the failed attempt to solve with “inscribed hexagons” without curve-curve collisions: failed, incostant width and/or missing pixels, also heavier than collision method)