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
-
A routine's number as command input
Turns a number a routine gives to a command into the text the command reads.
text = String(+v.toPrecision(15))
Drawing values handed to and from LISP routines lisp/host-cad.js64-bit- CadCraft
-
Answers to a command's prompts
Hands a routine's string, number, point or object to the command that is waiting for input.
point: UCS to world, then given as a click; number: as 15-digit text
Drawing values handed to and from LISP routines lisp/host-cad.js64-bit- CadCraft
-
Block-to-world matrix of a nested pick
The transform from a block's own coordinates to the drawing for an object picked inside nested block references.
M = M · [rotation × scale, insertion − base]; pick in block = M⁻¹ · pick
Drawing values handed to and from LISP routines lisp/host-cad.js64-bit- CadCraft
-
TRANS: between coordinate systems
Converts a point or a direction between the world, the user coordinate system and the display.
display: turn by the view's twist; UCS: by the active coordinate system (ucs.js)
Drawing values handed to and from LISP routines lisp/host-cad.js64-bit- CadCraft
-
Current lineweight as a system variable
The current lineweight in hundredths of a millimeter.
CELWEIGHT = round(lineweight × 100)
Drawing values handed to and from LISP routines lisp/host-cad.js64-bit- CadCraft
-
Drawing extents as system variables
EXTMIN and EXTMAX: the box around every object.
min and max of every object's bounds
Drawing values handed to and from LISP routines lisp/host-cad.js64-bit- CadCraft
-
Date as a Julian day number
The DATE system variable.
Julian date = milliseconds since 1970 ÷ 86 400 000 + 2 440 587.5
Drawing values handed to and from LISP routines lisp/host-cad.js64-bit- CadCraft
-
Position of a block attribute
The world position of an attribute of a block reference, as entget reports it.
p = insertion + R(rot) · ((d − base) × scale)
Drawing values handed to and from LISP routines lisp/host-cad.js64-bit- CadCraft
-
Angles brought into 0 to 2π
Normalizes an arc's, text's or block reference's angle for a data list, and when a routine writes one back.
a′ = ((a mod 2π) + 2π) mod 2π
Drawing values handed to and from LISP routines lisp/dxflist.js64-bit- CadCraft
-
Lineweight in a data list
An object's lineweight as group 370, in hundredths of a millimeter.
370 = round(lw × 100)
Drawing values handed to and from LISP routines lisp/dxflist.js64-bit- CadCraft
-
Lineweight from a data list
Sets an object's lineweight in millimeters from group 370.
lw = value ÷ 100
Drawing values handed to and from LISP routines lisp/dxflist.js64-bit- CadCraft
-
Arc from a data list
Makes or changes an arc from its center, radius and two angles.
center, radius as given; angles into 0 to 2π
Drawing values handed to and from LISP routines lisp/dxflist.js64-bit- CadCraft
-
Viewport scale from a data list
Sets a layout viewport's scale from the view height a routine gives.
scale = paper height ÷ view height
Drawing values handed to and from LISP routines lisp/dxflist.js64-bit- CadCraft
-
Linetype pattern length
The total length of a linetype's dashes and gaps in its table record.
length = Σ |xᵢ|
Drawing values handed to and from LISP routines lisp/dxflist.js64-bit- CadCraft
-
Length and angle of a line
The Length, Angle and Delta properties of a line.
length = √(Δx² + Δy²); angle = atan2(Δy, Δx) into 0 to 2π
Drawing values handed to and from LISP routines lisp/vla-host.js64-bit- CadCraft
-
Circle and arc properties
Diameter, area and circumference of a circle; total angle, arc length and end points of an arc.
area = π r²; circumference = 2π r; sweep = ((a₁ − a₀) mod 2π + 2π) mod 2π; arc length = r × sweep; end = c + r (cos a, sin a)
Drawing values handed to and from LISP routines lisp/vla-host.js64-bit- CadCraft
-
Ellipse radii
The major and minor radius of an ellipse.
major = √(m_x² + m_y²); minor = major × ratio
Drawing values handed to and from LISP routines lisp/vla-host.js64-bit- CadCraft
-
Lineweight property set by a routine
Sets an object's lineweight in millimeters from a value in hundredths of a millimeter.
lw = value ÷ 100
Drawing values handed to and from LISP routines lisp/vla-host.js64-bit- CadCraft
-
Plane of a face
The plane a face lies in, as a unit normal and a distance from the origin.
n = Newell normal of the outer loop; d = n · p₀
Face planes, areas, triangles and solid volume m3d/model.js64-bit- CadCraft
- ModelCraft
-
Area of a face
The area of a face, holes taken out.
area = |Σ (pᵢ × pᵢ₊₁)| ÷ 2 for the outer loop, minus the same for each hole
Face planes, areas, triangles and solid volume m3d/model.js64-bit- CadCraft
- ModelCraft
-
Triangles of a face
The triangles a face is cut into for volume, export and ray tests.
Face planes, areas, triangles and solid volume m3d/model.js64-bit- CadCraft
- ModelCraft
-
Surface area and volume of a shape
Whether a group or component is closed, its total face area and, when closed, its volume.
V = Σ a · (b × c) ÷ 6 over all triangles; A = Σ face areas
Face planes, areas, triangles and solid volume m3d/model.js64-bit- CadCraft
- ModelCraft
-
Vertex at a point
The vertex a drawn point becomes: an existing one, or a new one that splits the edge it lands on.
s = (p − A) · u ÷ (u · u); on the edge when 0 < s < 1 and |A + s·u − p| ≤ EPS
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Stops along a new edge
Where a new edge is cut by the vertices and edges it meets.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Crossing of two edges
The point where two edges cross inside both of them.
n = u × w; s = ((C − A) × w) · n ÷ (n · n); t = ((C − A) × u) · n ÷ (n · n)
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Planes a new edge may close a face on
The planes tried when a new edge might complete a face.
n = u × (C − A), kept when |n| > 1e-9 × |u| × |C − A|
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Faces of a plane from its edges
Which closed loops of edges on a plane are faces, which are holes, and which side each face shows.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Loops of the planar edge graph
The closed loops formed by the edges on a plane, and the signed area of each.
edges round a vertex sorted by atan2(Δy, Δx); area = ½ Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Point inside a loop
Whether a 2D point is inside a loop, used to match holes and old faces.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Test point inside a region
A point well inside a region, used to ask which old faces cover it.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Welding coincident vertices
Merges vertices at the same place and removes edges and loops that collapse.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Removing a vertex on a straight run
Joins two edges that continue each other in a straight line into one.
merged when u₁ · u₂ ≤ −1 + 1e-9
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Merging coplanar faces
Removes an edge between two faces that lie in one plane and face the same way.
n₁ · n₂ ≥ 1 − 1e-9 and |d₁ − d₂| ≤ EPS
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Push or pull a face
Moves a face along its normal by a typed or dragged distance, or extrudes it into side faces.
p′ = p + n × distance
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Depth to the face behind
How far a face can be pushed in before it meets the first face behind it.
smallest ray parameter t > EPS along −n
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Moving vertices by a matrix
The new place of each selected vertex under a move, rotate, scale or flip.
p′ = M · p
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Is a face still flat
Whether every corner of a face lies in the face's plane after an edit.
|n · p − d| ≤ 10 × EPS for every corner
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Stretch to a new size
Moves every vertex beyond a cut plane by a distance, as used by typed dimensions and sizes.
p′ = p + d × δ for every vertex with p · d ≥ cut − 10 × EPS
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Profile ring at a path corner
Where each corner of a swept profile lands on the next miter plane of the path.
q′ = q + d × (n · (o − q)) ÷ (n · d)
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Where a line crosses a face
The stretches of a line that lie inside a face, holes left out.
c = P + (Q − P) × s_P ÷ (s_P − s_Q); t = (c − x₀) · u
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Line where two faces cross
The line shared by the planes of two faces, clipped to both.
dir = n_a × n_b; x₀ = ((n_b·d_a − n_a·d_b) × dir) ÷ |dir|²
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Mirror matrix
The matrix that flips geometry through a plane.
M = T(c) · (I − 2·n·nᵀ) · T(−c)
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Corners of a circle or polygon
The corner points of a circle or regular polygon with a given number of sides.
pᵢ = c + u·r·cos aᵢ + v·r·sin aᵢ, aᵢ = (i ÷ sides) × 2π
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Corners of an arc
The corner points of an arc from its center, radius, sweep and segment count.
pᵢ = c + u·r·cos aᵢ + v·r·sin aᵢ, aᵢ = sweep × i ÷ segs
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
What a curve is
The length, radius, center, normal and sweep reported for an arc, circle, polygon or smooth curve.
length = Σ |segment|; center = circle through three corners; sweep = |Σ atan2((u₁ × u₂) · n, u₁ · u₂)|
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Give a curve a new radius
Moves the corners of an arc, circle or polygon to a typed radius about its center.
p′ = c + (p − c) × r ÷ r_old
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Equal division points
Where the parts of an edge or curve divided into n equal parts meet.
straight edge: a + (b − a) × (i + 1) ÷ n; arc: new corners at equal angles; other curve: equal lengths along its segments
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Dividing an edge or curve
Adds the corners that divide an edge or curve into n equal parts.
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Points of a smooth curve
The points of the smooth curve drawn through clicked points.
centripetal Catmull–Rom: knot step = √|pᵢ₊₁ − pᵢ|, evaluated at k ÷ segs of each span
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Offset of a 2D outline
The corners of an outline moved sideways by a distance.
each segment line moved d along its left unit normal; corner = intersection of neighboring lines
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
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.