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
-
Instanced placements
One placement per instance from the file's per-instance translation, rotation and scale.
glTF import: meshes, skins and placements io/gltf-import.js64-bit- ModelCraft
-
Texture coordinate transform
Applies a texture's offset, rotation and scale to a UV pair.
u′ = cos r × u s_u + sin r × v s_v + o_u; v′ = −sin r × u s_u + cos r × v s_v + o_v
glTF import: meshes, skins and placements io/gltf-import.js64-bit- ModelCraft
-
Lamps
A lamp's position, direction, brightness and cone from a glTF light.
lumens = candela × 4π; spot angle (°) = 2 × outer cone × 180 ÷ π
glTF import: meshes, skins and placements io/gltf-import.js64-bit- ModelCraft
-
Cameras
A saved view's eye, target and field of view from a glTF camera.
target = eye + 10 × forward; field of view (°) = yfov × 180 ÷ π; parallel view height = 2 × |ymag|
glTF import: meshes, skins and placements io/gltf-import.js64-bit- ModelCraft
-
Vertex data of a primitive
Writes a primitive's positions, normals, texture coordinates, colors and indices.
glTF export io/gltf-write.js64-bit- ModelCraft
-
Bounds of the positions
The smallest and largest x, y and z written with the positions.
glTF export io/gltf-write.js64-bit- ModelCraft
-
Shared vertices
Gives corners with the same position, normal, UV and color one vertex.
key = x, y, z as numbers + normal to 5 decimals + UV + color
glTF export io/gltf-write.js64-bit- ModelCraft
-
Placement matrices
Writes a placement's matrix on its node.
entry = 0 when |entry| < 1e-15, else the entry
glTF export io/gltf-write.js64-bit- ModelCraft
-
Lamps
A lamp's intensity and cone as glTF writes them.
candela = lumens ÷ (4π); outer cone = min(π ÷ 2, angle × π ÷ 360)
glTF export io/gltf-write.js64-bit- ModelCraft
-
Saved views as cameras
A saved view's field of view or height as a glTF camera.
yfov = fov × π ÷ 180; xmag = ymag = height ÷ 2
glTF export io/gltf-write.js64-bit- ModelCraft
-
Node matrix for a lamp or camera
A matrix at a point whose −Z looks along a direction with +Y as near world up as it can be.
f = dir made unit; r = (f × up) made unit; u = r × f
glTF export io/gltf-write.js64-bit- ModelCraft
-
Reading a vertex
Parses the three coordinates of a 'v' line.
OBJ import and export io/obj.js64-bit- ModelCraft
-
Points into Z up
Copies an object's points into the model's coordinates.
(x, y, z) → (x, −z, y)
OBJ import and export io/obj.js64-bit- ModelCraft
-
Sharp edges
Marks an edge sharp where the file's normals break across it, where smoothing groups differ, or where the faces bend.
with normals: sharp unless n₁ · n₂ > 0.9995 at both ends; without normals or groups: sharp when the face normals' dot product < 0.99996
OBJ import and export io/obj.js64-bit- ModelCraft
-
Number format on export
Prints a number for the exported file.
text = the number rounded to 6 decimals, trailing zeros removed
OBJ import and export io/obj.js64-bit- ModelCraft
-
Exported points
Carries a mesh point to world coordinates and Y up for the file.
p′ = placement matrix × p; (x, y, z) → (x, z, −y)
OBJ import and export io/obj.js64-bit- ModelCraft
-
Texture coordinates with a map's scale and offset
Applies a material's map scale and offset to a texture coordinate on import.
u′ = u × scale_u + offset_u; v′ = v × scale_v + offset_v
OBJ import and export io/obj.js64-bit- ModelCraft
-
Reading one number
Reads a value of the type the header names, from text or from binary.
PLY import and export io/ply.js64-bit- ModelCraft
-
Imported positions
Stores each vertex's x, y and z.
PLY import and export io/ply.js64-bit- ModelCraft
-
Points and normals in world coordinates
Carries a point and a normal through a placement's matrix for export.
p′ = M × p; n′ = (M × n without translation), made unit
PLY import and export io/ply.js64-bit- ModelCraft
-
Exported positions
Writes each vertex's world position and normal into the file.
PLY import and export io/ply.js32-bit in part- ModelCraft
-
Shared vertices on export
Gives corners with the same position, normal, color and UV one vertex.
key = x, y, z as numbers + normal to 5 decimals + color + UV
PLY import and export io/ply.js64-bit- ModelCraft
-
Reading a binary file
Reads each triangle's nine coordinates and its color word.
STL import and export io/stl.js64-bit- ModelCraft
-
Reading a text file
Parses every 'vertex x y z' line.
STL import and export io/stl.js32-bit in part- ModelCraft
-
Unit factors
The factor from the file's unit to meters.
mm 0.001; cm 0.01; m 1; inch 0.0254; foot 0.3048
STL import and export io/stl.js64-bit- ModelCraft
-
Welding corners and applying the unit
Makes one vertex for every distinct corner and scales it to meters.
same vertex when x, y and z are equal as text; stored as (x, y, z) × unit factor
STL import and export io/stl.js64-bit- ModelCraft
-
Triangles with no area
Drops triangles whose corners lie on one line.
dropped when |(b − a) × (c − a)| < 1e-18
STL import and export io/stl.js64-bit- ModelCraft
-
Exported triangles
Writes each triangle's normal and corners in millimeters.
n = (b − a) × (c − a), made unit; corner (mm) = world corner (m) × 1000
STL import and export io/stl.js64-bit- ModelCraft
-
Rounding of every parameter
Rounds each number of a converted material.
v → the number nearest v with 7 significant digits
Imported material parameters io/pbr.js64-bit- ModelCraft
-
Film thickness and dispersion
A thin film's thickness in micrometers and a glass's Abbe number.
thickness (µm) = maximum thickness (nm) ÷ 1000; Abbe number = 20 ÷ dispersion
Imported material parameters io/pbr.js64-bit- ModelCraft
-
Emission strength
Splits an emissive color into a color with a peak of 1 and a luminance.
peak = largest channel; color = channels ÷ peak; luminance = peak × strength
Imported material parameters io/pbr.js64-bit- ModelCraft
-
Shininess to roughness
A roughness from a Blinn–Phong shininess exponent.
roughness = (2 ÷ (s + 2))^¼, clamped to [0, 1]
Imported material parameters io/pbr.js64-bit- ModelCraft
-
Knot span
Finds the knot interval that holds a parameter.
3DM curves and surfaces: points on them io/3dm/geom.js64-bit- ModelCraft
- PartCraft
-
de Boor's algorithm
A point of a B-spline from its control points and knots.
a = (t − k₀) ÷ (k₁ − k₀); d_j = (1 − a) d_(j−1) + a d_j, repeated degree times
3DM curves and surfaces: points on them io/3dm/geom.js64-bit- ModelCraft
- PartCraft
-
Rational point
Divides a homogeneous point by its weight.
(x, y, z) = (X, Y, Z) ÷ w
3DM curves and surfaces: points on them io/3dm/geom.js64-bit- ModelCraft
- PartCraft
-
Point on a NURBS surface
A surface point from its control net.
de Boor along v for each active row, then along u, then the division by the weight
3DM curves and surfaces: points on them io/3dm/geom.js64-bit- ModelCraft
- PartCraft
-
Point on a curve
A point on a line, arc, polyline, NURBS curve or chain of curves at a parameter.
arc: a = angle mapped from the parameter; p = o + r cos a × x + r sin a × y
3DM curves and surfaces: points on them io/3dm/geom.js64-bit- ModelCraft
- PartCraft
-
A curve as a polyline
Cuts a curve into chords that stay within a tolerance of it, keeping every knot and corner.
a piece is halved while its middle or quarter points lie farther than tol from the chord, at most 10 times
3DM curves and surfaces: points on them io/3dm/geom.js64-bit- ModelCraft
- PartCraft
-
Rotation about an axis
Turns a point about a line by an angle, for surfaces of revolution.
p′ = o + v cos a + (z × v) sin a + z (z · v)(1 − cos a)
3DM curves and surfaces: points on them io/3dm/geom.js64-bit- ModelCraft
- PartCraft
-
Point on a surface
A point on a plane, NURBS surface, surface of revolution or sum surface.
plane: o + a x + b y; revolution: the profile point turned about the axis; sum: p(u) + q(v) + base
3DM curves and surfaces: points on them io/3dm/geom.js64-bit- ModelCraft
- PartCraft
-
Surface normal
The unit normal of a surface at a point.
∂u ≈ S(u + h, v) − S(u − h, v); ∂v likewise; n = ∂u × ∂v, made unit; h = 1e-5 × parameter range
3DM curves and surfaces: points on them io/3dm/geom.js64-bit- ModelCraft
- PartCraft
-
A saved mesh as triangles
Copies a mesh record's points and splits its quads into triangles.
3DM surfaces into triangles io/3dm/tess.js64-bit- ModelCraft
- PartCraft
-
Joining points that coincide
Makes one vertex of points that sit at the same place, so the faces of a solid close up.
q = max(diagonal × 1e-9, 1e-12); same vertex when round(x ÷ q), round(y ÷ q) and round(z ÷ q) are equal
3DM surfaces into triangles io/3dm/tess.js64-bit- ModelCraft
- PartCraft
-
Sampling a shared edge
Samples an edge once on its 3D curve, for both faces that share it.
fraction s = (t − t₀) ÷ (t₁ − t₀) along the edge's own direction
3DM surfaces into triangles io/3dm/tess.js64-bit- ModelCraft
- PartCraft
-
Scaling the parameter plane
Scales u and v so a step in each is about as long on the surface, before triangulating.
L_u, L_v = lengths of the two mid-lines measured with 8 chords; k_u = L_u ÷ Δu; k_v = L_v ÷ Δv
3DM surfaces into triangles io/3dm/tess.js64-bit- ModelCraft
- PartCraft
-
Halving an interior edge
Decides whether a triangle edge needs a new point at its middle, and adds it.
halve when the edge is longer than 2 tol and (|S(mid) − chord middle| > tol or n_a · n_c < cos 20°)
3DM surfaces into triangles io/3dm/tess.js64-bit- ModelCraft
- PartCraft
-
Grid step from the surface's bend
How far apart interior points are placed, from how much the surface bends.
k = angle between neighboring normals ÷ their distance (75th percentile of a 9 × 9 grid); h = min(√(8 tol ÷ k), 0.349 ÷ k), not below max(L) ÷ 400 or √(L_u L_v ÷ 40000)
3DM surfaces into triangles io/3dm/tess.js64-bit- ModelCraft
- PartCraft
-
Grid points inside a face
Picks the grid points that lie inside the face's loops and not too near a side.
inside by counting crossings of the row (even-odd); kept when at least half a grid step from every side
3DM surfaces into triangles io/3dm/tess.js64-bit- ModelCraft
- PartCraft
-
Extrusions
Walls along the path from each profile, and caps from the closed profiles with their holes.
frame: T = path direction, X = up × T, Y = T × X; point = origin + x X + y Y; profile closed when its ends are within max(tol, 1e-9)
3DM surfaces into triangles io/3dm/tess.js64-bit- ModelCraft
- PartCraft
-
Tessellation tolerance
The distance triangles may stand off a surface, per object.
base = given tolerance, else the file's, else 0.01; tol = max(base, 0.0015 × diagonal of the object's rough box)
3DM surfaces into triangles io/3dm/scene.js64-bit- ModelCraft
- PartCraft
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.