The 3D view geometry for open pits (haul ramp ribbons, bench rims) and ground solar tables.
How the precision is kept
These functions only build triangles and line segments for the 3D view. Bench rims are returned as a Float32Array for drawing. The pit and ground figures a person reads are computed elsewhere in 64-bit numbers.
Calculations under this policy
4 calculations in 3 source files. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.
Points are put through the view transform L and stored in a Float32Array that only feeds the GPU.
site3d-pit.js
lines 30 to 36
CivilCraft 0.8.1
export function pitLines(list, L) {
const out = [];
for (const pit of list || []) for (const b of pit.benches || []) for (const loop of b.loops) for (let i = 0; i < loop.length; i++) {
const p = loop[i], q = loop[(i + 1) % loop.length]; out.push(...L(p[0], p[1], b.z), ...L(q[0], q[1], b.z));
}
return new Float32Array(out);
}
Haul ramp ribbon
32-bit, display only
A road-wide ribbon on the pit walls for the haul ramp.