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

  • Scale matrix about a fixed point

    The 4 × 4 matrix that scales a body about the center, minimum corner, base center or origin of its box.

    a = (min + max) ÷ 2 (center); translation = a × (1 − f)

    Scale feature for printing print-features.js
    • PartCraft
    64-bit
  • Scaled triangles

    Applies the scale to every corner of a body's triangles, with the box found from the triangles themselves.

    x′ = f_x·x + t_x; y′ = f_y·y + t_y; z′ = f_z·z + t_z

    Scale feature for printing print-features.js
    • PartCraft
    64-bit
  • Rotation about an axis

    Turns a vector about a unit axis by an angle; used for a plane at an angle to another.

    v′ = v·cos a + (u × v)·sin a + u·(u · v)·(1 − cos a)

    Reference planes, axes and points refgeom.js
    • PartCraft
    64-bit
  • Point where three planes meet

    The single point that lies on three planes.

    solve [nₐ; n_b; n_c] · p = (nₐ·oₐ, n_b·o_b, n_c·o_c)

    Reference planes, axes and points refgeom.js
    • PartCraft
    64-bit
  • Axis where two planes meet

    The line of intersection of two planes: its direction and a point on it.

    d = nₐ × n_b; solve nₐ·x = cₐ, n_b·x = c_b, d·x = d·(oₐ + o_b) ÷ 2

    Reference planes, axes and points refgeom.js
    • PartCraft
    64-bit
  • Offset plane and plane at an angle

    A plane parallel to another at a distance, and a plane turned about an axis by an angle in degrees.

    o′ = o + n·d; n′ = rotate(n ⊥ axis, axis, angle × π ÷ 180)

    Reference planes, axes and points refgeom.js
    • PartCraft
    64-bit
  • Plane through three points

    The plane through three points, with its center at their mean.

    n = (b − a) × (c − a); center = (a + b + c) ÷ 3

    Reference planes, axes and points refgeom.js
    • PartCraft
    64-bit
  • Mid plane between two planes

    The plane half way between two planes, or the one that bisects them when they are not parallel.

    n = (nₐ − n_b) ÷ |nₐ − n_b|; c = (oₐ·nₐ − o_b·n_b) ÷ |nₐ − n_b|; parallel and same facing: o = oₐ + n·((o_b − oₐ)·n) ÷ 2

    Reference planes, axes and points refgeom.js
    • PartCraft
    64-bit
  • Plane tangent to a cylinder

    The plane that touches a cylindrical face on the side of a chosen point.

    radial = w − d·(w · d); n = radial ÷ |radial|; o = foot on the axis + n·r

    Reference planes, axes and points refgeom.js
    • PartCraft
    64-bit
  • Plane through a line and a point

    The plane that contains a straight edge or axis and one more point.

    n = d × (p − o)

    Reference planes, axes and points refgeom.js
    • PartCraft
    64-bit
  • Where a line meets a plane or a cylinder

    The point where a straight edge or axis crosses a plane, a flat face or a cylindrical face.

    plane: t = ((o_s − o) · n) ÷ (d · n); cylinder: A·t² + B·t + C = 0, t = (−B ± √(B² − 4AC)) ÷ 2A

    Reference planes, axes and points refgeom.js
    • PartCraft
    64-bit
  • Slider range of the section

    The lowest and highest value of n·p over the model's box, the two ends of the section slider.

    lo, hi = min, max of n · p over the 8 box corners

    Section view plane section.js
    • PartCraft
    32-bit, display only
  • Section through a picked face

    The cutting plane through a flat face, placed by the instance matrix of an assembly.

    n = unit(M · n_face); c = n · (M · o_face)

    Section view plane section.js
    • PartCraft
    32-bit, display only
  • Bend allowance

    The length of the neutral layer through a bend, which the flat pattern gives to that bend.

    BA = θ × (r + k × t)

    Sheet metal bends and flat pattern sheetmetal.js
    • PartCraft
    64-bit
  • Chain of profile lines

    Orders the lines of an open profile end to end, or reports that they are not one chain.

    two ends are the same point when their distance ≤ 1e-6 × max(1, largest coordinate size)

    Sheet metal bends and flat pattern sheetmetal.js
    • PartCraft
    64-bit
  • Bend angle, center and tangent length

    For every corner of the profile: the signed bend angle, the radius on the path side and the offset side, the distance the bend takes from each leg, and the bend's center.

    θ = atan2(u × w, u · w); d = r_path × tan(|θ| ÷ 2); c = P + left(u) × sign(θ) × r_path − u × d

    Sheet metal bends and flat pattern sheetmetal.js
    • PartCraft
    64-bit
  • Arc of a bend in the profile

    The arc of a bend between its two tangent points, with its middle point and 17 points along it.

    sweep = a₁ − a₀ brought to (0, 2π] or [−2π, 0); point = c + r × (cos t, sin t)

    Sheet metal bends and flat pattern sheetmetal.js
    • PartCraft
    64-bit
  • Straight runs between bends

    The flat length of each leg: its drawn length less what the bends at its ends take.

    straightⱼ = |Pⱼ₊₁ − Pⱼ| − dⱼ − dⱼ₊₁

    Sheet metal bends and flat pattern sheetmetal.js
    • PartCraft
    64-bit
  • Developed length and bend lines

    The total flat length of a bent profile and where each bend line lies on the flat.

    length = Σ straights + Σ BA; bend line at x + BA ÷ 2; angle° = θ × 180 ÷ π

    Sheet metal bends and flat pattern sheetmetal.js
    • PartCraft
    64-bit
  • Joining straight segments

    Joins two straight segments of the flat outline that continue each other through a point no third segment touches.

    collinear when |d₁ × d₂| ≤ 1e-9 × |d₁| × |d₂| and d₁ · d₂ > 0

    Sheet metal bends and flat pattern sheet-flat.js
    • PartCraft
    64-bit
  • Points along an arc for the extent

    Sampled points on an arc or circle of the flat, used to find its box.

    point = c + r × (cos a, sin a), a = (a₀ + sweep × k ÷ n) × π ÷ 180

    Sheet metal bends and flat pattern sheet-flat.js
    • PartCraft
    64-bit
  • Flat of a bent base

    The developed rectangle of an open bent profile: flat length by depth, with its bend lines and area.

    box = L × D; area = L × D

    Sheet metal bends and flat pattern sheet-flat.js
    • PartCraft
    64-bit
  • Faces that lie on the plate's plane

    Decides which flat faces of the body belong to the plate, by distance from the sketch plane and by direction.

    size = max(1, largest distance of a face centroid from the origin); tol = 1e-6 × size; on the plane when |n · (c − o)| ≤ tol and | |n_face · n| − 1 | ≤ 1e-9

    Sheet metal bends and flat pattern sheet-flat.js
    • PartCraft
    64-bit
  • Unfolding a flange

    Turns a flange's leg back into the plate's plane and adds the bend strip between the plate and the leg.

    leg: rotate by −θ about the bend axis through C, then move by BA along u; strip: S₀, S₀ + e·run, + u·BA; bend line at S₀ + u × BA ÷ 2

    Sheet metal bends and flat pattern sheet-flat.js
    • PartCraft
    64-bit
  • Outline edges as lines, arcs and circles

    Reads each edge of the fused flat as a 2-D line, arc, circle or sampled curve in the sketch plane.

    2-D point = ((p − o) · x, (p − o) · y); arc angles = atan2(Δy, Δx) × 180 ÷ π, brought to [0, 360)

    Sheet metal bends and flat pattern sheet-flat.js
    • PartCraft
    64-bit
  • Box and area of the flat pattern

    The overall size of the flat pattern and its area.

    box = min and max over line ends, sampled curve points and 65 points per arc; area = surface area of the fused flat

    Sheet metal bends and flat pattern sheet-flat.js
    • PartCraft
    64-bit
  • Automatic element size

    A tidy element size that gives about the target number of elements for a solid of a given volume.

    raw = ∛(volume ÷ target); size = next step ≥ raw among 1, 1.25, 1.5, 2, 2.5, 3, 4, 5, 6, 8 × 10ⁿ

    Study set-up: element size and the mesh handed to the solver sim.js
    • PartCraft
    64-bit
  • Estimated element count

    The element size a study will use and the number of elements that size is expected to give.

    estimate = round(volume ÷ h³) (× 12 for tetrahedra)

    Study set-up: element size and the mesh handed to the solver sim.js
    • PartCraft
    64-bit
  • Mesh copy for the solver

    Copies the body's triangle mesh for the worker that meshes and solves the study.

    Study set-up: element size and the mesh handed to the solver sim.js
    • PartCraft
    32-bit in part
  • Design box and size of a generative study

    The design space of a generative study (the body's box grown by a margin), its volume, element size and estimated element count.

    box = bbox ± margin; volume = Δx × Δy × Δz (box) or the body's volume; estimate = round(volume ÷ h³)

    Study set-up: element size and the mesh handed to the solver sim.js
    • PartCraft
    64-bit
  • Point on a curve at a parameter

    The point of a line, circle, arc or spline at a given parameter.

    line: a + (b − a)·t; circle: c + r·(cos t, sin t); arc: c + r·(cos(a₀ + t), sin(a₀ + t))

    Sketch intersections of lines, arcs and circles sketch-intersect.js
    • PartCraft
    64-bit
  • Parameter of the nearest point

    The parameter on a curve of the point nearest a given point.

    line: t = ((p − a) · d) ÷ (d · d); circle and arc: angle = atan2(p_y − c_y, p_x − c_x)

    Sketch intersections of lines, arcs and circles sketch-intersect.js
    • PartCraft
    64-bit
  • Line and line

    The parameters at which two lines cross.

    den = d₁ × d₂; tₐ = (w × d₂) ÷ den; t_b = (w × d₁) ÷ den, w = B.a − A.a

    Sketch intersections of lines, arcs and circles sketch-intersect.js
    • PartCraft
    64-bit
  • Line and circle

    The parameters along a line at which it crosses a circle.

    A·t² + B·t + C = 0; q = −½·(B + sign(B)·√(B² − 4AC)); t₁ = q ÷ A, t₂ = C ÷ q

    Sketch intersections of lines, arcs and circles sketch-intersect.js
    • PartCraft
    64-bit
  • Circle and circle

    The points where two circles cross.

    a = (r₁² − r₂² + d²) ÷ 2d; h = √(r₁² − a²); points = c₁ + a·û ± h·û⊥

    Sketch intersections of lines, arcs and circles sketch-intersect.js
    • PartCraft
    64-bit
  • Is a crossing on the bounded curve

    Decides whether a crossing lies on the drawn part of a line or arc, and snaps it to the end when it is within the tolerance.

    line: −eps ÷ L ≤ t ≤ 1 + eps ÷ L; arc: angle ≤ sweep + eps ÷ r

    Sketch intersections of lines, arcs and circles sketch-intersect.js
    • PartCraft
    64-bit
  • Crossing points of two curves

    All crossing points of two sketch curves, sorted along the first.

    eps = 1e-9 × max(1, size of A, size of B); duplicates within 10 × eps removed

    Sketch intersections of lines, arcs and circles sketch-intersect.js
    • PartCraft
    64-bit
  • Roots of a function along a span

    Finds the parameters where a signed distance along the spline is zero.

    sample n steps; bisect each sign change until b − a ≤ 1e-16 × max(1, |a|)

    Sketch intersections with splines sketch-intersect.js
    • PartCraft
    64-bit
  • Spline against a line or circle

    Collects the spline parameters where it crosses a line or a circle, span by span.

    24 samples per knot span of F(S(u)); line: F = signed distance; circle: F = |S − c| − r

    Sketch intersections with splines sketch-intersect.js
    • PartCraft
    64-bit
  • Spline against spline

    The parameter pairs at which two splines cross.

    Newton: [S₁′(u) −S₂′(v)] · (Δu, Δv) = −(S₁(u) − S₂(v))

    Sketch intersections with splines sketch-intersect.js
    • PartCraft
    64-bit
  • Knot span of a parameter

    Finds which knot span a parameter falls in.

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    Exact
  • Basis functions

    The values of the B-spline basis functions that are not zero at a parameter.

    t = N[r] ÷ (right[r+1] + left[j−r]); N[r] = saved + right[r+1] × t; saved = left[j−r] × t (Cox–de Boor)

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    64-bit
  • Basis function derivatives

    The basis functions and their derivatives up to a given order at a parameter.

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    64-bit
  • Point on a spline

    The point of a spline at a parameter.

    C(u) = Σⱼ Nⱼ(u) × Pⱼ (degree + 1 terms)

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    64-bit
  • Derivatives of a spline

    The point, tangent and higher derivatives of a spline at a parameter.

    C⁽ⁱ⁾(u) = Σⱼ Nⱼ⁽ⁱ⁾(u) × Pⱼ

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    64-bit
  • Chord-length parameters

    Gives each fit point a parameter equal to the summed straight distances up to it.

    tᵢ = tᵢ₋₁ + |Qᵢ − Qᵢ₋₁|

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    64-bit
  • Dense linear solve

    Solves the linear system that gives a fit spline its poles.

    A · X = B by Gauss–Jordan elimination with partial pivoting

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    64-bit
  • Spline through fit points

    The cubic spline that passes through the given points, open with natural or given end directions, or closed and periodic.

    rows: C(tᵢ) = Qᵢ; ends: C″ = 0 or C′ = (cos a, sin a); solve for the poles

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    64-bit
  • Area term of a spline

    The area term of a spline by Green's formula: the enclosed area when the spline is closed.

    ½ ∫ (x·y′ − y·x′) du, 3-point Gauss–Legendre per knot span (nodes ±√(3 ÷ 5), 0; weights 5/9, 8/9, 5/9)

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    64-bit
  • Curvature of a spline

    The signed curvature of a spline at a parameter.

    κ = (x′·y″ − y′·x″) ÷ |C′|³

    Sketch splines: evaluation, fitting and exact pieces sketch-spline.js
    • PartCraft
    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.