I've got the week off for some R&R, and today I'm going to start looking into a new addition to my 3D engine spreadsheet: opacity.
Here's the original, if you're curious: https://docs.google.com/spreadsheets/d/1lUBYurOWNJjBeMJLjiXMQqLVmqPUqhhKOsg-B56spOY/copy
The problem I'd like to fix is that because it uses the SPARKLINE formula, everything on the screen is ultimately one line, which means lines might cross each other in weird ways, and that all objects are effectively transparent.
That's fine for simple shapes, but limits the options for more complex drawings/toys/games.
I *think* I can do it by taking the list of coordinates, splitting them into triplets, numbering each one, then using VLOOKUP to find the first iteration of each triplet. For triplets that appear twice, the VLOOKUP should return a lower integer than the assigned number, giving me a range to pull from the original list.
Just gonna… leave this here for myself, for when I come back to this tomorrow http://www0.cs.ucl.ac.uk/research/vr/Projects/VLF/vlfpapers/tracing/Appel_A__The_Notion_of_quantitative_invisibility_and_the_machine_rendering_of_solids.pdf
Didn’t actually get anything done today — spent most of the day reading that article and others like it.
They helped confirm I’m at least thinking about the problem correctly (I need to define planes then determine whether a given point is visible behind them), but I’m still stuck on how to get a spreadsheet to do that reliably. 🤔
Part 2 will be finding all of the points that appear twice in the new list of points, then marking them based on how "close" they are to the viewer.
Part 3 will then be replacing the points between the "further" marked points, and replacing them with the points between the "closer" marked points.
The end result should be an optical illusion that makes objects look solid. 🤷♂️
Turns out that *in general*, arrays of difference sizes can't coexist nicely. *But*, using the new MAP function does let me take in multiple arrays and return strings based on a LAMBDA function, which can then be SPLIT, giving me arrays of different sizes. https://support.google.com/docs/answer/12568985
Getting close to my goal here, but it breaks when the lines overlap, for... some reason.
OK, so I've been spending a few days figuring out different ways that this *almost* works. Feels like I'm zeroing in on the right strategy, but for now I just wanted to say that the new LAMBDA functions are really great, and can be nested to achieve things similar to a QUERY function but *much* faster. Most of the rest of this project will hinge on MAP and REDUCE.
One of the things I've had to figure out is quickly finding the index of the *second* appearance of a given item in a list. In normal programming, you can loop through the list, and loop through again for each item. "Looping" isn't a thing in spreadsheets, but you can do something like this instead:
It's also WAY faster than a QUERY function. I built out a similar formula with queries that worked *technically* on a small line, but immediately broke Google Sheets when I tried inputting anything close to my goal objects.
A tiny server for experimenting with fun things on the web.