arclength — this will be the length of the arc for the chord defined by boxdepth and the circle made by r determine by 2 \pi r (arcangle/360) (see: https://www.mathopenref.com/arclength.html )
A further consideration, for maximum interior volume we want the board edges to meet at the internal edges, which makes the boards which meet the lid skirt want a two-sided operation:
Okay, the 2 sided top is pretty much just a placeholder. For the 3 faceted top, we actually want good engineering and connections, so we need to angle the parts thus:
Actually, the skirt is going to get a flat treatment — it’ll look nicer thus, and having it symmetrical will enable a nifty option (I will go back and change the 3 facet design to adjust for height though).
First consideration is get the circumference, which is simply:
\pi r^2
(yeah, definitely going to have to use a .dtx and literate programming for the final version of all this)
then based on the chord length of the box as a whole (this is boxdepth) we calculate that angle using the Pythagorean theorem and then we can get the length of the segment arc by calculating the ratio of that angle to 360 times the circumference.
Next is placing it at the top of the lid and rotating multiples through the arc of the lid — arguably it should always be odd — will have to add logic for that.
Unfortunately, BlockSCAD/OpenSCAD makes doing contextual changes of variables (which aren’t really variables for some architectural reason) difficult, so we won’t be able to force things to odd at this juncture (so that there’s always a keystone — might add a parameter for that).
Except that I can’t get the logic for the in-between dimensions to work — if I adjust for one in-between dimension, it works for that specific on, but breaks for others. The general solution works for the flattest option: