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
-
Which viewport is the sheet
Picks the viewport that stands for the sheet itself: at scale 1 and covering every other viewport.
|s − 1| ≤ 1e-6; covers: |o_x − v_x| + o_w ÷ 2 ≤ v_w ÷ 2 + 1e-6 × max(1, v_w, v_h)
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Lineweight in hundredths of a millimeter
Converts a lineweight in millimeters to the whole number the file stores.
Math.round(w × 100) for w ≥ 0; negative codes kept
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Spline: fit points or control points
Decides whether a spline's fit points are written with it, by checking that they still give its control points.
every |recomputed − stored| ≤ 1e-7 × max(1, max(|x| + |y|))
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Multi-line text anchor and oblique angle
Moves baseline-anchored text to a top anchor one text height up, and writes the oblique angle as a format code.
anchor = (x, y) + R(rot) × (0, h); code = \Q followed by degrees to 6 decimals
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Hatch boundary rings
Writes a hatch's rings as closed polylines, or a 3 or 4 cornered solid fill as a SOLID.
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Hatch pattern lines for the file
The pattern's line families in drawing units: angle in radians, base point and offset in world axes.
k = scale ÷ (1 metric, 25.4 otherwise); base = R(turn) × (x, y) × k + origin; offset = (dx cos a − dy sin a, dx sin a + dy cos a)
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Dimension points and measurement
The defining points, text point and measurement written for a dimension.
measurement = dimMeasure; linear: defPoint = end of the dimension line on the second extension line; radial: near = c + r × (cos a, sin a), far = c − r × (cos a, sin a)
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Viewport view height
The model height a sheet viewport shows, and its view center.
view height = h ÷ s (s taken as 1 when not above 0)
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Sheet paper size and limits
The paper size in millimeters, the sheet's limits and the sheet viewport's center.
paper mm = w × 25.4 (inch sheets) or w; limits = (x₀, y₀) to (x₀ + w, y₀ + h); center = (x₀ + w ÷ 2, y₀ + h ÷ 2)
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Drawing extents
The smallest and largest x and y of everything in model space, written to the file's header.
min and max over the bounds of every object
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Closing point of a ring
Drops a ring's last point when it repeats the first.
|first − last| < 1e-12
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Construction line direction
The unit direction written for an infinite line or ray.
direction = (dx, dy) ÷ √(dx² + dy²)
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
User coordinate system axes
The origin and the x and y axis vectors of a user coordinate system.
x axis = (cos θ, sin θ); y axis = (−sin θ, cos θ)
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Linetype pattern length
The total length of one repeat of a linetype's dashes and gaps.
length = Σ |elementᵢ|
DWG save: objects to the file's model dwg-save.js64-bit- CadCraft
-
Transparency to the file's word
Converts a transparency percentage to the opacity byte the file stores.
alpha = Math.round(255 × (1 − clamp(tr, 0, 90) ÷ 100)); word = 0x02000000 + alpha
Properties in DWG and DXF: transparency, lineweights, dimension variables dwg-props.js64-bit- CadCraft
-
Opacity byte to transparency
Converts the file's opacity byte back to a transparency percentage.
p = Math.round((1 − alpha ÷ 255) × 100); p ≤ 0 → none; capped at 90
Properties in DWG and DXF: transparency, lineweights, dimension variables dwg-props.js64-bit- CadCraft
-
Transparency from a file value
Reads a transparency word or record: by block, by layer or an opacity byte.
Properties in DWG and DXF: transparency, lineweights, dimension variables dwg-props.js64-bit- CadCraft
-
Dimension lineweight to hundredths
Converts a dimension line or extension line weight in millimeters to the file's whole number.
Math.round(v × 100) for v ≥ 0; −1, −2, −3 kept as codes
Properties in DWG and DXF: transparency, lineweights, dimension variables dwg-props.js64-bit- CadCraft
-
Style value to a dimension variable
Converts one dimension style setting to the value its variable holds in the file.
real: the number (0 when not finite); int: Math.round; bool: 1 or 0; lineweight: lw100; separator: 44 or 46
Properties in DWG and DXF: transparency, lineweights, dimension variables dwg-props.js64-bit- CadCraft
-
Dimension variable to a style value
Converts one variable read from a file to the dimension style setting.
real: parseFloat; int: Math.round(parseFloat); lineweight: x ÷ 100 for 0 ≤ x ≤ 211
Properties in DWG and DXF: transparency, lineweights, dimension variables dwg-props.js64-bit- CadCraft
-
Tolerance mode and text gap
Works out the tolerance mode (symmetric, deviation, limits, basic) and the text gap from the file's variables.
symmetric when |tp − tm| < 1e-12; gap < 0 → basic and gap = −gap
Properties in DWG and DXF: transparency, lineweights, dimension variables dwg-props.js64-bit- CadCraft
-
Dimension style as file variables
Every variable of a dimension style, by name, for a DIMSTYLE record.
basic tolerance: DIMGAP = −|gap|
Properties in DWG and DXF: transparency, lineweights, dimension variables dwg-props.js64-bit- CadCraft
-
Hatch pattern origin as text
Writes a hatch's pattern origin into the file as two numbers in a text field.
text = CCHORG: followed by x, a comma and y
Properties in DWG and DXF: transparency, lineweights, dimension variables dwg-props.js64-bit- CadCraft
-
A number from a group value
Reads one real number from the file's text, or a default when the group is absent.
value = parseFloat(text)
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Arc angles
An arc's center, radius and start and end angles.
a = (degrees × π ÷ 180) mod 2π
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Hatch boundary to polygon rings
Turns a hatch's boundary paths (polylines with bulges, lines and arcs) into rings of points.
arc edge: steps = max(4, ⌈32 × (a₁ − a₀) ÷ 2π⌉); p = c + r × (cos a, sin a)
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Bulge arc to points
The points along a bulged segment of a hatch boundary polyline.
θ = 4 × atan(b); r = |c ÷ (2 × sin(θ ÷ 2))|; center = midpoint + normal × r × cos(θ ÷ 2); steps = max(2, ⌈16 × |θ| ÷ π⌉)
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Hatch pattern scale, angle and lines
A pattern hatch's scale, angle and its own pattern lines.
pattern angle = (degrees × π ÷ 180) mod 2π; dx = o_x cos a + o_y sin a; dy = −o_x sin a + o_y cos a, a = line angle × π ÷ 180
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Block array positions
The insertion point of each copy of a block placed as a rows-by-columns array.
p = T(insert) × R(rot) × (c × column spacing, r × row spacing)
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Dimension defining points
The points a dimension measures from, by dimension type.
linear: p₁ = 13, p₂ = 14, line point = 10, angle = group 50 × π ÷ 180; diameter center = (point 15 + point 10) ÷ 2; four-point angular: vertex from the two lines
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Can the dimension be measured
Checks that a dimension's points are finite and far enough apart to measure.
|a − b| > 1e-12
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Viewport scale, center and twist
A sheet viewport's scale, the model point at its center and its view twist.
s = viewport height ÷ view height; twist = degrees × π ÷ 180 (or radians from R12 data)
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Layer lineweight
A layer's lineweight in millimeters.
mm = n ÷ 100 for 0 ≤ n ≤ 211; otherwise default
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Object lineweight and linetype scale
An object's own lineweight in millimeters and its linetype scale.
lw = n ÷ 100; linetype scale kept when |s − 1| > 1e-12
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Sheet size from the plot settings
A sheet's size in its own unit when the layout gives no limits, from the paper size in millimeters.
size = paper mm ÷ 25.4 (inch sheets) or ÷ 1; width and height swapped when the plot rotation code is odd
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Dimension style numbers
Brings a dimension style's scale, unit format and decimal places into range.
scale ≤ 0 → 1; dec, adec, tad, zin → max(0, round(value)); dec ≤ 8
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Construction line direction
The unit direction of an infinite line or ray.
direction = (dx, dy) ÷ √(dx² + dy²)
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
Extra sheet read back from a block
Rebuilds a sheet and its viewports from the block an R12 file keeps them in.
viewport center = ((x_min + x_max) ÷ 2, (y_min + y_max) ÷ 2); w = x_max − x_min; h = y_max − y_min
DXF reading: objects from the file's text dxf.js64-bit- CadCraft
-
A group value by its code
Turns one group's text into a real number, a whole number, a true or false, or text.
codes 10–59, 110–149, 210–239, 460–469, 1010–1059: parseFloat; 60–99, 160–179, 270–289, 370–389, 400–409, 420–429, 440–459, 1060–1071: parseInt
DXF reading into the shared drawing model dxf-model.js64-bit- CadCraft
- BimCraft
- TakeoffCraft
- CivilCraft
-
Arc angles
An arc's start and end angles in radians.
angle = degrees × (π ÷ 180)
DXF reading into the shared drawing model dxf-model.js64-bit- CadCraft
- BimCraft
- TakeoffCraft
- CivilCraft
-
Multi-line text direction
The direction vector of multi-line text, from the file's vector or from its rotation angle.
x axis = group 11 when present; otherwise (cos(a), sin(a)), a = degrees × (π ÷ 180)
DXF reading into the shared drawing model dxf-model.js64-bit- CadCraft
- BimCraft
- TakeoffCraft
- CivilCraft
-
Hatch arc and ellipse edges
The center, radius or axes, and start and end angles of the curved edges of a hatch boundary.
angle = degrees × (π ÷ 180); missing end angle = 360 degrees
DXF reading into the shared drawing model dxf-model.js64-bit- CadCraft
- BimCraft
- TakeoffCraft
- CivilCraft
-
Number text (R12)
The text every real number is written as in an R12 file.
|n| < 1e-12 → 0.0; otherwise n rounded to 15 significant digits
DXF writing: numbers as text dxf.js64-bit- CadCraft
-
Point (R12)
Writes a 2D point as three groups.
x → f(x); y → f(y); z → 0.0
DXF writing: numbers as text dxf.js64-bit- CadCraft
-
Arc (R12)
An arc's center, radius and its angles in degrees.
degrees = (a mod 2π) × 180 ÷ π
DXF writing: numbers as text dxf.js64-bit- CadCraft
-
Dimension (R12)
The defining points, text point and angles written for a dimension.
linear: point 10 = end of the dimension line on the second extension line; radial: near = c + r × (cos a, sin a), far = c − r × (cos a, sin a); angles in degrees
DXF writing: numbers as text dxf.js64-bit- CadCraft
-
Viewport view (R12)
A sheet viewport's twist, view height and view center.
view height = h ÷ s
DXF writing: numbers as text dxf.js64-bit- CadCraft
-
Ellipses and splines as polylines (R12)
Writes an ellipse or a spline as a polyline along the curve, because R12 has neither object.
DXF writing: numbers as text dxf.js64-bit- CadCraft
-
Hatches as solids or outlines (R12)
Writes a filled triangle or quadrilateral as a SOLID and any other hatch as closed polylines of its rings.
DXF writing: numbers as text dxf.js64-bit- CadCraft
-
Text (R12)
A text's position, height, rotation, width factor and oblique angle.
rotation° = rot × 180 ÷ π; oblique° = obl × 180 ÷ π
DXF writing: numbers as text dxf.js64-bit- CadCraft
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.