Resources Numerical accuracy Calculation policy

BCF viewpoint of a markup

The camera position and view scale written to a BCF file for each markup, in meters of paper.

How the precision is kept

A sheet has no model coordinates, so the camera looks straight down on the center of the markup's box. Points are converted to meters with 0.0254 ÷ 72, one 64-bit quotient of the two defined values. Each number is written with 6 decimals, so the file carries the position to 0.000001 m.

Calculations under this policy

1 calculation in 1 source file. 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.

bcf.js MarkupCraft 0.8.1 64-bit 1 calculation Reviewed

Tests bin/test-markupcraft.mjs

Camera point and view scale

64-bit

The 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.

  • bcf.js
  • lines 207 to 215
  • MarkupCraft 0.8.1
// 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' });

In detail

Method
center = box midpoint × 0.0254 ÷ 72; view scale = 1.4 × max(box width, box height, 36 points) × 0.0254 ÷ 72.
Number types
64-bit numbers, written as decimal text with at most 6 decimals.
Limits
The written values are rounded to 6 decimals of a meter. The camera height is a fixed 10.

Approach: 64-bit, direct

Every value is a 64-bit number from input to result. Formulas are closed form or a direct solve, and every comparison uses a stated tolerance.

Every policy that takes this approach