bar3d
Mojo module 🡭
bar3d
Mark.BAR3D and Mark.VOXELS: solids built from axis-aligned boxes (#345).
Step 5 of #345, the cuboid half. Both marks draw the same thing – a
box’s six faces, projected through Frame3D, depth sorted and handed to
fill_mesh – and differ in where the boxes come from: one per (x, y)
sample, rising to its own height, or one per filled cell of a solid
occupancy grid.
A box needs shading to read as a box. Every face of a cuboid drawn in one flat color projects to a hexagon with no internal structure, and a row of them reads as a row of hexagons. The three face orientations are therefore drawn at three lightnesses, brightest on top. It is a fixed key, not a light source: the same orientation is the same lightness in every box in the figure, so the shading never carries data and two boxes can still be compared.
Interior faces are dropped where they can be. voxels emits a
face only when the neighbor across it is empty, which takes a filled
block from six faces per cell down to its surface area. It is a
neighbor test, not a visibility test, so it keeps one thing it could
drop: the six walls of a cavity sealed inside a solid all have an
empty neighbor and all get built, though nothing outside can see them.
Finding those needs reachability from outside, and six faces per
sealed pocket is not yet worth it. A bar3d bar has no neighbors to
test against at all, so it emits all six faces and lets the depth sort
cover the ones facing away.