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

  • Do two outline segments cross

    The test that refuses an offset whose loops cross themselves or each other.

    Arcs, circles, smooth curves, divide and offset m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Offset of a face's loops

    The offset outline of a face, back in 3D.

    p = u·x + v·y + n·h, h = p₀ · n

    Arcs, circles, smooth curves, divide and offset m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Offset of a chain of edges

    The offset of a connected run of edges lying in one plane.

    Arcs, circles, smooth curves, divide and offset 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
  • Resize between two ends

    Moves one or both ends so the distance between them is the typed length.

    δ = L − |p_b − p_a|, applied along the unit direction from a to b

    Dimensions and typed sizes in 3D m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Moving the end of a dimension

    Carries the move into the group that holds the moving end and stretches or moves the geometry there.

    d_local = M⁻¹ · d (direction); s = |d_local|; local move = δ × s

    Dimensions and typed sizes in 3D m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Typing a new length for an edge

    Sets an edge to a typed length by moving one of its ends.

    Dimensions and typed sizes in 3D m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Typing a new size for a group

    Sets a group's or component's size along one of its own axes.

    δ = size − (max − min) on that axis

    Dimensions and typed sizes in 3D m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Bounding box

    The smallest axis-aligned box round a group and everything placed in it.

    min and max of M · p over every vertex

    Dimensions and typed sizes in 3D m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Length of a linear dimension

    The length a dimension between two points shows, and where its line is drawn.

    L = |p_b − p_a|

    Dimensions and typed sizes in 3D m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Value of a radius or diameter dimension

    The radius or diameter a dimension on an arc or circle shows.

    L = r, or 2 × r for a diameter

    Dimensions and typed sizes in 3D m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Value of an angle dimension

    The angle a dimension at a corner shows.

    θ = atan2(v · (n × u), v · u); the dimension shows θ or π − θ

    Dimensions and typed sizes in 3D m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Angle label

    The text of an angle dimension, in degrees.

    degrees = round(θ × 180 ÷ π × 10) ÷ 10

    Dimensions and typed sizes in 3D m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • World matrix of a nested placement

    The matrix that takes a group's own coordinates to the model's, through every group it sits in.

    M_world = M₁ · M₂ · … · Mₖ

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Editing context of an open group

    The world matrix of the group being edited and its inverse, used to take picked points into the group.

    M = M₁ · … · Mₖ; M⁻¹ by cofactors

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Making a group

    Moves the selected geometry into a new group whose origin is the lowest corner of its box.

    p_group = p − origin; placement = translation(origin)

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Exploding a group

    Puts a group's geometry back into its parent at the group's place.

    p_parent = M · p

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Flattening a group into a mesh

    Gathers a group and everything placed in it into one set of points before it becomes a mesh.

    key = round(x × 1e8), round(y × 1e8), round(z × 1e8)

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Numbers written to the model file

    The vertices, placement matrices and curve points as they go into the file.

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Vertices read from a file

    The check each vertex passes when a file is opened.

    finite and |x| < 1e7

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Level elevations

    The list of named levels and their heights.

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Light values as stored

    The brightness, cone angle, size and position kept for a lamp used in rendered pictures.

    lumens = round(clamp(x, 1, 200000)); angle = round(clamp(x, 5, 170)); size clamped to 0.02…20 m

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Drawing axes

    The frame set when the drawing axes are placed by three picks.

    X = x ÷ |x|; Y = (y − X (y · X)) normalized; Z = X × Y

    Groups, placements and the model file m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Faces from imported polygons

    Builds faces from the polygons of an imported file, sharing vertices between them.

    key = round(x × 1e5), round(y × 1e5), round(z × 1e5)

    Welding of imported geometry m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Edges from imported segments

    Builds plain edges from the line segments of an imported drawing.

    key = round(x × 1e5), round(y × 1e5), round(z × 1e5)

    Welding of imported geometry m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Smooth shading normals

    The normal at each corner of faces joined by soft edges.

    n = normalize(Σ n_f × area_f) over the joined faces that meet at the corner

    Smooth shading and texture placement m3d/model.js
    • CadCraft
    • ModelCraft
    32-bit, display only
  • Fitting a texture to a face

    The map from a point on a face to its place on an imported image.

    u = U · p + u₀, v = V · p + v₀, with U · n = 0 and V · n = 0

    Smooth shading and texture placement m3d/model.js
    • CadCraft
    • ModelCraft
    32-bit, display only
  • Texture coefficients as stored

    The eight numbers of a texture's placement as they are kept in the face's paint.

    text = x rounded to 7 significant digits

    Smooth shading and texture placement m3d/model.js
    • CadCraft
    • ModelCraft
    32-bit, display only
  • Ray and triangle

    Where the cursor's ray meets one triangle of a face.

    det = e₁ · (d × e₂); u, v barycentric; t = e₂ · (s × e₁) ÷ det

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Point on the face under the cursor

    The nearest face the cursor's ray meets and the 3D point on it.

    o_L = M⁻¹ · o; d_L = M⁻¹ · d; p = o + d × t

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • World plane of a placed face

    The triangles, normal and plane of a face in model coordinates, used to draw on that face.

    n = normalize(M · n_local); d = n · (M · P)

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Center of a face

    The center point offered as a snap on the face under the cursor.

    c = Σ (a + b + d) × w ÷ 3 ÷ Σ w, w = |(b − a) × (d − a)|

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Is a point on a face

    Whether a snapped point lies on the face under the cursor, so a shape started there takes the face's plane.

    |n · p − d| ≤ tol and distance to a triangle ≤ tol, tol = 1e-6 × max(1, |x|, |y|, |z|)

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Distance from a point to a triangle

    The distance used to decide whether a point is inside a face's outline or on it.

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Midpoint of an edge

    The middle of an edge, offered as a snap point.

    m = (a + b) × 0.5

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Point on an edge

    The point of an edge nearest the cursor, offered when no end or midpoint is in reach.

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Point along an axis from the start point

    The point on a red, green or blue line (or one parallel or square to an edge) through the start point.

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Where an axis line meets an edge

    The point where the line from the start point along an axis meets the edge or guide under the cursor.

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Point on a locked direction

    The point kept on a line when a direction is locked with Shift or an arrow key.

    p = from + d × ((q − from) · d) ÷ (d · d)

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Distance along a line under the cursor

    The point on a line nearest the cursor and how far along it lies, used by push/pull and moves along an axis.

    Snap points picked in the 3D view m3d/infer.js
    • CadCraft
    • ModelCraft
    64-bit
  • Newell normal of a mesh face

    The normal of a face with any number of corners; its length is twice the face's area.

    N = Σ ((y_a − y_b)(z_a + z_b), (z_a − z_b)(x_a + x_b), (x_a − x_b)(y_a + y_b))

    Polygon mesh: normals, areas, triangles and volume m3d/mesh.js
    • CadCraft
    • ModelCraft
    64-bit
  • Unit normal of a mesh face

    The direction a mesh face points.

    n = N ÷ |N|

    Polygon mesh: normals, areas, triangles and volume m3d/mesh.js
    • CadCraft
    • ModelCraft
    64-bit
  • Area of a mesh face

    The area of one mesh face.

    area = |N| ÷ 2

    Polygon mesh: normals, areas, triangles and volume m3d/mesh.js
    • CadCraft
    • ModelCraft
    64-bit
  • Center of a mesh face

    The point used as a face's middle.

    c = Σ pᵢ ÷ n

    Polygon mesh: normals, areas, triangles and volume m3d/mesh.js
    • CadCraft
    • ModelCraft
    64-bit
  • Is a mesh face flat

    Whether every corner of a face lies in one plane, which decides if it stays one face or becomes triangles.

    |(p − c) · n| ≤ tol, tol = 1e-6 m by default

    Polygon mesh: normals, areas, triangles and volume m3d/mesh.js
    • CadCraft
    • ModelCraft
    64-bit
  • Triangles of a mesh

    The triangles every face is cut into for area, volume, ray tests and drawing.

    Polygon mesh: normals, areas, triangles and volume m3d/mesh.js
    • CadCraft
    • ModelCraft
    64-bit
  • Area and volume of a mesh

    The surface area of a mesh and, when it is closed, the volume it encloses.

    A = Σ |u × v| ÷ 2; V = Σ a · (b × c) ÷ 6

    Polygon mesh: normals, areas, triangles and volume m3d/mesh.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.