#!/usr/bin/env python3
"""Truth in Stone: block-mass recomputations used in the 'Scale gap' callouts.
Released under CC0 1.0. Inputs are published dimensions; densities are typical ranges for the rock type.
Run: python3 scale-gap-block-masses.py"""
CEILING_T = 40  # largest documented move of a block with pre-industrial methods in a modern test (see the callout sources)

def box(l, w, h): return l * w * h

def show(name, vol_m3, rho_lo, rho_hi, quoted=None):
    lo, hi = vol_m3 * rho_lo, vol_m3 * rho_hi
    s = f"{name}: volume {vol_m3:.1f} m3 x {rho_lo}-{rho_hi} t/m3 = {lo:.0f}-{hi:.0f} t  ({lo/CEILING_T:.1f}-{hi/CEILING_T:.1f} x the {CEILING_T} t ceiling)"
    if quoted: s += f"; quoted {quoted} t implies {quoted/vol_m3:.2f} t/m3"
    print(s)

# Pumapunku, Plataforma Litica red sandstone slabs (dimensions as published from Ponce Sangines et al.)
show("Pumapunku slab 1 (7.81 x 5.17 x 1.07 m)", box(7.81, 5.17, 1.07), 2.3, 2.65, quoted=131)
show("Pumapunku slab 2 (7.90 x 2.50 x 1.86 m)", box(7.90, 2.50, 1.86), 2.3, 2.65, quoted=85.21)
# Slab 2's quoted mass implies about 2.32 t/m3, normal for sandstone; applied to slab 1:
print(f"  slab 1 at slab 2's implied density: {box(7.81,5.17,1.07)*85.21/box(7.90,2.50,1.86):.0f} t")

# Unfinished obelisk, Aswan (Engelbach 1922): shaft 41.75 m long overall incl. pyramidion, base 4.20 m square,
# pyramidion base 2.50 m square, pyramidion height 4.50 m. Shaft treated as a frustum of a square pyramid.
L, b0, b1, hp = 41.75, 4.20, 2.50, 4.50
hs = L - hp
shaft = hs / 3 * (b0**2 + b1**2 + b0 * b1)
pyr = hp / 3 * b1**2
show("Unfinished obelisk, Aswan", shaft + pyr, 2.65, 2.75, quoted=1168 * 1.016)
