Resources Numerical accuracy

Calculations

Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.

  • 6,917 calculations in 1,248 source files
  • 143 exact
  • 6,286 in 64-bit
  • 335 with a 32-bit step
  • Last reviewed

Calculations

  • Align the old sheet in a comparison

    The fit of the old sheet onto the new one from two points picked on each, and the scale and turn reported for it.

    scale = hypot(M₀, M₁); turn = atan2(M₁, M₀) × 180 ÷ π

    Markup geometry while drawing and editing markupcraft.js
    • MarkupCraft
    64-bit
  • Line up a picture by two points

    The new box of a picture markup so two points on it land on two points on the sheet.

    k = √(rw·rh ÷ (W·H)) × fit scale; box = center ± (w·k ÷ 2, h·k ÷ 2)

    Markup geometry while drawing and editing markupcraft.js
    • MarkupCraft
    64-bit
  • Length measurement label

    The dimension line, its end ticks and the length text of a measure markup.

    len = hypot(bₓ − aₓ, b_y − a_y); label = len × mmPerPt, formatted

    Markup outlines and measurement labels shapes.js
    • MarkupCraft
    64-bit
  • Area measurement label

    The area and perimeter text of an area markup, placed at the outline's centroid.

    Markup outlines and measurement labels shapes.js
    • MarkupCraft
    64-bit
  • Angle measurement label

    The angle text of an angle markup and where it sits.

    label = angle at the vertex, 1 decimal; position = vertex + (r + 1.2 × font size) along the bisector

    Markup outlines and measurement labels shapes.js
    • MarkupCraft
    64-bit
  • Count total

    The running total shown beside the first mark of a count group.

    n = number of marks

    Markup outlines and measurement labels shapes.js
    • MarkupCraft
    Exact
  • Centroid of an outline

    The area centroid of a closed outline, used to place the label of an area or a named zone.

    k = xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ; cₓ = Σ (xᵢ + xᵢ₊₁)·k ÷ (3·Σ k)

    Markup outlines and measurement labels shapes.js
    • MarkupCraft
    64-bit
  • Circle-to-Bézier constant

    The control-point factor for drawing a quarter circle as one cubic Bézier.

    K = 4·(√2 − 1) ÷ 3 ≈ 0.5522847498

    Markup outlines and measurement labels shapes.js
    • MarkupCraft
    64-bit
  • Ellipse outline

    An ellipse markup's outline as four cubic Bézier curves inside its box.

    c = (p₀ + p₁) ÷ 2; r = (p₁ − p₀) ÷ 2; control offset = r × K

    Markup outlines and measurement labels shapes.js
    • MarkupCraft
    64-bit
  • Revision cloud outline

    The scalloped outline of a cloud markup round its corner points.

    n = max(1, round(edge ÷ arc)); step = edge ÷ n; bulge height = 0.6667 × step

    Markup outlines and measurement labels shapes.js
    • MarkupCraft
    64-bit
  • Signed area of an outline

    The signed shoelace area used to tell which way an outline runs.

    A = Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ) ÷ 2

    Markup outlines and measurement labels shapes.js
    • MarkupCraft
    64-bit
  • A number in an appearance stream

    Turns a number into the text written in a PDF appearance stream.

    text = v rounded to 3 decimals, trailing zeros removed; |v| < 1e-6 → 0

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Appearance stream of a markup

    The drawing operators that show a markup in any PDF viewer.

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Private copy of a markup

    The JSON kept with each annotation so it reopens exactly: points, box, cut-outs, style and the rest.

    ar = round(rect × 1000) ÷ 1000

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Annotation rectangle

    The /Rect of a markup's annotation, which is also the bounding box of its appearance.

    rect = bounds ± 1 pt; each side ≥ 2 × line width + 2 pt

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Bounds of a display list

    The box round everything a markup draws, used for its annotation rectangle.

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Rectangle differences of a box or ellipse

    The /RD entry: how far the shape's outer edge sits inside the annotation rectangle on each side.

    RD = [left, top, right, bottom] gaps between rect and box ± half line width, each ≥ 0

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Count marks as ink rings

    Writes a count group as one Ink annotation with a small ring round each mark.

    ring: 13 points at 30° steps, radius max(3, 0.8 × font size)

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Arc exported as a PolyLine

    Writes an arc markup's /Vertices as points along the arc, because PDF has no arc annotation.

    n = max(8, ⌈|sweep| ÷ (π ÷ 32)⌉); vertex k = c + r × (cos, sin)(a₀ + sweep × k ÷ n)

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Picture placement matrix

    The matrix that paints a picture markup into its box, upright for the page's rotation.

    cm = [u·W, −v·H, origin + v·H], each number to 4 decimals

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Scale as a /Measure dictionary

    The sheet's scale in the form other PDF programs read: the factor from points to the unit and the display precision.

    X.C = mmPerPt ÷ 304.8 (ft), ÷ 25.4 (in), ÷ 1000 (m), or mmPerPt (mm)

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Scale written on the page

    Stores a sheet's calibration on its page in the saved PDF.

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Measured text in /Contents

    The text other PDF programs show for a measurement: the length, the area and perimeter, the angle or the count.

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Flattened markup

    Paints a markup into the page itself instead of saving it as an annotation.

    Numbers written to the saved PDF pdf-write.js
    • MarkupCraft
    64-bit
  • Outline points of a PolyLine or Polygon

    The points of a polyline, polygon, cloud or area markup read from an annotation.

    Annotations and scales read from a PDF pdf-read.js
    • MarkupCraft
    32-bit in part
  • Stroke points of an Ink annotation

    The points of pen and highlighter strokes, and of count rings, read from an annotation.

    Annotations and scales read from a PDF pdf-read.js
    • MarkupCraft
    32-bit in part
  • End points of a Line annotation

    The two end points of a line, arrow or length measurement read from an annotation.

    Annotations and scales read from a PDF pdf-read.js
    • MarkupCraft
    64-bit
  • Box of a Square or Circle annotation

    The box of a rectangle, ellipse or cloud rectangle markup from the annotation's /Rect.

    box = rect inset by RD and by half the border width on each side

    Annotations and scales read from a PDF pdf-read.js
    • MarkupCraft
    64-bit
  • Count mark from its ring

    The position of each count mark, from the ring written for it in the ink list.

    center = mean of the ring's points (the closing point dropped)

    Annotations and scales read from a PDF pdf-read.js
    • MarkupCraft
    64-bit
  • Moved by another program

    Decides whether a markup's private JSON still matches the annotation, or another program moved or resized it since.

    |ar − rect| > 0.75 pt on any of the four numbers → use the annotation's own geometry

    Annotations and scales read from a PDF pdf-read.js
    • MarkupCraft
    64-bit
  • Scale from another program's /Measure

    A sheet calibration from the measurement dictionary another PDF program wrote.

    mmPerPt = C × mm per unit (ft 304.8, in 25.4, m 1000, cm 10, mm 1)

    Annotations and scales read from a PDF pdf-read.js
    • MarkupCraft
    64-bit
  • Which scale a sheet opens with

    Picks the calibration of a page: MarkupCraft's own saved copy, else the page's measure viewport.

    Annotations and scales read from a PDF pdf-read.js
    • MarkupCraft
    64-bit
  • Text size from an appearance stream

    The size of the first visible text that another program's text box draws.

    size = |Tf size × text matrix scale × cm scale|, rounded to 0.01

    Annotations and scales read from a PDF freetext.js
    • MarkupCraft
    64-bit
  • Text size from a style string

    Reads 12pt, 16px or 1.2em from a text box's style as points.

    px × 0.75; em × 12; pt as written

    Annotations and scales read from a PDF freetext.js
    • MarkupCraft
    64-bit
  • A page's paths as segments

    Every drawn path of a page as straight segments in page coordinates.

    curve point = Bézier at t = j ÷ 8, j = 1…8; p′ = CTM × p

    Drawing comparison by vector paths vecdiff.js
    • MarkupCraft
    64-bit
  • Distance from a point to a segment

    How far a sample point is from one segment of the other sheet.

    t = clamp((p − a)·d ÷ |d|², 0, 1); distance = hypot(p − (a + t·d))

    Drawing comparison by vector paths vecdiff.js
    • MarkupCraft
    64-bit
  • Grid of segments

    Files each segment under the grid cells its bounding box covers, to find nearby segments quickly.

    cells = (⌊x_max ÷ cell⌋ − ⌊x_min ÷ cell⌋ + 1) × (same in y); more than 4000 → not in the grid

    Drawing comparison by vector paths vecdiff.js
    • MarkupCraft
    64-bit
  • Parts of a sheet with no match

    The pieces of one sheet's segments that have no segment of the other sheet within the tolerance.

    n = max(1, ⌈length ÷ step⌉) samples; miss when no segment within tol

    Drawing comparison by vector paths vecdiff.js
    • MarkupCraft
    64-bit
  • Removed and added lines

    The lines of the old sheet that are not on the new one, and the other way round.

    Drawing comparison by vector paths vecdiff.js
    • MarkupCraft
    64-bit
  • Boxes round groups of changes

    Groups changed segments that are close together into boxes, for clouding and for the list of changes.

    merge boxes closer than gap; keep groups with Σ length ≥ minLen

    Drawing comparison by vector paths vecdiff.js
    • MarkupCraft
    64-bit
  • Size of a changed area in words

    The size of a changed area as text: inches on the sheet and, on a calibrated sheet, the real size.

    in = round(pt ÷ 72, 1 decimal); real = pt × mmPerPt, in m to 1 decimal from 1000 mm, else whole mm

    Drawing comparison by vector paths changes.js
    • MarkupCraft
    64-bit
  • Where on the sheet

    Names the part of the sheet a point is in, on a 3 × 3 grid (upper left, center, lower right and so on).

    column = ⌊(x − x₀) ÷ w × 3⌋; row = ⌊(y₁ − y) ÷ h × 3⌋, each clamped to 0…2

    Drawing comparison by vector paths changes.js
    • MarkupCraft
    64-bit
  • Amount of change in an area

    How many points of line were removed and added inside one changed area, and whether it counts as added, removed or modified.

    removed = Σ hypot over removed pieces in the box; modified when both ≥ 6 pt

    Drawing comparison by vector paths changes.js
    • MarkupCraft
    64-bit
  • Segments clipped to a region

    The parts of a sheet's segments that lie inside a task's region.

    Liang–Barsky: r = q ÷ p per box side; keep when t₁ − t₀ > 1e-9

    Drawing comparison by vector paths tasks.js
    • MarkupCraft
    64-bit
  • Region snapshot

    What a task's region link stores when it is made: the sheet's lines inside the region.

    keep the 300 longest clipped segments; each coordinate rounded to 0.1 pt

    Drawing comparison by vector paths tasks.js
    • MarkupCraft
    64-bit
  • Has the region changed

    Decides whether the drawing inside a task's region changed between the snapshot and the new revision.

    changed when removed + added ≥ 4 pt and (removed + added) ÷ stored length ≥ 0.02

    Drawing comparison by vector paths tasks.js
    • MarkupCraft
    64-bit
  • Has a model element changed

    Compares the stored state of a linked model element with its state now, number by number.

    same when |x − y| ≤ tol

    Drawing comparison by vector paths tasks.js
    • MarkupCraft
    64-bit
  • Removed and added line reported

    The amount of removed and added line shown after comparing two sheets by their lines.

    amount = round(Σ hypot(Δx, Δy)) in points

    Drawing comparison by vector paths markupcraft.js
    • MarkupCraft
    64-bit
  • Sheets ranked by change

    Ranks the sheet pairs of two sets by how much line changed and marks the ones that changed.

    len = round(Σ hypot over removed and added); changed when len ≥ 6

    Drawing comparison by vector paths markupcraft.js
    • MarkupCraft
    64-bit
  • Clouds round the changes

    Adds a cloud rectangle markup round each group of changes on every changed sheet.

    cloud box = cluster box grown by 8 pt on each side

    Drawing comparison by vector paths markupcraft.js
    • MarkupCraft
    64-bit

A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.