Studs are, of course, the real magic of Lego, but isolating a specific stud on a specific piece of Lego within LDraw's construction system can be a challenge. On a standard brick, in a given location you can calculate the stud location, but what if you are randomly placing random bricks and random plates into a model, how can you track the location of available studs within your model?
Tracking stud availability within a random model build would turn out to be a lot trickier than I imagined.
I started by reviewing the layers of the brick matrix that I use to track the placement of bricks and plates during the model build
Previously I'd only really focused on a single matrix layer during the build process to track the addition of new bricks as they were added to the model build (so I always focused on the top most layer in the matrix). What I would need to do now was track all the layers for each brick added to the model build and then compare each layer to try to isolate where a stud might be available, by eliminating studs as more bricks were added to the model.