Seeking help with plotting points as numbers in a table / matrix

Hi everyone, I hope this is the right place to ask this. I have been pounding my head against the wall for the last few days, ran through 100+ forum post, and am completely lost and am wondering if anyone here can help give me guidance.

I am working on a script that takes a surface and breaks it into an array of points / grids in order to run a maze solver. The script currently creates two continuous series of of squares. One series represents the rooms floor area and another represents the walls / inaccessible space.

Currently that part is successful and separates the area exactly how I want it to while keeping the grids aligned to each other

Void-area points

Floor-area points

The end goal is for these squares or points to be represented as 1’s and 0’s in a matrix so that my python program can then run a maze from one corner to another corner. This is what the matrix looks like in my code test that I am trying to replicate with the squares:

The problem I have now is I’m completely stuck on how to migrate my current arrangement of squares in the first picture into that matrix array in the 2nd. I have all the points plotted and at the exact same points in space, but I’m completely lost for a way to translate these into the matrix in the last picture.

If anyone could help point me to some good resources or have potential search terms that I could take to Dr. Google to help resolve this I would be insanely grateful. Thanks for having a look.

files:
Maze Base.3dm (136.9 KB)
Maze Solver Early.gh (18.7 KB)

1 Like

I’m sorry, was a bit confused by your definition… may I ask why not using a point grid with point_in_curve test?


Maze Solver Early_point_in_grid.gh (25.1 KB)

to get the list of 1s and 0s ready for use:


the following should work on your original definition, using your own generated points (but there are for sure smarter/faster way to sort them)


Maze Solver Early_Re.gh (20.5 KB)

2 Likes

I can’t even begin to say thank you enough! I’m going to dig deep into your solution to learn how and why it works so I can apply that to future projects. I’m honestly shocked by how good you are with Grasshopper - I wish I could be at your level of competency with GH!