When I was growing up I loved to draw dot to dots, now that I'm older, I just draw more complex ones.
I'm delving into procedural generation, so picture the scene you have 20 dots randomly placed across a canvas, how can you find the nearest neighbor? Simple you might think, a simple sort of an array from smallest X to largest then for a given point you could find the index next to that point, in 1D space that would work yep but now add a Y axis. A closest point could have a similar Y and a larger X. So I got to thinking about this problem, how about a Radial search?
If I plan to have a dynamic scene of points that could be added to and removed from view by moving a camera around, it's not going to be possible to index everything and retain good performance I need to look at a given point and search outwards until I find a neighbor. The plan then is to draw a line connecting the points symbolically and physically. Point A knows about Point B and Point B knows about Point A, this is so we can skip both points and find Point C when Point B is found. The goal is to create a bunch of teselating triangles.
Is my idea horrible, how would you solve it?
It's social media for devs
Level up every day