Units.hpp File Reference
Units file. More...
#include <PlayRho/Common/RealConstants.hpp>
#include <PlayRho/Common/Templates.hpp>
#include <type_traits>
#include <cmath>
Go to the source code of this file.
Namespaces | |
playrho | |
Macros | |
#define | PLAYRHO_QUANTITY(BoostDimension) Real |
#define | PLAYRHO_UNIT(Quantity, BoostUnit) Real{1} |
#define | PLAYRHO_DERIVED_UNIT(Quantity, BoostUnit, Ratio) Real{Ratio}} |
Typedefs | |
using | playrho::Time = PLAYRHO_QUANTITY(boost::units::si::time) |
Time quantity. More... | |
using | playrho::Frequency = PLAYRHO_QUANTITY(boost::units::si::frequency) |
Frequency quantity. More... | |
using | playrho::Length = PLAYRHO_QUANTITY(boost::units::si::length) |
Length quantity. More... | |
using | playrho::LinearVelocity = PLAYRHO_QUANTITY(boost::units::si::velocity) |
Linear velocity quantity. More... | |
using | playrho::LinearAcceleration = PLAYRHO_QUANTITY(boost::units::si::acceleration) |
Linear acceleration quantity. More... | |
using | playrho::Mass = PLAYRHO_QUANTITY(boost::units::si::mass) |
Mass quantity. More... | |
using | playrho::InvMass = PLAYRHO_QUANTITY(boost::units::si::inverse_mass) |
Inverse mass quantity. More... | |
using | playrho::Area = PLAYRHO_QUANTITY(boost::units::si::area) |
Area quantity. More... | |
using | playrho::AreaDensity = PLAYRHO_QUANTITY(boost::units::si::surface_density) |
Area (surface) density quantity. More... | |
using | playrho::Angle = PLAYRHO_QUANTITY(boost::units::si::plane_angle) |
Angle quantity. More... | |
using | playrho::AngularVelocity = PLAYRHO_QUANTITY(boost::units::si::angular_velocity) |
Angular velocity quantity. More... | |
using | playrho::AngularAcceleration = PLAYRHO_QUANTITY(boost::units::si::angular_acceleration) |
Angular acceleration quantity. More... | |
using | playrho::Force = PLAYRHO_QUANTITY(boost::units::si::force) |
Force quantity. More... | |
using | playrho::Torque = PLAYRHO_QUANTITY(boost::units::si::torque) |
Torque quantity. More... | |
using | playrho::SecondMomentOfArea = PLAYRHO_QUANTITY(boost::units::si::second_moment_of_area) |
Second moment of area quantity. More... | |
using | playrho::RotInertia = PLAYRHO_QUANTITY(boost::units::si::moment_of_inertia) |
Rotational inertia quantity. More... | |
using | playrho::InvRotInertia = PLAYRHO_QUANTITY(boost::units::si::inverse_moment_of_inertia) |
Inverse rotational inertia quantity. More... | |
using | playrho::Momentum = PLAYRHO_QUANTITY(boost::units::si::momentum) |
Momentum quantity. More... | |
using | playrho::AngularMomentum = PLAYRHO_QUANTITY(boost::units::si::angular_momentum) |
Angular momentum quantity. More... | |
Functions | |
PLAYRHO_CONSTEXPR Mass | playrho::operator""_g (unsigned long long int v) noexcept |
SI unit symbol for a gram unit of Mass. More... | |
PLAYRHO_CONSTEXPR Mass | playrho::operator""_g (long double v) noexcept |
SI unit symbol for a gram unit of Mass. More... | |
PLAYRHO_CONSTEXPR Mass | playrho::operator""_kg (unsigned long long int v) noexcept |
SI unit symbol for a kilogram unit of Mass. More... | |
PLAYRHO_CONSTEXPR Mass | playrho::operator""_kg (long double v) noexcept |
SI unit symbol for a kilogram unit of Mass. More... | |
PLAYRHO_CONSTEXPR Mass | playrho::operator""_Pg (unsigned long long int v) noexcept |
SI unit symbol for a petagram unit of Mass. More... | |
PLAYRHO_CONSTEXPR Mass | playrho::operator""_Pg (long double v) noexcept |
SI unit symbol for a petagram unit of Mass. More... | |
PLAYRHO_CONSTEXPR Mass | playrho::operator""_Yg (unsigned long long int v) noexcept |
SI unit symbol for a yottagram unit of Mass. More... | |
PLAYRHO_CONSTEXPR Mass | playrho::operator""_Yg (long double v) noexcept |
SI unit symbol for a yottagram unit of Mass. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_m (unsigned long long int v) noexcept |
SI unit symbol for a meter of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_m (long double v) noexcept |
SI unit symbol for a meter of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_dm (unsigned long long int v) noexcept |
SI unit symbol for a decimeter of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_dm (long double v) noexcept |
SI unit symbol for a decimeter of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_cm (unsigned long long int v) noexcept |
SI unit symbol for a centimeter of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_cm (long double v) noexcept |
SI unit symbol for a centimeter of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_Gm (unsigned long long int v) noexcept |
SI unit symbol for a gigameter unit of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_Gm (long double v) noexcept |
SI unit symbol for a gigameter unit of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_Mm (unsigned long long int v) noexcept |
SI unit symbol for a megameter unit of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_Mm (long double v) noexcept |
SI unit symbol for a megameter unit of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_km (unsigned long long int v) noexcept |
SI symbol for a kilometer unit of Length. More... | |
PLAYRHO_CONSTEXPR Length | playrho::operator""_km (long double v) noexcept |
SI symbol for a kilometer unit of Length. More... | |
PLAYRHO_CONSTEXPR Time | playrho::operator""_s (unsigned long long int v) noexcept |
SI symbol for a second unit of Time. More... | |
PLAYRHO_CONSTEXPR Time | playrho::operator""_s (long double v) noexcept |
SI symbol for a second unit of Time. More... | |
PLAYRHO_CONSTEXPR Time | playrho::operator""_min (unsigned long long int v) noexcept |
SI symbol for a minute unit of Time. More... | |
PLAYRHO_CONSTEXPR Time | playrho::operator""_min (long double v) noexcept |
SI symbol for a minute unit of Time. More... | |
PLAYRHO_CONSTEXPR Time | playrho::operator""_h (unsigned long long int v) noexcept |
Symbol for an hour unit of Time. More... | |
PLAYRHO_CONSTEXPR Time | playrho::operator""_h (long double v) noexcept |
Symbol for an hour unit of Time. More... | |
PLAYRHO_CONSTEXPR Time | playrho::operator""_d (unsigned long long int v) noexcept |
Symbol for a day unit of Time. More... | |
PLAYRHO_CONSTEXPR Time | playrho::operator""_d (long double v) noexcept |
Symbol for a day unit of Time. More... | |
PLAYRHO_CONSTEXPR Angle | playrho::operator""_rad (unsigned long long int v) noexcept |
SI symbol for a radian unit of Angle. More... | |
PLAYRHO_CONSTEXPR Angle | playrho::operator""_rad (long double v) noexcept |
SI symbol for a radian unit of Angle. More... | |
PLAYRHO_CONSTEXPR Angle | playrho::operator""_deg (unsigned long long int v) noexcept |
Abbreviation for a degree unit of Angle. More... | |
PLAYRHO_CONSTEXPR Angle | playrho::operator""_deg (long double v) noexcept |
Abbreviation for a degree unit of Angle. More... | |
PLAYRHO_CONSTEXPR Force | playrho::operator""_N (unsigned long long int v) noexcept |
SI symbol for a newton unit of Force. More... | |
PLAYRHO_CONSTEXPR Force | playrho::operator""_N (long double v) noexcept |
SI symbol for a newton unit of Force. More... | |
PLAYRHO_CONSTEXPR Area | playrho::operator""_m2 (unsigned long long int v) noexcept |
Abbreviation for meter squared unit of Area. More... | |
PLAYRHO_CONSTEXPR Area | playrho::operator""_m2 (long double v) noexcept |
Abbreviation for meter squared unit of Area. More... | |
PLAYRHO_CONSTEXPR LinearVelocity | playrho::operator""_mps (unsigned long long int v) noexcept |
Abbreviation for meter per second. More... | |
PLAYRHO_CONSTEXPR LinearVelocity | playrho::operator""_mps (long double v) noexcept |
Abbreviation for meter per second. More... | |
PLAYRHO_CONSTEXPR LinearVelocity | playrho::operator""_kps (unsigned long long int v) noexcept |
Abbreviation for kilometer per second. More... | |
PLAYRHO_CONSTEXPR LinearVelocity | playrho::operator""_kps (long double v) noexcept |
Abbreviation for kilometer per second. More... | |
PLAYRHO_CONSTEXPR LinearAcceleration | playrho::operator""_mps2 (unsigned long long int v) noexcept |
Abbreviation for meter per second squared. More... | |
PLAYRHO_CONSTEXPR LinearAcceleration | playrho::operator""_mps2 (long double v) noexcept |
Abbreviation for meter per second squared. More... | |
PLAYRHO_CONSTEXPR Frequency | playrho::operator""_Hz (unsigned long long int v) noexcept |
SI symbol for a hertz unit of Frequency. More... | |
PLAYRHO_CONSTEXPR Frequency | playrho::operator""_Hz (long double v) noexcept |
SI symbol for a hertz unit of Frequency. More... | |
PLAYRHO_CONSTEXPR Torque | playrho::operator""_Nm (unsigned long long int v) noexcept |
Abbreviation for newton-meter unit of torque. More... | |
PLAYRHO_CONSTEXPR Torque | playrho::operator""_Nm (long double v) noexcept |
Abbreviation for newton-meter unit of torque. More... | |
PLAYRHO_CONSTEXPR Momentum | playrho::operator""_Ns (unsigned long long int v) noexcept |
SI symbol for a newton second of impulse. More... | |
PLAYRHO_CONSTEXPR Momentum | playrho::operator""_Ns (long double v) noexcept |
SI symbol for a newton second of impulse. More... | |
PLAYRHO_CONSTEXPR AreaDensity | playrho::operator""_kgpm2 (unsigned long long int v) noexcept |
Abbreviation for kilogram per square meter. More... | |
PLAYRHO_CONSTEXPR AreaDensity | playrho::operator""_kgpm2 (long double v) noexcept |
Abbreviation for kilogram per square meter. More... | |
PLAYRHO_CONSTEXPR AngularVelocity | playrho::operator""_rpm (unsigned long long int v) noexcept |
Abbreviation for revolutions per minute. More... | |
PLAYRHO_CONSTEXPR AngularVelocity | playrho::operator""_rpm (long double v) noexcept |
Abbreviation for revolutions per minute. More... | |
PLAYRHO_CONSTEXPR Real | playrho::StripUnit (const Real value) |
Strips the units off of the given value. More... | |
Variables | |
const PLAYRHO_CONSTEXPR auto | playrho::Second = PLAYRHO_UNIT(Time, boost::units::si::second) |
Second unit of time. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::SquareSecond = Second * Second |
Square second unit. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::Hertz = PLAYRHO_UNIT(Frequency, boost::units::si::hertz) |
Hertz unit of Frequency. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::Meter = PLAYRHO_UNIT(Length, boost::units::si::meter) |
Meter unit of Length. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::MeterPerSecond |
Meter per second unit of linear velocity. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::MeterPerSquareSecond |
Meter per square second unit of linear acceleration. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::Kilogram = PLAYRHO_UNIT(Mass, boost::units::si::kilogram) |
Kilogram unit of mass. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::SquareMeter = PLAYRHO_UNIT(Area, boost::units::si::square_meter) |
Square meter unit of area. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::CubicMeter = Meter * Meter * Meter |
Cubic meter unit of volume. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::KilogramPerSquareMeter |
Kilogram per square meter unit of area density. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::Radian = PLAYRHO_UNIT(Angle, boost::units::si::radian) |
Radian unit of angle. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::Degree = Angle{Radian * Pi / Real{180}} |
Degree unit of angle quantity. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::SquareRadian = Radian * Radian |
Square radian unit type. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::RadianPerSecond |
Radian per second unit of angular velocity. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::DegreePerSecond = AngularVelocity{RadianPerSecond * Degree / Radian} |
Degree per second unit of angular velocity. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::RadianPerSquareSecond = Radian / (Second * Second) |
Radian per square second unit of angular acceleration. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::DegreePerSquareSecond = Degree / (Second * Second) |
Degree per square second unit of angular acceleration. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::Newton = PLAYRHO_UNIT(Force, boost::units::si::newton) |
Newton unit of force. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::NewtonMeter = PLAYRHO_UNIT(Torque, boost::units::si::newton_meter) |
Newton meter unit of torque. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::NewtonSecond = Newton * Second |
Newton second unit of momentum. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::NewtonMeterSecond = NewtonMeter * Second |
Newton meter second unit of angular momentum. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::RevolutionsPerMinute = 2 * Pi * Radian / (Real{60} * Second) |
Revolutions per minute units of angular velocity. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::EarthlyLinearAcceleration = Real{-9.8f} * MeterPerSquareSecond |
Earthly gravity. More... | |
const PLAYRHO_CONSTEXPR auto | playrho::BigG = Real{6.67408e-11f} * CubicMeter / (Kilogram * SquareSecond) |
Big "G". More... | |
Detailed Description
Units file.
This file establishes quantity aliases, unit constants, and associated code for the expression of physical quantities using recognizably named units of those quantities. Quantities, as used herein, are types associated with physical quantities like time and length. Conceptually a given quantity is only expressable in units that relate to that quantity. For every quantity defined herein, there's typically at least one conceptually typed unit asscociated with it.
- Note
- In the simplest way that the PlayRho library can be configured, there's no compiler enforcement on the usage of the units for their associated quantities beyond the usage of the Real type.
Definition in file Units.hpp.