Camera point and view scale
64-bitThe camera's X and Y over the markup and the size of the view, in meters.
k = 0.0254 ÷ 72; cx = (x₀ + x₁) ÷ 2 × k; scale = 1.4 × max(Δx, Δy, 36) × k
The midpoint is taken in points and multiplied by k once. Each value is rounded with toFixed(6) and written without trailing zeros. The same lines are repeated for field records earlier in the file.
// camera: straight down on the markup's center, in meters of paper (1 pt = 0.3528 mm)
const b = t.box || m.rect || [0, 0, 0, 0];
const k = 0.0254 / 72;
const cx = ((b[0] + b[2]) / 2) * k, cy = ((b[1] + b[3]) / 2) * k;
const span = Math.max(b[2] - b[0], b[3] - b[1], 36) * k;
const pt = (x, y, z) => '<X>' + +x.toFixed(6) + '</X><Y>' + +y.toFixed(6) + '</Y><Z>' + +z.toFixed(6) + '</Z>';
files.push({ name: g + '/viewpoint.bcfv', data: '<?xml version="1.0" encoding="UTF-8"?>\n<VisualizationInfo Guid="' + vg + '">\n\t<OrthogonalCamera>\n' +
'\t\t<CameraViewPoint>' + pt(cx, cy, 10) + '</CameraViewPoint>\n\t\t<CameraDirection>' + pt(0, 0, -1) + '</CameraDirection>\n' +
'\t\t<CameraUpVector>' + pt(0, 1, 0) + '</CameraUpVector>\n\t\t<ViewToWorldScale>' + +(span * 1.4).toFixed(6) + '</ViewToWorldScale>\n\t</OrthogonalCamera>\n</VisualizationInfo>\n' });