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.
Calculations
-
Faceted faces
Triangles for a flat face given as loops of points.
n = Σ ((yᵢ − yⱼ)(zᵢ + zⱼ), (zᵢ − zⱼ)(xᵢ + xⱼ), (xᵢ − xⱼ)(yᵢ + yⱼ))
STEP import: units, points and assembly placement step/read.js64-bit- BimCraft
- ModelCraft
- PartCraft
-
Rounding of spoken numbers and angles
Turns a number or an angle into the short text that is spoken.
num(v) = round(v × 100) ÷ 100; deg(θ) = num(round(normAngle(θ) × (180 ÷ π) × 100) ÷ 100)
Spoken lengths, directions and extents access.js64-bit- CadCraft
-
Direction as one of eight words
Which of the eight directions (right, up-right, up and so on) leads from one point to another.
index = round(atan2(Δy, Δx) ÷ (π ÷ 4)) mod 8
Spoken lengths, directions and extents access.js64-bit- CadCraft
-
A move in words
The distance, angle and the two components of a move from one point to another.
d = √(Δx² + Δy²); angle = atan2(Δy, Δx)
Spoken lengths, directions and extents access.js64-bit- CadCraft
-
Length along an object
The length of a line, circle, arc or polyline that is read out with the object.
line: √(Δx² + Δy²); circle: 2πr; arc: r × ((a₁ − a₀) mod 2π); polyline: Σ |pᵢ₊₁ − pᵢ|
Spoken lengths, directions and extents access.js64-bit- CadCraft
-
Extents of the visible objects
The width, height and corners of the box round everything visible, said with the object counts.
w = maxX − minX; h = maxY − minY
Spoken lengths, directions and extents access.js64-bit- CadCraft
-
Objects within a radius
The objects within a given distance of a point, nearest first.
Spoken lengths, directions and extents access.js64-bit- CadCraft
-
Distance and side of each nearby object
For each object near the cursor: whether the cursor is on it, or how far away it is and on which side.
Spoken lengths, directions and extents access.js64-bit- CadCraft
-
Measure between two points
The length, angle, Δx and Δy said back after a command takes a point.
d = √(Δx² + Δy²); angle = atan2(Δy, Δx)
Spoken lengths, directions and extents access.js64-bit- CadCraft
-
Snap points near the cursor
The snap points within a radius of a point, nearest first, for stepping from one to the next with a key.
d = √((sx − px)² + (sy − py)²)
Spoken lengths, directions and extents access.js64-bit- CadCraft
-
Transform from point pairs
The move, turn, scale and mirror that carry one to three source points onto their destination points.
turn = atan2(d₂ − d₁) − atan2(s₂ − s₁); k = |d₁d₂| ÷ |s₁s₂|; M = T(d₁) · R(turn) · S(k) · T(−s₁)
Align and distribute align.js64-bit- CadCraft
-
Bounding boxes in the coordinate system in force
Each selected object's bounding box, measured along the axes of the user coordinate system when one is set.
with a UCS: box of R(−angle) · T(−origin) applied to the object
Align and distribute align.js64-bit- CadCraft
-
Edge or middle of a box
The left, center, right, top, middle or bottom coordinate of a bounding box.
center = (minX + maxX) ÷ 2; middle = (minY + maxY) ÷ 2
Align and distribute align.js64-bit- CadCraft
-
Moves that line objects up
For each object, the vector that brings its chosen edge or middle onto the reference.
d = ref − edge(box)
Align and distribute align.js64-bit- CadCraft
-
Moves that space objects evenly
For each object between the first and the last, the vector that makes the middles or the gaps equal.
centers: step = (mid_last − mid_first) ÷ (n − 1); gaps: gap = (span − Σ sizes) ÷ (n − 1)
Align and distribute align.js64-bit- CadCraft
-
Degrees, minutes, seconds to decimal degrees
The decimal angle for text such as 45°23'30", 45d23'30" or, inside a bearing, 45-23-30.
deg = d + m ÷ 60 + s ÷ 3600
Bearings and degrees-minutes-seconds angles.js64-bit- CadCraft
-
Bearing or DMS text to an angle
The angle in degrees, counter-clockwise from east, for a typed bearing such as N45°23'30"E or a plain DMS angle.
N…E: 90 − off; N…W: 90 + off; S…E: 270 + off; S…W: 270 − off
Bearings and degrees-minutes-seconds angles.js64-bit- CadCraft
-
Decimal degrees to degrees, minutes and seconds
The degrees, minutes and seconds text for an angle at the chosen precision.
n = round(deg × unit + 10⁻⁹); d = ⌊n ÷ unit⌋; m = ⌊rest ÷ (unit ÷ 60)⌋; s = (rest − m × unit ÷ 60) ÷ 10^secDec
Bearings and degrees-minutes-seconds angles.js64-bit- CadCraft
-
Angle to a surveyor's bearing
Bearing text such as N45°23'30"E for an angle in degrees.
a = deg mod 360; offset = |90 − a| (north half) or |270 − a| (south half)
Bearings and degrees-minutes-seconds angles.js64-bit- CadCraft
-
Angle in the drawing's angle format
An angle written as decimal degrees, degrees-minutes-seconds, grads, radians or a bearing.
grads = a × 10 ÷ 9; radians = a × π ÷ 180
Bearings and degrees-minutes-seconds angles.js64-bit- CadCraft
-
Bearing of a vector
The bearing text for a direction given by its x and y components.
angle = atan2(dy, dx) × 180 ÷ π
Bearings and degrees-minutes-seconds angles.js64-bit- CadCraft
-
Size in millimeters
The width and height of the copied area, on paper or at the drawing's real size.
paper: mm = pixels × ptPerPx × (25.4 ÷ 72); real: mm = pixels × mmPerPx
Size of a copied area areaclip.js64-bit- CadCraft
- BimCraft
- MarkupCraft
- DetailCraft
-
Render size in pixels
The pixel width and height for an area given in points at a resolution, lowered so neither side passes the cap.
d = dpi × min(1, maxPx ÷ (longer side × dpi ÷ 72)); w = round(wPt × d ÷ 72); h = round(hPt × d ÷ 72)
Size of a copied area areaclip.js64-bit- CadCraft
- BimCraft
- MarkupCraft
- DetailCraft
-
Scale and turn from two points
The scale, the angle and the point mapping that carry two points on the picture onto the two points where they belong.
scale = |b₂ − b₁| ÷ |a₂ − a₁|; angle = atan2(b₂ − b₁) − atan2(a₂ − a₁); map(p) = b₁ + scale · R(angle) · (p − a₁)
Size of a copied area areaclip.js64-bit- CadCraft
- BimCraft
- MarkupCraft
- DetailCraft
-
Box round a turned picture
The width and height of the upright box round a picture turned by an angle.
w′ = w·|cos θ| + h·|sin θ|; h′ = w·|sin θ| + h·|cos θ|
Size of a copied area areaclip.js64-bit- CadCraft
- BimCraft
- MarkupCraft
- DetailCraft
-
Outline of an elliptical area
The points of the ellipse that fits a box, used as the outline of a round copied area.
pᵢ = (cx + rx·cos(2π·i ÷ n), cy + ry·sin(2π·i ÷ n)), n = 96
Size of a copied area areaclip.js64-bit- CadCraft
- BimCraft
- MarkupCraft
- DetailCraft
-
Unit factor and tolerance
The factor between drawing units and the file's units, and the tolerance the comparison uses.
factor = mm per unit ÷ 1000 (meters), ÷ 304.8 (feet), or 1; default tol = 10 ÷ mm per unit
As-built points compared with the drawing asbuilt.js64-bit- CadCraft
-
Comparison and conversion back to the drawing
Compares the two point lists in the file's units and brings as-built points back into drawing coordinates.
compare with tol × factor; drawn point = file point ÷ factor
As-built points compared with the drawing asbuilt.js64-bit- CadCraft
-
Marks and labels in the drawing
A point at each as-built shot, a line from the design point when it is out of tolerance, and a label with the distance.
label = (dh ÷ factor).toFixed(min(4, max(0, ⌈−log₁₀ tol⌉))); text height = max(1.5 × tol, 0.5 × current text height)
As-built points compared with the drawing asbuilt.js64-bit- CadCraft
-
Same object within a tolerance
Whether two objects are the same shape on the same layer, apart from their ids.
Drawing autocomplete autocomplete.js64-bit- CadCraft
-
Next copy of a repeat
The next copy when the last one to four objects were copied at one step twice or more.
step = anchor(B₀) − anchor(A₀); tol = max(10⁻⁶, 0.004 × |step|); next = last group moved by step
Drawing autocomplete autocomplete.js64-bit- CadCraft
-
Next period of a stair
The next riser and tread of an open polyline whose steps repeat.
dⱼ = pⱼ − pⱼ₋₁; repeats when |dⱼ − dⱼ₋ₚ| ≤ max(10⁻⁶, 0.004 × longest step); new vertex = last vertex + dⱼ
Drawing autocomplete autocomplete.js64-bit- CadCraft
-
Chain of segments through the newest line
The run of connected line and polyline segments that the newest line or polyline belongs to, as an ordered list of vertices.
Drawing autocomplete autocomplete.js64-bit- CadCraft
-
Do two segments cross
Whether the closing side would cross another side of the figure.
cross(o, a, b) = (a.x − o.x)(b.y − o.y) − (a.y − o.y)(b.x − o.x); cross when d₁·d₂ < 0 and d₃·d₄ < 0
Drawing autocomplete autocomplete.js64-bit- CadCraft
-
Closing sides of a nearly closed figure
The two missing sides of a rectangle drawn as two sides, or the closing side of a chain of three or more.
rectangle: p₄ = v₀ + (v₂ − v₁), offered when |u·w| ÷ (|u||w|) ≤ 0.01; chain: closing side v_last → v₀
Drawing autocomplete autocomplete.js64-bit- CadCraft
-
Next point of a running line
The point offered after the points picked so far in LINE or PLINE: the next stair step, a rectangle's fourth corner, the first point again, or one more equal step.
tol = max(10⁻⁶, 0.002 × longest step); square when |u·v| ≤ 0.002 × |u||v|; next = last point + a stored step
Drawing autocomplete autocomplete.js64-bit- CadCraft
-
Merging near-equal positions
Sorts edge positions and merges those that are within a tolerance of each other.
Automatic dimensions autodim.js64-bit- CadCraft
-
Level and plumb edges, circles and points
Collects the positions to dimension from the chosen objects and the size of the box round them.
diagonal = √(w² + h²); plumb when |Δx| ≤ tol; level when |Δy| ≤ tol
Automatic dimensions autodim.js64-bit- CadCraft
-
Is the dimension already there
A key that is equal for two dimensions of one kind with the same end points.
key = kind : round(x₁ ÷ g), round(y₁ ÷ g), round(x₂ ÷ g), round(y₂ ÷ g), g = 20 × tol
Automatic dimensions autodim.js64-bit- CadCraft
-
Chains and overall dimensions
The dimensions strung between neighboring edge positions along each chosen side, and one overall dimension outside them.
minLen = max(0.003 × diagonal, 10 × tol); chain line at box edge ∓ 6 × text height; overall line 5 × text height further out
Automatic dimensions autodim.js64-bit- CadCraft
-
Opening widths
The width of a gap between collinear lines on one layer, taken as a door or window opening.
w = next.lo − this.hi; kept when minLen ≤ w ≤ 0.35 × diagonal and w ≤ 0.8 × the longer neighbor
Automatic dimensions autodim.js64-bit- CadCraft
-
Hole diameters
One diameter dimension for each size of circle.
p₁ = center + r·(cos 45°, sin 45°); text at center + (r + 3 × text height)·(cos 45°, sin 45°)
Automatic dimensions autodim.js64-bit- CadCraft
-
Longitude and latitude to web Mercator
The web Mercator x and y in meters for a longitude and latitude in degrees.
x = R·λ·π ÷ 180; y = R·ln(tan(π ÷ 4 + φ·π ÷ 360)), R = 6378137
Map layers: web Mercator, tile grids and world files basemap.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Web Mercator to longitude and latitude
The longitude and latitude in degrees for a web Mercator x and y in meters.
λ = x ÷ R × 180 ÷ π; φ = (2·atan(e^(y ÷ R)) − π ÷ 2) × 180 ÷ π
Map layers: web Mercator, tile grids and world files basemap.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Standard tile grid
The origin and the resolution of each zoom level of the usual 256-pixel web Mercator tiles.
origin = (−πR, πR); res(z) = 2πR ÷ 256 ÷ 2^z, z = 0…22
Map layers: web Mercator, tile grids and world files basemap.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Tile that holds a place
The tile column and row at a zoom level for a longitude and latitude.
col = ⌊(x + πR) ÷ (res × 256)⌋; row = ⌊(πR − y) ÷ (res × 256)⌋
Map layers: web Mercator, tile grids and world files basemap.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Tiles covering a box
The tiles of a grid that cover a box, each with its bounds in the grid's units.
bounds = [ox + c·tw, oy − (r + 1)·th, ox + (c + 1)·tw, oy − r·th], tw = res × tile width
Map layers: web Mercator, tile grids and world files basemap.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Meters per unit of a coordinate system
The length in meters of one degree, foot, US survey foot or meter, for turning a WMTS scale into a resolution.
degree: 2π × 6378137 ÷ 360; foot: 0.3048; US survey foot: 1200 ÷ 3937; otherwise 1
Map layers: web Mercator, tile grids and world files basemap.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Tile grid of a WMTS tile matrix set
The resolution and top-left corner of each level of a WMTS tile matrix set.
res = scale denominator × 0.00028 ÷ meters per unit
Map layers: web Mercator, tile grids and world files basemap.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
World file to a pixel-corner transform
The transform from pixel corners to coordinates for a picture, from the six numbers of its world file.
x₀ = C − A ÷ 2 − B ÷ 2; y₀ = F − D ÷ 2 − E ÷ 2
Map layers: web Mercator, tile grids and world files basemap.js64-bit- CadCraft
- BimCraft
- CivilCraft
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.