Optionalinit: UnitSystemInit
the caller's partial record, or undefined for SI
a complete, frozen unit system
FourError INVALID_APPLICATION_STATE if a selector is outside its
§40 union, or a scale factor is not finite and greater than zero
// A CAD-style application: world authored in millimetres, angles shown in
// degrees. The engine still runs in world units and radians.
const units = resolveUnitSystem({
length: "millimeter",
angle: "degree",
scale: { lengthToMeters: 0.001, massToKilograms: 1 },
});
angleToDisplay(Math.PI / 2, units); // 90 — for the readout, not the solver
Completes and validates a partial §40 record.
Omitted fields take their SI_UNITS defaults, so
resolveUnitSystem({ angle: "degree" })is "SI, displayed in degrees" and nothing else. The result is frozen, includingscale.Calling it with nothing returns the shared SI_UNITS object itself and allocates nothing.