Units API

OkapiLib features a units API that compares quantities using dimensional analysis. This means that if you multiply two length units together, you get an area unit; or if you divide a length unit by a time unit, you get a velocity unit. These are just examples, OkapiLib supports much more than just these.

Length Units

Type name: QLength

UnitNameLiteral
Metermeter_m
Decimeterdecimeter
Centimetercentimeter_cm
Millimetermillimeter_mm
Kilometerkilometer_km
Inchinch_in
Footfoot_ft
Yardyard_yd
Milemile_mi
Tiletile_tile

Speed Units

Type name: QSpeed

UnitNameLiteral
Meter / secondmps_mps
Mile / hourmiph_miph
Kilometer / hourkmph_kmph

Acceleration Units

Type name: QAcceleration

UnitNameLiteral
meters / second^2mps2_mps2
gravityG_G

Jerk Units

Type name: QJerk

Angle Units

Type name: QAngle

UnitNameLiteral
Radianradian_rad
Degreedegree_deg

Angular Speed Units

Type name: QAngularSpeed

UnitNameLiteral
Radian / secondradps
Rotation / minuterpm_rpm

Angular Acceleration Units

Type name: QAngularAcceleration

Angular Jerk Units

Type name: QAngularJerk

Time Units

Type name: QTime

UnitNameLiteral
Secondsecond_s
Millisecondmillisecond_ms
Minuteminute_min
Hourhour_h
Dayday_day

Frequency Units

Type name: QFrequency

UnitNameLiteral
HertzHz_Hz

Area Units

Type name: QArea

UnitNameLiteral
Kilometer^2kilometer2
Meter^2meter2
Decimeter^2decimeter2
Centimeter^2centimeter2
Millimeter^2millimeter2
Inch^2inch2
Foot^2foot2
Mile^2mile2

Volume Units

Type name: QVolume

UnitNameLiteral
Kilometer^3kilometer3
Meter^3meter3
Decimeter^3decimeter3
Centimeter^3centimeter3
Millimeter^3millimeter3
Inch^3inch3
Foot^3foot3
Mile^3mile3
Litre^3litre3

Force Units

Type name: QForce

UnitNameLiteral
Newtonnewton_n
Poundforcepoundforce_lbf
Kilopondkilopond_kp

Torque Units

Type name: QTorque

UnitNameLiteral
Newton-meternewtonMeter_nM
Foot-poundfootPound_ftLb
Inch-poundinchPound_inLb

Pressure Units

Type name: QPressure

UnitNameLiteral
Pascalpascal_Pa
Barbar_bar
PSIpsi_psi

Mass Units

Type name: QMass

UnitNameLiteral
Kilogramkg_kg
Grammegramme_g
Tonnetonne_t
Ounceounce_oz
Poundpound_lb
Stonestone_st