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

  • CVUNIT: convert between units

    Converts a number or a list of numbers from one unit to another of the same kind.

    result = v × from ÷ to

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • POLAR, DISTANCE and ANGLE

    A point at an angle and distance from another, the distance between two points, and the angle of the line between them.

    q = p + d (cos a, sin a); dist = √(Δx² + Δy² + Δz²); angle = atan2(Δy, Δx) into 0 to 2π

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • INTERS: where two lines meet

    The intersection of two lines or segments given by their end points.

    den = Δ₁ × Δ₂; u = ((p₃ − p₁) × Δ₂) ÷ den; q = p₁ + u Δ₁

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • ATOI and ATOF: text to a number

    Reads the leading whole number or real number of a text.

    parseInt or parseFloat of the leading number

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • 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.js
    • CadCraft
    • ModelCraft
    64-bit
  • Vertex a dimension end attaches to

    Finds the vertex at a picked point so the dimension follows the geometry.

    |M · q − p| ≤ 100 × EPS

    Dimensions and typed sizes in 3D m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Where a dimension end is now

    The current world position of a dimension's end.

    p = M · q

    Dimensions and typed sizes in 3D m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Radius and center of a dimensioned curve

    The world center, radius and normal a radius or diameter dimension reads.

    C = M · c; r = |C − M · p₀|

    Dimensions and typed sizes in 3D m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Typing a new value into a dimension

    Resizes the model so a dimension shows the typed length, radius or diameter.

    radius: r_local′ = r_local × want ÷ r_world; length: see resize between two ends

    Dimensions and typed sizes in 3D m3d/model.js
    • CadCraft
    • ModelCraft
    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.