I'm developing a game that allows players to design their own star ships. The design system uses a cube grid for the player to lay out internal systems and decks, creating a wide variety of shapes that the program then skins with a variety of plating and architecture styles. In order to factor the ship's plating into the design costs, weight factors, etc, I need the system to be able to calculate the exposed surface area of the player's design. This can vary greatly, as the player's design can use a widely varying number of internal cubes, as well as "towers" or other structures extending out of the craft's body.
So, my question is, what sort of algorithm(s) can I use to calculate the design's surface area?
The simplest ansatz, when already dealing with a cube grid, would be just to count the number of cubes, where the boundary surface intersects. That number has to be taken in ratio with the squared edge size of the cubes, for sure.
You would get an better approximation by halving the cube's edges and re-counting again. Etc.
--- rk