Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Units Reference

All units are templates over the storage type, e.g. Length<float> or Length<double>. Shorthand aliases with _f and _d suffixes exist for every unit, e.g. Length_f, Length_d.

Base units

UnitSI unitExample accessors
Timesecond [s]s(), ms(), us(), ns(), min(), h(), day()
Lengthmeter [m]m(), km(), mm(), um(), nm(), mi(), yd(), ft(), in()
Masskilogram [kg]kg(), g(), mg(), ug(), tonne(), lb(), oz()
ElectricCurrentampere [A]A()
ThermodynamicTemperaturekelvin [K]K(), degC(), degF()
TemperatureDeltakelvin [K] (a difference)K(), degC(), degF() (offset-free)
AmountOfSubstancemole [mol]mol()
LuminousIntensitycandela [cd]cd()

Derived units

UnitSI unit
AbsorbedDosegray [Gy]
Acceleration[m/s²]
Activitybecquerel [Bq]
Angleradian [rad]
Area[m²]
Capacitancefarad [F]
CatalyticActivitykatal [kat]
Concentration[mol/m³]
Conductancesiemens [S]
CurrentDensity[A/m²]
Density[kg/m³]
DoseEquivalentsievert [Sv]
ElectricChargecoulomb [C]
Energyjoule [J]
Forcenewton [N]
Frequencyhertz [Hz]
Illuminancelux [lx]
Inductancehenry [H]
Luminance[cd/m²]
LuminousFluxlumen [lm]
MagneticFluxweber [Wb]
MagneticFluxDensitytesla [T]
Powerwatt [W]
Pressurepascal [Pa]
SolidAnglesteradian [sr]
Torquenewton-metre [N·m] (energy / angle)
Velocity[m/s]
Vergence[1/m] (diopter)
Voltagevolt [V]
Volume[m³]

Units sharing a dimension signature

Several SI units share the same dimension exponents, so automatic result-type mapping has to pick one winner; construct the other explicitly when needed:

DimensionsMapped resultConstruct explicitly
1/sFrequencyActivity
m²/s²AbsorbedDoseDoseEquivalent
KThermodynamicTemperatureTemperatureDelta

The angle pseudo-dimension

An eighth exponent tracks angle (rad = angle¹, sr = angle²), so Angle, SolidAngle and a dimensionless scalar are now distinct, and LuminousFlux (cd·sr) is distinct from LuminousIntensity (cd) — both get their own mapped result type instead of colliding. The exponent defaults to zero, so every other unit and all existing code are unchanged.

This is also what makes Torque (N·m = energy / angle) a type distinct from Energy (J): Energy / Angle == Torque and Torque * Angle == Energy, while a plain Force * Length still maps to Energy.