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
-
Placing people
Places figures over the region; along a line they face along it, half each way.
heading = atan2(Δy, Δx) of the line; yaw = heading + π ÷ 2 (+ π for half of them) + (rand − ½) × 0.3; scale = 0.97 + 0.06 × rand
Placing scene trees and people scene-entourage.js64-bit- ModelCraft
-
Scattering points with a minimum spacing
Seeded points inside a rectangle or along a line, none closer than the minimum distance to another.
rectangle: x = x₀ + margin + rand × w, y likewise; line: p = a + (b − a) × i ÷ (count − 1) + normal × jitter; kept x, y = round to 0.01
Placing scene trees and people scene-say.js64-bit- ModelCraft
-
Placement matrix
The 4×4 matrix for a turn about the vertical axis, a uniform scale and a position.
c = cos(yaw)·scale; s = sin(yaw)·scale; columns [c, s, 0], [−s, c, 0], [0, 0, scale], [x, y, z]
Placing scene trees and people scene-say.js64-bit- ModelCraft
-
Arc and circle as straight segments
The ground segments for one traced line, arc or circle.
aₖ = a₀ + sweep × k ÷ n; pₖ = [cx + r·cos aₖ, cy + r·sin aₖ, 0]
Traced sketch into model edges sketch-photo-mc.js64-bit- ModelCraft
-
Did another program change the points
Decides whether a definition's native USD points still match the model's own.
changed if any fround(own coordinate) ≠ file coordinate, or the counts differ
USD save, open and import usd-modelcraft.jsExact- ModelCraft
-
Mesh from the native points
Rebuilds a definition that was changed elsewhere from the file's native points and faces.
USD save, open and import usd-modelcraft.js64-bit- ModelCraft
-
Was a placement moved elsewhere
Decides whether a placement's matrix in the file differs from the model's and takes the file's if so.
moved if any |mₖ(file) − mₖ(own)| > 10⁻⁷ × max(1, |mₖ(own)|)
USD save, open and import usd-modelcraft.js64-bit- ModelCraft
-
Placements through the stage's frame
Brings a placement matrix from the file's units and up axis into meters with Z up.
M′ = F · M · F⁻¹
USD save, open and import usd-modelcraft.js64-bit- ModelCraft
-
Imported mesh points
The points of an imported mesh in meters with Z up.
p′ = F · p (rotation, scale and translation of the frame)
USD save, open and import usd-modelcraft.js64-bit- ModelCraft
-
Lamp output from a USD light
The lumens of an imported lamp when the file does not carry ModelCraft's own value.
area = width × height × scale² or 4π·(radius × scale)²; lumens = intensity × 2^exposure × 683 × max(area, 10⁻⁶) × π
USD save, open and import usd-modelcraft.js64-bit- ModelCraft
-
Event order
Decides which of two queued events runs first.
earlier time first; equal times: lower priority number first; then lower sequence number
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Time-weighted mean and maximum
The mean and maximum over time of a queue length, a count of busy servers or an on/off state.
area = Σ value × (time it held); mean = (area + value × (now − last change)) ÷ (now − start)
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Rounding of reported statistics
Rounds a statistic to 6 decimals before it goes into the results.
r6(x) = round(x × 10⁶) ÷ 10⁶
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Load type by weight
Picks the type of a new load in proportion to the types' weights.
u = random × Σ weights; subtract each weight in turn until u < 0
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Throughput and lead time at a sink
Counts finished loads and works out loads per hour and the mean and maximum time from creation to the sink.
lead = now − born; per hour = n ÷ span × 3600; mean lead = Σ lead ÷ n
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Station utilization, blocking and waiting
The share of server time spent busy, blocked and idle, the mean queue and the mean wait at a station.
utilization = mean busy ÷ servers; blocked = mean blocked ÷ servers; idle = 1 − (mean busy + mean blocked) ÷ servers; wait = Σ wait ÷ starts
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Gate cycle phase
Whether a cycling gate starts open and when it first switches.
period = open + closed; phase = ((0 − offset) mod period + period) mod period; open when phase < open
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Position of a load on a belt
Where the tail of a load is now, on an accumulating belt or on a belt that stops as a whole.
accumulating: p = min(v × t + c, S); stopping belt: p = D(t) − D at entry, D(t) = D₀ + v × (t − t₀)
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
When the next load can get on a belt
The time at which the last load has moved far enough for the next one to enter.
pitch = load length + gap (or the fixed zone pitch); accumulating: t = (pitch − c_last) ÷ v; stopping belt: t = now + (pitch − gap so far) ÷ v
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
A load gets on a belt
Sets the two numbers that describe the new load's motion: where it is held back and where it stops.
empty belt: c = −v × now (or less, to keep the pitch behind the load that just left), S = length − L; else c = min(−v × now, c_last − pitch), S = S_last − pitch
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
When the head load reaches the end
The time the first load's head arrives at the end of the belt.
accumulating: t = (length − L − c) ÷ v; stopping belt: t = t₀ + (D at entry + length − L − D₀) ÷ v
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Loads close up when the head leaves
Works out again, for every load left on the belt, where it is held back and where it stops.
first: c = min(−v × entry, length − L_gone − v × now − pitch), S = length − L; others: c = min(−v × entry, c_front − pitch), S = S_front − pitch
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
A belt starts again after a breakdown
Shifts every load's timeline by the time the belt stood still.
dur = now − time it stopped; c = c − v × dur; entry = entry + dur
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Photo-eye covered by a load
Whether a load is over a sensor placed a given distance along a belt.
covered when p − 1e-7 ≤ at ≤ p + L + 1e-7
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Shortest vehicle routes
The shortest path distance from one path node to every other, used to pick the nearest idle vehicle and its route.
Dijkstra: dist(to) = min over edges of dist(from) + edge length
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Vehicle travel time on a segment
When a vehicle that enters a path segment reaches its end.
t₁ = now + length ÷ speed
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Vehicle time shares and distances
For each vehicle: the share of time in each state, the distance driven loaded and empty, and how busy it was.
share = time in state ÷ span; busy = 1 − idle share − down share
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Run results
Throughput per hour and the lead time count, mean, minimum, median, 95th percentile and maximum for the whole run.
per hour = done ÷ span × 3600; mean = Σ lead ÷ n; percentile p = sorted[min(n − 1, floor(p × n))]
Material flow simulation addons/flow/lib/sim.js64-bit- ModelCraft
-
Seeds from a string
Turns the seed and a stream key into four 32-bit seeds.
Random numbers and time distributions for material flow addons/flow/lib/rng.jsExact- ModelCraft
-
Uniform random number
One number from 0 up to, but not including, 1.
next = (32-bit state output) ÷ 4294967296
Random numbers and time distributions for material flow addons/flow/lib/rng.js64-bit- ModelCraft
-
One time from a distribution
A time in seconds drawn from a constant, uniform, exponential, Erlang, normal or triangular distribution.
exponential: −mean × ln(1 − u); Erlang: −(mean ÷ k) × ln(Π (1 − uᵢ)); normal: mean + sd × √(−2 ln u₁) × cos(2π u₂); triangular: a + √(u (b − a)(m − a)) or b − √((1 − u)(b − a)(b − m))
Random numbers and time distributions for material flow addons/flow/lib/rng.js64-bit- ModelCraft
-
Mean of a distribution
The mean time of a distribution, as the panel shows it.
uniform: (a + b) ÷ 2; triangular: (a + m + b) ÷ 3; others: the stated mean
Random numbers and time distributions for material flow addons/flow/lib/rng.js64-bit- ModelCraft
-
Shortest turn between two directions
The quaternion that turns one unit vector onto another.
q = (u × v, 1 + u · v), made unit
Inverse kinematics and constraints anim/constraints.js64-bit- ModelCraft
-
Two-bone reach
Where the elbow and the end of a two-bone chain go so the end reaches a target.
cos A = (L₁² + d² − L₂²) ÷ (2 L₁ d); sin A = √(1 − cos² A); elbow = a + dir × L₁ cos A + n × L₁ sin A
Inverse kinematics and constraints anim/constraints.js64-bit- ModelCraft
-
Chain of three or more bones (FABRIK)
Joint positions of a longer chain whose tip reaches for a target.
backward sweep from the target, forward sweep from the root, each joint kept its segment length from its neighbor
Inverse kinematics and constraints anim/constraints.js64-bit- ModelCraft
-
Point along a path by length
The point and direction a given fraction of the way along a polyline.
s = k × Σ segment lengths; walk the segments subtracting each length until s falls inside one
Inverse kinematics and constraints anim/constraints.js64-bit- ModelCraft
-
Point an axis at a direction
A matrix whose chosen axis points along a direction, with its up axis leaning to world +Z.
Inverse kinematics and constraints anim/constraints.js64-bit- ModelCraft
-
Blend by influence
Mixes two matrices by a factor from 0 to 1: place and size linearly, the turn along the shortest arc.
t = t_a + (t_b − t_a) k; s = s_a + (s_b − s_a) k; q = slerp(q_a, q_b, k)
Inverse kinematics and constraints anim/constraints.js64-bit- ModelCraft
-
IK on a rig
Builds the chain for an IK constraint, solves it and swings each bone so it runs to the next joint.
Inverse kinematics and constraints anim/constraints.js64-bit- ModelCraft
-
World matrix back to a local pose
Works a bone's local matrix back from a wanted world matrix through its parent.
local = (parent world × parent rest⁻¹ × rest)⁻¹ × wanted world
Inverse kinematics and constraints anim/constraints.js64-bit- ModelCraft
-
Constraints on placements
Applies look-at, copy, limit, child-of and follow-path constraints to placements in world coordinates and returns their new local matrices.
new local = blend(local, parent world⁻¹ × constrained world, influence)
Inverse kinematics and constraints anim/constraints.js64-bit- ModelCraft
-
World matrix of a placement
The product of the matrices of a placement and everything it sits in.
W = M₁ × M₂ × … × M_own
Inverse kinematics and constraints anim/cns-model.js64-bit- ModelCraft
-
A curve object's line in world coordinates
The polyline a follow-path constraint runs along.
Inverse kinematics and constraints anim/cns-model.js64-bit- ModelCraft
-
A body from a placement
The center, half sizes and turn of the box or sphere that stands for a placement.
scale = lengths of the matrix columns; half = max(1e-4, half box × scale); sphere radius = largest half
Rigid body simulation anim/physics.js64-bit- ModelCraft
-
Rotation matrix to quaternion
The unit quaternion of a rotation given by its three axes.
Rigid body simulation anim/physics.js64-bit- ModelCraft
-
Placement matrix from a body state
The placement's world matrix for a simulated position and turn.
axes = q applied to X, Y, Z, times the placement's scale; origin = body center − rotated, scaled center offset
Rigid body simulation anim/physics.js64-bit- ModelCraft
-
Mass and inertia
The inverse mass and inverse moments of inertia of a box or a sphere.
sphere: I = 0.4 m r²; box: I_x = m (b² + c²) ÷ 12, and likewise for y and z
Rigid body simulation anim/physics.js64-bit- ModelCraft
-
Depth of a point inside a box
How far a point is inside a box and the outward normal of the nearest face.
local = q⁻¹ (p − center); depth = min over axes of (half + margin − |local|) − margin
Rigid body simulation anim/physics.js64-bit- ModelCraft
-
Positional correction
Pushes two bodies apart along a normal by a given distance, sharing it by their mass and inertia.
w = Σ (1 ÷ m + (r × n) · I⁻¹ (r × n)); λ = c ÷ w; x += n λ ÷ m; q += ½ (Δω, 0) q, made unit
Rigid body simulation anim/physics.js64-bit- ModelCraft
-
Step size and frame count
How many frames are recorded and how long one substep is.
frames = max(1, round((to − from) × fps) + 1); h = 1 ÷ fps ÷ substeps
Rigid body simulation anim/physics.js64-bit- 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.