4#ifndef GREM_PHYSICS_QUANTITIES_HPP
5#define GREM_PHYSICS_QUANTITIES_HPP
25#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
44} && !
requires {
typename std::remove_reference_t<T>::DimensionType; };
55template <
int Mass,
int Length,
int Time>
88 template <
int OtherMass,
int OtherLength,
int OtherTime>
91 return Mass == OtherMass &&
Length == OtherLength &&
Time == OtherTime;
148 template <
int OtherMass,
int OtherLength,
int OtherTime>
162 template <
int OtherMass,
int OtherLength,
int OtherTime>
177 static_assert((
Mass / 2) * 2 ==
Mass,
"Invalid mass dimension of square root.");
178 static_assert((
Length / 2) * 2 ==
Length,
"Invalid length dimension of square root.");
179 static_assert((
Time / 2) * 2 ==
Time,
"Invalid time dimension of square root.");
218template <
int Mass,
int Length,
int Time>
223 }
else if constexpr (D ==
ANGLE) {
231 }
else if constexpr (D ==
AREA) {
233 }
else if constexpr (D ==
VOLUME) {
235 }
else if constexpr (D ==
DENSITY) {
239 }
else if constexpr (D ==
ABSEMENT) {
243 }
else if constexpr (D ==
VELOCITY) {
247 }
else if constexpr (D ==
FORCE) {
249 }
else if constexpr (D ==
TORQUE) {
251 }
else if constexpr (D ==
IMPULSE) {
253 }
else if constexpr (D ==
MOMENTUM) {
279 }
else if constexpr (D ==
WORK) {
281 }
else if constexpr (D ==
POWER) {
283 }
else if constexpr (D ==
ENERGY) {
286 constexpr auto formatBaseUnit = [](
String& output,
int exponent,
StringView string) ->
void {
288 if (!output.empty()) {
289 output.push_back(
' ');
291 output.append(
string);
298 formatBaseUnit(result,
Mass,
"kg");
299 formatBaseUnit(result,
Length,
"m");
300 formatBaseUnit(result,
Time,
"s");
314} && !
requires {
typename std::remove_reference_t<T>::MagnitudeType; };
325template <
long double Value,
bool IsAbsolute = false>
327 static constexpr long double VALUE = Value;
349 template <
long double OtherValue,
bool OtherIsAbsolute>
352 return Value == OtherValue && IsAbsolute == OtherIsAbsolute;
396 template <
long double OtherValue,
bool OtherIsAbsolute>
399 if (Value != OtherValue) {
400 throw physics::Error{
"Cannot add units of different magnitudes."};
402 if (IsAbsolute && OtherIsAbsolute) {
419 template <
long double OtherValue,
bool OtherIsAbsolute>
422 if (Value != OtherValue) {
423 throw physics::Error{
"Cannot subtract units of different magnitudes."};
425 if (!IsAbsolute && OtherIsAbsolute) {
426 throw physics::Error{
"Cannot subtract a non-relative unit from a relative unit."};
442 template <
long double OtherValue,
bool OtherIsAbsolute>
445 if (IsAbsolute && OtherIsAbsolute) {
462 template <
long double OtherValue,
bool OtherIsAbsolute>
465 if (IsAbsolute || OtherIsAbsolute) {
468 return Magnitude<Value / OtherValue,
false>{};
487template <
typename UnitT>
488concept can_unary_add = !UnitT::MagnitudeType::IS_ABSOLUTE;
490template <
typename UnitT>
491concept can_negate = !UnitT::MagnitudeType::IS_ABSOLUTE;
493template <
typename UnitT1,
typename... UnitTs>
494concept can_add = ((UnitT1::DIMENSION == UnitTs::DIMENSION) && ...) && ((UnitT1::MagnitudeType::VALUE == UnitTs::MagnitudeType::VALUE) && ...) &&
495 !(UnitT1::MagnitudeType::IS_ABSOLUTE && (UnitTs::MagnitudeType::IS_ABSOLUTE && ...));
497template <
typename UnitT1,
typename UnitT2>
498concept can_subtract = UnitT1::DIMENSION == UnitT2::DIMENSION && UnitT1::MagnitudeType::VALUE == UnitT2::MagnitudeType::VALUE &&
499 (UnitT1::MagnitudeType::IS_ABSOLUTE || !UnitT2::MagnitudeType::IS_ABSOLUTE);
501template <
typename UnitT1,
typename... UnitTs>
502concept can_multiply = !(UnitT1::MagnitudeType::IS_ABSOLUTE && (UnitTs::MagnitudeType::IS_ABSOLUTE && ...));
504template <
typename UnitT1,
typename UnitT2>
505concept can_divide = !UnitT1::MagnitudeType::IS_ABSOLUTE && !UnitT2::MagnitudeType::IS_ABSOLUTE;
516 typename std::remove_reference_t<T>::DimensionType;
517 { std::remove_reference_t<T>::DIMENSION } ->
dimension;
519 { std::remove_reference_t<T>::MAGNITUDE } ->
magnitude;
521} && !
requires {
typename std::remove_reference_t<T>::Unit; };
525struct canonical_unit {
544template <Dimension D, Magnitude M>
558 if constexpr (MagnitudeType::VALUE == 1.0l) {
559 return DimensionType::getSIUnitSymbolString();
561 return formatString(
"({} {})", MagnitudeType::VALUE, DimensionType::getSIUnitSymbolString());
572 template <unit OtherUnitT>
573 [[nodiscard]]
consteval operator OtherUnitT() const
585 static_assert(detail::can_unary_add<BaseUnit>,
"This unit cannot be unary-added.");
596 static_assert(detail::can_negate<BaseUnit>,
"This unit cannot be negated.");
608 template <unit OtherUnitT>
609 [[nodiscard]]
consteval auto operator+(
const OtherUnitT& other)
const {
610 static_assert(detail::can_add<BaseUnit, OtherUnitT>,
"These units cannot be added.");
623 template <unit OtherUnitT>
624 [[nodiscard]]
consteval auto operator-(
const OtherUnitT& other)
const {
625 static_assert(detail::can_subtract<BaseUnit, OtherUnitT>,
"These units cannot be subtracted.");
638 template <unit OtherUnitT>
639 [[nodiscard]]
consteval auto operator*(
const OtherUnitT& other)
const {
640 static_assert(detail::can_multiply<BaseUnit, OtherUnitT>,
"These units cannot be multiplied.");
653 template <unit OtherUnitT>
654 [[nodiscard]]
consteval auto operator/(
const OtherUnitT& other)
const {
655 static_assert(detail::can_divide<BaseUnit, OtherUnitT>,
"These units cannot be divided.");
669template <unit UnitT1, unit UnitT2>
673 return UnitT1::DIMENSION == UnitT2::DIMENSION && UnitT1::MAGNITUDE == UnitT2::MAGNITUDE;
688[[nodiscard]]
consteval auto operator+(
const UnitT& a)
requires(!UnitT::MagnitudeType::IS_ABSOLUTE) {
705[[nodiscard]]
consteval auto operator-(
const UnitT& a)
requires(!UnitT::MagnitudeType::IS_ABSOLUTE) {
722[[nodiscard]]
consteval auto operator+(
const UnitT& a,
const UnitT& b)
requires(!UnitT::MagnitudeType::IS_ABSOLUTE) {
740[[nodiscard]]
consteval auto operator-(
const UnitT& a,
const UnitT& b)
requires(!UnitT::MagnitudeType::IS_ABSOLUTE) {
758template <unit UnitT1, unit UnitlessT2>
759[[nodiscard]]
consteval auto operator*(
const UnitT1& a,
const UnitlessT2& b)
760 requires(UnitlessT2::DIMENSION ==
DIMENSIONLESS && UnitlessT2::MagnitudeType::VALUE == 1.0l && !UnitlessT2::MagnitudeType::IS_ABSOLUTE) {
778template <unit UnitlessT1, unit UnitT2>
779[[nodiscard]]
consteval auto operator*(
const UnitlessT1& a,
const UnitT2& b)
780 requires(UnitlessT1::DIMENSION ==
DIMENSIONLESS && UnitlessT1::MagnitudeType::VALUE == 1.0l && !UnitlessT1::MagnitudeType::IS_ABSOLUTE) {
798template <unit UnitT1, unit UnitlessT2>
799[[nodiscard]]
consteval auto operator/(
const UnitT1& a,
const UnitlessT2& b)
800 requires(UnitlessT2::DIMENSION ==
DIMENSIONLESS && UnitlessT2::MagnitudeType::VALUE == 1.0l && !UnitlessT2::MagnitudeType::IS_ABSOLUTE) {
808struct in_base_units {
809 using type = BaseUnit<UnitT::DIMENSION, UnitT::MAGNITUDE>;
829template <
typename UnitT1,
typename... UnitTs>
830requires(detail::can_add<UnitT1, UnitTs...>)
using BaseSum =
BaseUnit<(UnitT1::DIMENSION + ... + UnitTs::DIMENSION), (UnitT1::MAGNITUDE + ... + UnitTs::MAGNITUDE)>;
839template <
typename UnitT1,
typename... UnitTs>
849template <
typename UnitT1,
typename UnitT2>
850requires(detail::can_subtract<UnitT1, UnitT2>)
using BaseDifference =
BaseUnit<(UnitT1::DIMENSION - UnitT2::DIMENSION), (UnitT1::MAGNITUDE - UnitT2::MAGNITUDE)>;
859template <
typename UnitT1,
typename UnitT2>
869template <
typename UnitT1,
typename... UnitTs>
870requires(detail::can_multiply<UnitT1, UnitTs...>)
using BaseProduct =
BaseUnit<(UnitT1::DIMENSION * ... * UnitTs::DIMENSION), (UnitT1::MAGNITUDE * ... * UnitTs::MAGNITUDE)>;
879template <
typename UnitT1,
typename... UnitTs>
888template <
typename UnitT1,
typename UnitT2>
889requires(detail::can_divide<UnitT1, UnitT2>)
using BaseQuotient =
BaseUnit<(UnitT1::DIMENSION / UnitT2::DIMENSION), (UnitT1::MAGNITUDE / UnitT2::MAGNITUDE)>;
898template <
typename UnitT1,
typename UnitT2>
908template <
typename UnitT,
long double Multiple>
918template <
typename UnitT,
long double Multiple>
931template <
long double Multiple, unit UnitT>
943template <
typename UnitT>
952template <
typename UnitT>
975template <
typename UnitT>
984template <
typename UnitT>
1004template <Dimension D, Magnitude M>
1005requires(
decltype(M)::IS_ABSOLUTE)
struct canonical_unit<BaseUnit<D, M>> {
1006 using type = Absolute<Relative<BaseUnit<D, M>>>;
1018template <unit UnitT>
1030template <
typename UnitT>
1039template <
typename UnitT>
1050template <unit UnitT>
1051[[nodiscard]]
consteval auto sqrt(UnitT a) {
1062template <
typename UnitT>
1071template <
typename UnitT>
1082template <unit UnitT>
1083[[nodiscard]]
consteval auto per(UnitT a) {
1093template <
typename UnitT>
1101template <
typename UnitT>
1111template <unit UnitT>
1112[[nodiscard]]
consteval auto square(UnitT a) {
1123template <
typename UnitT>
1132template <
typename UnitT>
1143template <unit UnitT>
1144[[nodiscard]]
consteval auto cubic(UnitT a) {
1155template <
typename UnitT>
1164template <
typename UnitT>
1175template <unit UnitT>
1176[[nodiscard]]
consteval auto kilo(UnitT a) {
1187template <
typename UnitT>
1196template <
typename UnitT>
1207template <unit UnitT>
1208[[nodiscard]]
consteval auto deci(UnitT a) {
1219template <
typename UnitT>
1228template <
typename UnitT>
1239template <unit UnitT>
1240[[nodiscard]]
consteval auto centi(UnitT a) {
1251template <
typename UnitT>
1260template <
typename UnitT>
1271template <unit UnitT>
1272[[nodiscard]]
consteval auto milli(UnitT a) {
1282template <Dimension D>
1290template <Dimension D>
1298template <Dimension D>
1303#define GREM_PRIVATE_PHYSICS_DEFINE_UNIT(Name, UPPERCASE_NAME, symbol, ...) \
1304 struct Name : __VA_ARGS__ { \
1305 [[nodiscard]] static constexpr StringView getSymbolString() { \
1309 inline constexpr Name UPPERCASE_NAME{};
1311#define GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Name, UPPERCASE_NAME, symbol, ...) \
1312 GREM_PRIVATE_PHYSICS_DEFINE_UNIT(Name, UPPERCASE_NAME, symbol, __VA_ARGS__) \
1314 struct canonical_unit<in_base_units_t<__VA_ARGS__>> { \
1315 using type = Name; \
1323GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Kilograms, KILOGRAMS,
"kg",
BaseSIUnit<MASS>)
1326GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Kilometers, KILOMETERS,
"km",
BaseKilo<Meters>)
1327GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Decimeters, DECIMETERS,
"dm",
BaseDeci<Meters>)
1328GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Centimeters, CENTIMETERS,
"cm",
BaseCenti<Meters>)
1329GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Millimeters, MILLIMETERS,
"mm",
BaseMilli<Meters>)
1334GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(SquareMeters, SQUARE_METERS,
"m^2",
BaseSquare<Meters>)
1335GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(SquareKilometers, SQUARE_KILOMETERS,
"km^2",
BaseSquare<Kilometers>)
1336GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(SquareDecimeters, SQUARE_DECIMETERS,
"dm^2",
BaseSquare<Decimeters>)
1337GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(SquareCentimeters, SQUARE_CENTIMETERS,
"cm^2",
BaseSquare<Centimeters>)
1338GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(SquareMillimeters, SQUARE_MILLIMETERS,
"mm^2",
BaseSquare<Millimeters>)
1339GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(CubicMeters, CUBIC_METERS,
"m^3",
BaseCubic<Meters>)
1342GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(CubicMillimeters, CUBIC_MILLIMETERS,
"mm^3",
BaseCubic<Millimeters>)
1343GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Liters, LITERS,
"l", CubicDecimeters)
1344GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Deciliters, DECILITERS,
"dl",
BaseDeci<Liters>)
1345GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Centiliters, CENTILITERS,
"cl",
BaseCenti<Liters>)
1346GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Milliliters, MILLILITERS,
"ml", CubicCentimeters)
1355GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Hertz, HERTZ,
"Hz", PerSecond)
1363GREM_PRIVATE_PHYSICS_DEFINE_UNIT(KilogramMetersPerSecondSquared, KILOGRAM_METERS_PER_SECOND_SQUARED,
"kg m/s^2",
BaseProduct<Kilograms, MetersPerSecondSquared>)
1364GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Newton, NEWTON,
"N", KilogramMetersPerSecondSquared)
1365GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(KilogramMeters, KILOGRAM_METERS,
"kg m",
BaseProduct<Kilograms, Meters>)
1366GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(KilogramSquareMeters, KILOGRAM_SQUARE_METERS,
"kg m^2",
BaseProduct<Kilograms, SquareMeters>)
1367GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(PerKilogramSquareMeter, PER_KILOGRAM_SQUARE_METER,
"per kilogram square meter",
BaseReciprocal<KilogramSquareMeters>)
1368GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(NewtonMeters, NEWTON_METERS,
"N m",
BaseProduct<Newton, Meters>)
1369GREM_PRIVATE_PHYSICS_DEFINE_UNIT(KilogramSquareMetersPerSecondSquared, KILOGRAM_SQUARE_METERS_PER_SECOND_SQUARED,
"kg m^s/s^2",
1371GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(NewtonSeconds, NEWTON_SECONDS,
"N s",
BaseProduct<Newton,
Seconds>)
1372GREM_PRIVATE_PHYSICS_DEFINE_UNIT(KilogramMetersPerSecond, KILOGRAM_METERS_PER_SECOND,
"kg m/s",
BaseQuotient<KilogramMeters,
Seconds>)
1373GREM_PRIVATE_PHYSICS_DEFINE_UNIT(RadianSeconds, RADIAN_SECONDS,
"rad s",
BaseProduct<Radians,
Seconds>)
1374GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(DegreeSeconds, DEGREE_SECONDS,
"deg s",
BaseProduct<Degrees,
Seconds>)
1375GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(TurnSeconds, TURN_SECONDS,
"turns s",
BaseProduct<Turns,
Seconds>)
1376GREM_PRIVATE_PHYSICS_DEFINE_UNIT(RadiansPerSecond, RADIANS_PER_SECOND,
"rad/s",
BaseQuotient<Radians,
Seconds>)
1377GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(DegreesPerSecond, DEGREES_PER_SECOND,
"deg/s",
BaseQuotient<Degrees,
Seconds>)
1378GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(TurnsPerSecond, TURNS_PER_SECOND,
"turns/s",
BaseQuotient<Turns,
Seconds>)
1379GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(RevolutionsPerMinute, REVOLUTIONS_PER_MINUTE,
"RPM",
BaseQuotient<Turns,
Minutes>)
1380GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(RadiansPerSecondSquared, RADIANS_PER_SECOND_SQUARED,
"rad/s^2",
BaseQuotient<Radians,
BaseSquare<
Seconds>>)
1381GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(NewtonMeterSeconds, NEWTON_METER_SECONDS,
"N m s",
BaseProduct<Newton, Meters,
Seconds>)
1383GREM_PRIVATE_PHYSICS_DEFINE_UNIT(NewtonMeterSecondsPerRadian, NEWTON_METER_SECONDS_PER_RADIAN,
"N m s/rad",
BaseQuotient<
BaseProduct<Newton, Meters,
Seconds>, Radians>)
1384GREM_PRIVATE_PHYSICS_DEFINE_UNIT(KilogramSquareMetersPerSecond, KILOGRAM_SQUARE_METERS_PER_SECOND,
"kg m^s/s",
BaseQuotient<KilogramSquareMeters,
Seconds>)
1385GREM_PRIVATE_PHYSICS_DEFINE_UNIT(NewtonMeterSecondsSquared, NEWTON_METER_SECONDS_SQUARED,
"N m s^2",
BaseProduct<Newton, Meters,
BaseSquare<
Seconds>>)
1386GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(KilogramsPerSecond, KILOGRAMS_PER_SECOND,
"kg/s",
BaseQuotient<Kilograms,
Seconds>)
1387GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(CubicMetersPerSecond, CUBIC_METERS_PER_SECOND,
"m^3/s",
BaseQuotient<CubicMeters,
Seconds>)
1389GREM_PRIVATE_PHYSICS_DEFINE_UNIT(KilogramSquareMetersPerSecondCubed, KILOGRAM_SQUARE_METERS_PER_SECOND_CUBED,
"kg m^2/s^3",
BaseQuotient<KilogramSquareMeters,
Cubic<
Seconds>>)
1390GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Kilowatts, KILOWATTS,
"kW",
BaseMultipleOf<Watts, 1000.0l>)
1391GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Megawatts, MEGAWATTS,
"MW",
BaseMultipleOf<Watts, 1000000.0l>)
1393GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Kilojoules, KILOJOULES,
"kJ",
BaseMultipleOf<Joules, 1000.0l>)
1394GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(Megajoules, MEGAJOULES,
"MJ",
BaseMultipleOf<Joules, 1000000.0l>)
1395GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(KilowattHours, KILOWATT_HOURS,
"kW h",
BaseProduct<Kilowatts,
Hours>)
1396GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(MegawattHours, MEGAWATT_HOURS,
"MW h",
BaseProduct<Megawatts,
Hours>)
1397GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(NewtonPerMeter, NEWTON_PER_METER,
"N/m",
BaseQuotient<Newton, Meters>);
1398GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(NewtonPerMillimeter, NEWTON_PER_MILLIMETER,
"N/mm",
BaseQuotient<Newton, Millimeters>);
1399GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(MetersPerNewton, METERS_PER_NEWTON,
"m/N",
BaseQuotient<Meters, Newton>);
1400GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT(MillimetersPerNewton, MILLIMETERS_PER_NEWTON,
"mm/N",
BaseQuotient<Millimeters, Newton>);
1402#undef GREM_PRIVATE_PHYSICS_DEFINE_UNIT
1403#undef GREM_PRIVATE_PHYSICS_DEFINE_CANONICAL_UNIT
1405static_assert(
sqrt(SQUARE_METERS) == METERS);
1406static_assert(
sqrt(
square(SQUARE_METERS)) == SQUARE_METERS);
1426 if (!(value == 0.0f)) {
1439 if (!(value == 0.0)) {
1469 if (value !=
nullptr) {
1475#ifdef GREM_PHYSICS_USE_DOUBLE_PRECISION
1488template <
size_t Index>
1503template <
size_t N,
typename UnitT>
1513template <
size_t N,
typename UnitT>
1514requires(N == 2 || N == 3)
1517template <
typename UnitT>
1534 template <
typename OtherUnitT>
1536 return Quantity{other._private_value};
1545 [[nodiscard]]
constexpr Scalar _private_getUnderlyingValue()
const {
1546 return _private_value;
1559 : _private_value(static_cast<
Scalar>(value)) {}
1561 template <unit OtherUnitT>
1564 (OtherUnitT::MagnitudeType::IS_ABSOLUTE == MagnitudeType::IS_ABSOLUTE || !OtherUnitT::MagnitudeType::IS_ABSOLUTE))
1567 template <
typename Rep,
typename Period>
1572 _private_value =
Scalar{};
1577 return _private_value == other._private_value;
1580 template <
typename OtherUnitT>
1582 return _private_value == other._private_value;
1586 return _private_value <=> other._private_value;
1589 template <
typename OtherUnitT>
1591 return _private_value <=> other._private_value;
1594 template <arithmetic Arithmetic>
1596 return _private_value ==
static_cast<Scalar>(other);
1599 template <arithmetic Arithmetic>
1601 return _private_value <=>
static_cast<Scalar>(other);
1612 template <
typename Rep,
typename Period>
1617 return Duration{*
this} == duration_cast<Duration>(other);
1621 template <
typename Rep,
typename Period>
1626 return Duration{*
this} <=> duration_cast<Duration>(other);
1631 return static_cast<float>(_private_value);
1635 return static_cast<double>(_private_value);
1650 template <unit OtherUnitT>
1652 if constexpr (OtherUnitT::MagnitudeType::VALUE == MagnitudeType::VALUE) {
1655 constexpr Scalar factor =
static_cast<Scalar>(MagnitudeType::VALUE / OtherUnitT::MagnitudeType::VALUE);
1656 return _private_getUnderlyingValue() * factor;
1660 template <unit OtherUnitT>
1662 requires(OtherUnitT::DIMENSION ==
DIMENSION && (OtherUnitT::MagnitudeType::IS_ABSOLUTE == MagnitudeType::IS_ABSOLUTE || OtherUnitT::MagnitudeType::IS_ABSOLUTE)) {
1679 template <
size_t OtherN,
typename OtherUnitT>
1683 : _private_value(static_cast<
Scalar>(value)) {}
1686 : _private_value(static_cast<
Scalar>(value)) {}
1689template <
typename UnitT>
1692template <
typename UnitT>
1695template <
typename UnitT>
1698template <
typename UnitT>
1701template <
typename UnitT>
1704template <
typename UnitT>
1707template <
typename UnitT>
1718template <
size_t N,
typename UnitT,
size_t Index>
1721 static_assert(N == 2 || N == 3);
1722 static_assert(Index < N);
1740 return static_cast<float>(
getValue());
1744 return static_cast<double>(
getValue());
1759 template <
size_t OtherN,
typename OtherUnitT,
size_t OtherIndex>
1761 return getValue() == Quantity<1, OtherUnitT>{other};
1764 template <
size_t OtherN,
typename OtherUnitT,
size_t OtherIndex>
1766 return getValue() <=> Quantity<1, OtherUnitT>{other};
1769 template <
typename OtherUnitT>
1774 template <
typename OtherUnitT>
1779 template <arithmetic Arithmetic>
1784 template <arithmetic Arithmetic>
1798 template <
typename Rep,
typename Period>
1800 requires(UnitT::DIMENSION ==
TIME && !UnitT::MagnitudeType::IS_ABSOLUTE) {
1804 template <
typename Rep,
typename Period>
1806 requires(UnitT::DIMENSION ==
TIME && !UnitT::MagnitudeType::IS_ABSOLUTE) {
1810 template <unit OtherUnitT>
1815 template <unit OtherUnitT>
1817 requires(OtherUnitT::DIMENSION ==
DIMENSION && (OtherUnitT::MagnitudeType::IS_ABSOLUTE == MagnitudeType::IS_ABSOLUTE || OtherUnitT::MagnitudeType::IS_ABSOLUTE)) {
1837#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
1838 if constexpr (N == 3) {
1839 if constexpr (Index == 0) {
1861template <
size_t N,
typename UnitT,
size_t Index>
1870#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
1871 if constexpr (N == 3) {
1872 alignas(16)
float components[4];
1873 _mm_store_ps(components,
quantity->_private_value);
1874 components[Index] = value._private_value;
1875 if constexpr (Index == 2) {
1876 components[3] = value._private_value;
1878 quantity->_private_value = _mm_load_ps(components);
1880 quantity->_private_value[Index] = value._private_value;
1883 quantity->_private_value[Index] = value._private_value;
1889 Zero)
const noexcept {
1891#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
1892 if constexpr (N == 3) {
1893 alignas(16)
float components[4];
1894 _mm_store_ps(components,
quantity->_private_value);
1895 components[Index] = 0.0f;
1896 if constexpr (Index == 2) {
1897 components[3] = 0.0f;
1899 quantity->_private_value = _mm_load_ps(components);
1901 quantity->_private_value[Index] = 0.0f;
1909 template <unit OtherUnitT>
1911 static_assert(OtherUnitT::DIMENSION == UnitT::DIMENSION && OtherUnitT::MagnitudeType::VALUE == UnitT::MagnitudeType::VALUE && !OtherUnitT::MagnitudeType::IS_ABSOLUTE,
1912 "Quantity of this unit cannot be added.");
1914#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
1915 if constexpr (N == 3) {
1916 alignas(16)
float components[4];
1917 _mm_store_ps(components,
quantity->_private_value);
1918 components[Index] += value._private_value;
1919 if constexpr (Index == 2) {
1920 components[3] += value._private_value;
1922 quantity->_private_value = _mm_load_ps(components);
1924 quantity->_private_value[Index] += value._private_value;
1927 quantity->_private_value[Index] += value._private_value;
1932 template <unit OtherUnitT>
1934 static_assert(OtherUnitT::DIMENSION == UnitT::DIMENSION && OtherUnitT::MagnitudeType::VALUE == UnitT::MagnitudeType::VALUE && !OtherUnitT::MagnitudeType::IS_ABSOLUTE,
1935 "Quantity of this unit cannot be subtracted.");
1937#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
1938 if constexpr (N == 3) {
1939 alignas(16)
float components[4];
1940 _mm_store_ps(components,
quantity->_private_value);
1941 components[Index] -= value._private_value;
1942 if constexpr (Index == 2) {
1943 components[3] -= value._private_value;
1945 quantity->_private_value = _mm_load_ps(components);
1947 quantity->_private_value[Index] -= value._private_value;
1950 quantity->_private_value[Index] -= value._private_value;
1957#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
1958 if constexpr (N == 3) {
1959 alignas(16)
float components[4];
1960 _mm_store_ps(components,
quantity->_private_value);
1961 components[Index] *= value;
1962 if constexpr (Index == 2) {
1963 components[3] *= value;
1965 quantity->_private_value = _mm_load_ps(components);
1967 quantity->_private_value[Index] *= value;
1970 quantity->_private_value[Index] *= value;
1977#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
1978 if constexpr (N == 3) {
1979 alignas(16)
float components[4];
1980 _mm_store_ps(components,
quantity->_private_value);
1981 components[Index] /= value;
1982 if constexpr (Index == 2) {
1983 components[3] /= value;
1985 quantity->_private_value = _mm_load_ps(components);
1987 quantity->_private_value[Index] /= value;
1990 quantity->_private_value[Index] /= value;
1996template <
typename UnitT>
2014 template <
typename OtherUnitT>
2016 return Quantity{other._private_value};
2029 [[nodiscard]]
constexpr vec<2, Scalar> _private_getUnderlyingValue()
const {
2030 return _private_value;
2046 : _private_value{x._private_value, y._private_value} {}
2062 template <unit OtherUnitT>
2065 (OtherUnitT::MagnitudeType::IS_ABSOLUTE == MagnitudeType::IS_ABSOLUTE || !OtherUnitT::MagnitudeType::IS_ABSOLUTE))
2069 _private_value = {};
2074 return _private_value == other._private_value;
2077 template <
typename OtherUnitT>
2079 return _private_value == other._private_value;
2086 template <
size_t Index>
2088 (*this)[Swizzle] = value;
2091 template <
size_t Index>
2093 (*this)[Swizzle] = 0;
2112 template <
size_t Index>
2114 return (*
this)[Swizzle];
2121 template <
size_t IndexX,
size_t IndexY>
2123 return {
get(SwizzleX),
get(SwizzleY)};
2126 template <
size_t IndexX>
2128 return {
get(SwizzleX), 0};
2131 template <
size_t IndexY>
2133 return {0,
get(SwizzleY)};
2140 template <
size_t IndexX,
size_t IndexY,
size_t IndexZ>
2143 return {
get(SwizzleX),
get(SwizzleY),
get(SwizzleZ)};
2146 template <
size_t IndexX,
size_t IndexY>
2148 return {
get(SwizzleX, SwizzleY), 0};
2151 template <
size_t IndexX,
size_t IndexZ>
2153 return {
get(SwizzleX), 0,
get(SwizzleZ)};
2156 template <
size_t IndexY,
size_t IndexZ>
2158 return {0,
get(SwizzleY),
get(SwizzleZ)};
2161 template <
size_t IndexX>
2163 return {
get(SwizzleX), 0, 0};
2166 template <
size_t IndexY>
2168 return {0,
get(SwizzleY), 0};
2171 template <
size_t IndexZ>
2173 return {0, 0,
get(SwizzleZ)};
2188 template <
size_t Index>
2190 static_assert(Index <
RANK,
"Swizzle component index out of range.");
2194 template <
size_t Index>
2196 static_assert(Index <
RANK,
"Swizzle component index out of range.");
2200 template <
size_t Index>
2202 static_assert(Index <
RANK,
"Swizzle component index out of range.");
2206 template <
size_t Index>
2208 static_assert(Index <
RANK,
"Swizzle component index out of range.");
2220 template <unit OtherUnitT>
2222 if constexpr (OtherUnitT::MagnitudeType::VALUE == MagnitudeType::VALUE) {
2225 constexpr Scalar factor =
static_cast<Scalar>(MagnitudeType::VALUE / OtherUnitT::MagnitudeType::VALUE);
2226 return _private_getUnderlyingValue() * factor;
2230 template <unit OtherUnitT>
2232 requires(OtherUnitT::DIMENSION ==
DIMENSION && (OtherUnitT::MagnitudeType::IS_ABSOLUTE == MagnitudeType::IS_ABSOLUTE || OtherUnitT::MagnitudeType::IS_ABSOLUTE)) {
2243 return static_cast<size_t>(y < x);
2249 return static_cast<size_t>(y > x);
2253 template <
size_t OtherN,
typename OtherUnitT>
2256 template <
size_t OtherN,
typename OtherUnitT,
size_t Index>
2259 template <
size_t OtherN,
typename OtherUnitT,
size_t Index>
2263 : _private_value(value) {}
2266 : _private_value(value) {}
2269template <
typename UnitT>
2272template <
typename UnitT>
2275template <
typename UnitT>
2278template <
typename UnitT>
2281template <
typename UnitT>
2284template <
typename UnitT>
2287template <
typename UnitT>
2290template <
typename UnitT>
2292#ifndef GREM_PHYSICS_USE_DOUBLE_PRECISION
2313 template <
typename OtherUnitT>
2315 return Quantity{other._private_value};
2326#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2331 __m128 _private_value{};
2333 vec<3, Scalar> _private_value{};
2336 [[nodiscard]]
constexpr vec<3, Scalar> _private_getUnderlyingValue()
const {
2337#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2338 alignas(16)
float components[4]{};
2339 _mm_store_ps(components, _private_value);
2340 return {components[0], components[1], components[2]};
2342 return _private_value;
2359#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2360 : _private_value{x._private_value, y._private_value, z._private_value, z._private_value}
2362 : _private_value{x._private_value, y._private_value, z._private_value}
2394 template <unit OtherUnitT>
2397 (OtherUnitT::MagnitudeType::IS_ABSOLUTE == MagnitudeType::IS_ABSOLUTE || !OtherUnitT::MagnitudeType::IS_ABSOLUTE))
2413#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2414 _private_value = __m128{};
2416 _private_value = {};
2422#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2423 return (_mm_movemask_ps(_mm_cmpeq_ps(_private_value, other._private_value)) & 0b111) == 0b111;
2425 return _private_value == other._private_value;
2429 template <
typename OtherUnitT>
2431#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2432 return (_mm_movemask_ps(_mm_cmpeq_ps(_private_value, other._private_value)) & 0b111) == 0b111;
2434 return _private_value == other._private_value;
2442 template <
size_t Index>
2444 (*this)[Swizzle] = value;
2447 template <
size_t Index>
2476 template <
size_t Index>
2478 return (*
this)[Swizzle];
2485 template <
size_t IndexX,
size_t IndexY>
2487 return {
get(SwizzleX),
get(SwizzleY)};
2490 template <
size_t IndexX>
2492 return {
get(SwizzleX), 0};
2495 template <
size_t IndexY>
2497 return {0,
get(SwizzleY)};
2504 template <
size_t IndexX,
size_t IndexY,
size_t IndexZ>
2507#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2510 return {
get(SwizzleX),
get(SwizzleY),
get(SwizzleZ)};
2514 template <
size_t IndexX,
size_t IndexY>
2516 return {
get(SwizzleX, SwizzleY), 0};
2519 template <
size_t IndexX,
size_t IndexZ>
2521 return {
get(SwizzleX), 0,
get(SwizzleZ)};
2524 template <
size_t IndexY,
size_t IndexZ>
2526 return {0,
get(SwizzleY),
get(SwizzleZ)};
2529 template <
size_t IndexX>
2531 return {
get(SwizzleX), 0, 0};
2534 template <
size_t IndexY>
2536 return {0,
get(SwizzleY), 0};
2539 template <
size_t IndexZ>
2541 return {0, 0,
get(SwizzleZ)};
2560 template <
size_t Index>
2562 static_assert(Index <
RANK,
"Swizzle component index out of range.");
2566 template <
size_t Index>
2568 static_assert(Index <
RANK,
"Swizzle component index out of range.");
2572 template <
size_t Index>
2574 static_assert(Index <
RANK,
"Swizzle component index out of range.");
2578 template <
size_t Index>
2580 static_assert(Index <
RANK,
"Swizzle component index out of range.");
2592 template <unit OtherUnitT>
2594 if constexpr (OtherUnitT::MagnitudeType::VALUE == MagnitudeType::VALUE) {
2597 constexpr Scalar factor =
static_cast<Scalar>(MagnitudeType::VALUE / OtherUnitT::MagnitudeType::VALUE);
2598 return _private_getUnderlyingValue() * factor;
2602 template <unit OtherUnitT>
2604 requires(OtherUnitT::DIMENSION ==
DIMENSION && (OtherUnitT::MagnitudeType::IS_ABSOLUTE == MagnitudeType::IS_ABSOLUTE || OtherUnitT::MagnitudeType::IS_ABSOLUTE)) {
2643 template <
size_t OtherN,
typename OtherUnitT>
2646 template <
size_t OtherN,
typename OtherUnitT,
size_t Index>
2649 template <
size_t OtherN,
typename OtherUnitT,
size_t Index>
2652#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2654 : _private_value(value) {}
2657 : _private_value{static_cast<
Scalar>(value.x), static_cast<
Scalar>(value.y), static_cast<
Scalar>(value.z), static_cast<
Scalar>(value.z)} {}
2660 : _private_value{static_cast<
Scalar>(value.x), static_cast<
Scalar>(value.y), static_cast<
Scalar>(value.z), static_cast<
Scalar>(value.z)} {}
2663 : _private_value(value) {}
2666 : _private_value(value) {}
2670template <
typename UnitT>
2673template <
typename UnitT>
2676template <
typename UnitT>
2679template <
typename UnitT>
2682template <
typename UnitT>
2685template <
typename UnitT>
2688template <
typename UnitT>
2693template <
size_t N,
typename T>
2694consteval void derivedFromQuantityTest(
const Quantity<N, T>&);
2696template <
typename T>
2697concept derived_from_quantity =
requires(
const T t) { derivedFromQuantityTest(t); };
2699template <
size_t N,
typename UnitT>
2704template <
size_t N,
typename UnitT,
size_t Index>
2709template <
size_t N,
typename UnitT,
size_t Index>
2734template <
typename Rep,
typename Period>
2736 return Quantity<1, MultipleOf<Seconds, static_cast<long double>(Period::num) /
static_cast<long double>(Period::den)>>{value};
2743template <
typename T>
2744concept quantity_convertible =
requires(
const T t) { toQuantity(t); };
2746template <
typename T>
2747inline constexpr size_t quantity_rank_v =
decltype(toQuantity(std::declval<T>()))::RANK;
2749template <
typename T>
2750using unit_type_t =
typename decltype(toQuantity(std::declval<T>()))::Unit;
2752template <
typename T>
2753struct is_quantity_or_component_proxy : std::bool_constant<derived_from_quantity<T>> {};
2755template <
size_t N,
typename UnitT,
size_t Index>
2756struct is_quantity_or_component_proxy<ConstComponentProxy<
N, UnitT, Index>> : std::true_type {};
2758template <
size_t N,
typename UnitT,
size_t Index>
2759struct is_quantity_or_component_proxy<ComponentProxy<
N, UnitT, Index>> : std::true_type {};
2761template <
typename T>
2762inline constexpr bool is_quantity_or_component_proxy_v = is_quantity_or_component_proxy<T>::value;
2764template <
typename T>
2765concept quantity_unary_operand = is_quantity_or_component_proxy_v<std::remove_cvref_t<T>>;
2767template <
typename T>
2768concept quantity_binary_operand_a = quantity_convertible<T>;
2770template <
typename T,
typename A>
2771concept quantity_binary_operand_b = quantity_unary_operand<T> || (quantity_unary_operand<A> && quantity_convertible<T>);
2773template <
typename T>
2774concept quantity_ternary_operand_a = quantity_convertible<T>;
2776template <
typename T,
typename A>
2777concept quantity_ternary_operand_b = quantity_convertible<T>;
2779template <
typename T,
typename A,
typename B>
2780concept quantity_ternary_operand_c = quantity_unary_operand<T> || ((quantity_unary_operand<A> || quantity_unary_operand<B>) && quantity_convertible<T>);
2792using Mask = std::conditional_t<N == 1, bool, vec<N, bool>>;
2814template <
size_t N,
typename UnitT, unit OtherUnitT>
2819template <unit OtherUnitT>
2821 return detail::toQuantity(value) *
unit;
2824template <unit OtherUnitT,
size_t N,
typename UnitT>
2829template <unit OtherUnitT>
2831 return unit * detail::toQuantity(value);
2834template <
size_t N,
typename UnitT, unit OtherUnitT>
2839template <unit OtherUnitT>
2841 return detail::toQuantity(value) /
unit;
2844template <unit OtherUnitT,
size_t N,
typename UnitT>
2849template <unit OtherUnitT>
2851 return unit / detail::toQuantity(value);
2854template <detail::quantity_unary_operand A>
2856 constexpr size_t N = detail::quantity_rank_v<A>;
2857 using UnitT = detail::unit_type_t<A>;
2861template <detail::quantity_unary_operand A>
2863 constexpr size_t N = detail::quantity_rank_v<A>;
2864 using UnitT = detail::unit_type_t<A>;
2865 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be negated because it represents an absolute position.");
2866#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2867 if constexpr (N == 3) {
2877template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
2879 constexpr size_t N1 = detail::quantity_rank_v<A>;
2880 constexpr size_t N2 = detail::quantity_rank_v<B>;
2881 using UnitT1 = detail::unit_type_t<A>;
2882 using UnitT2 = detail::unit_type_t<B>;
2883 static_assert(detail::can_add<UnitT1, UnitT2>,
"Quantities of these units cannot be added.");
2884#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2885 if constexpr (N1 == 3 && N2 == 3) {
2889 detail::toQuantity(a)._private_getUnderlyingValue() + detail::toQuantity(b)._private_getUnderlyingValue());
2896template <
size_t N,
typename UnitT>
2901template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
2903 constexpr size_t N1 = detail::quantity_rank_v<A>;
2904 constexpr size_t N2 = detail::quantity_rank_v<B>;
2905 using UnitT1 = detail::unit_type_t<A>;
2906 using UnitT2 = detail::unit_type_t<B>;
2907 static_assert(detail::can_subtract<UnitT1, UnitT2>,
"Quantities of these units cannot be subtracted.");
2908#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2909 if constexpr (N1 == 3 && N2 == 3) {
2913 detail::toQuantity(a)._private_getUnderlyingValue() - detail::toQuantity(b)._private_getUnderlyingValue());
2920template <
size_t N,
typename UnitT>
2925template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
2927 constexpr size_t N1 = detail::quantity_rank_v<A>;
2928 constexpr size_t N2 = detail::quantity_rank_v<B>;
2929 using UnitT1 = detail::unit_type_t<A>;
2930 using UnitT2 = detail::unit_type_t<B>;
2931 static_assert(detail::can_multiply<UnitT1, UnitT2>,
"Quantities of these units cannot be multiplied.");
2932#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2933 if constexpr (N1 == 3 && N2 == 3) {
2935 }
else if constexpr (N1 == 1 && N2 == 3) {
2937 }
else if constexpr (N1 == 3 && N2 == 1) {
2941 detail::toQuantity(a)._private_getUnderlyingValue() * detail::toQuantity(b)._private_getUnderlyingValue());
2948template <
size_t N,
typename UnitT>
2950 return a = a * detail::toQuantity(b);
2953template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
2955 constexpr size_t N1 = detail::quantity_rank_v<A>;
2956 constexpr size_t N2 = detail::quantity_rank_v<B>;
2957 using UnitT1 = detail::unit_type_t<A>;
2958 using UnitT2 = detail::unit_type_t<B>;
2959 static_assert(detail::can_divide<UnitT1, UnitT2>,
"Quantities of these units cannot be divided.");
2960#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2961 if constexpr (N1 == 3 && N2 == 3) {
2963 }
else if constexpr (N1 == 1 && N2 == 3) {
2965 }
else if constexpr (N1 == 3 && N2 == 1) {
2969 detail::toQuantity(a)._private_getUnderlyingValue() / detail::toQuantity(b)._private_getUnderlyingValue());
2976template <
size_t N,
typename UnitT>
2978 return a = a / detail::toQuantity(b);
2981template <
size_t N1,
typename UnitT1,
size_t N2,
typename UnitT2>
2983 static_assert(UnitT1{} == UnitT2{},
"Quantities of different units cannot be selected between.");
2984#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
2985 if constexpr (N1 == 3 && N2 == 3) {
2987 }
else if constexpr (N1 == 1 && N2 == 3) {
2989 }
else if constexpr (N1 == 3 && N2 == 1) {
2993 grem::min(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue()));
2996 return Quantity<
grem::max(N1, N2), UnitT1>::reinterpret(
grem::min(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value));
3000template <
size_t N1,
typename UnitT1,
size_t N2,
typename UnitT2>
3002 static_assert(UnitT1{} == UnitT2{},
"Quantities of different units cannot be selected between.");
3003#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3004 if constexpr (N1 == 3 && N2 == 3) {
3006 }
else if constexpr (N1 == 1 && N2 == 3) {
3008 }
else if constexpr (N1 == 3 && N2 == 1) {
3012 grem::max(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue()));
3015 return Quantity<
grem::max(N1, N2), UnitT1>::reinterpret(
grem::max(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value));
3019template <
size_t N1,
typename UnitT1,
size_t N2,
typename UnitT2,
size_t N3,
typename UnitT3>
3021 return min(
max(a, b), c);
3024template <detail::quantity_unary_operand A>
3026 constexpr size_t N = detail::quantity_rank_v<A>;
3027 using UnitT = detail::unit_type_t<A>;
3028 static_assert(!detail::unit_type_t<A>::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be added to itself because it represents an absolute position.");
3029 if constexpr (N == 1) {
3030 return detail::toQuantity(a);
3032#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3033 if constexpr (N == 3) {
3034 constexpr float32_t ZEROS = bit_cast<float32_t>(uint32_t{0});
3035 constexpr float32_t ONES = bit_cast<float32_t>(uint32_t{0xFFFFFFFF});
3037 const auto q = detail::toQuantity(a);
3038 const __m128 y_x_z_z = _mm_shuffle_ps(q._private_value, q._private_value, _MM_SHUFFLE(2, 2, 0, 1));
3039 const __m128 y_x_0_0 = _mm_and_ps(y_x_z_z, _mm_set_ps(ZEROS, ZEROS, ONES, ONES));
3040 const __m128 xy_xy_z_z = _mm_add_ps(q._private_value, y_x_0_0);
3041 const __m128 z_z_0_0 = _mm_movehl_ps(y_x_0_0, xy_xy_z_z);
3042 const __m128 xyz_xy_z_z = _mm_add_ss(xy_xy_z_z, z_z_0_0);
3053template <detail::quantity_unary_operand A>
3055 constexpr size_t N = detail::quantity_rank_v<A>;
3056 using UnitT = detail::unit_type_t<A>;
3057 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be multiplied by itself because it represents an absolute position.");
3058 if constexpr (N == 1) {
3059 return detail::toQuantity(a);
3060 }
else if constexpr (N == 2) {
3062 }
else if constexpr (N == 3) {
3063#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3064 if constexpr (N == 3) {
3065 const auto q = detail::toQuantity(a);
3066 const __m128 y_x_z_z = _mm_shuffle_ps(q._private_value, q._private_value, _MM_SHUFFLE(2, 2, 0, 1));
3067 const __m128 y_x_1_1 = _mm_movelh_ps(y_x_z_z, _mm_set1_ps(1.0f));
3068 const __m128 xy_xy_z_z = _mm_mul_ps(q._private_value, y_x_1_1);
3069 const __m128 z_z_1_1 = _mm_movehl_ps(y_x_1_1, xy_xy_z_z);
3070 const __m128 xyz_xy_z_z = _mm_mul_ss(xy_xy_z_z, z_z_1_1);
3081template <detail::quantity_unary_operand A>
3083 constexpr size_t N = detail::quantity_rank_v<A>;
3084 using UnitT = detail::unit_type_t<A>;
3085 if constexpr (N == 1) {
3086 return detail::toQuantity(a);
3088#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3089 if constexpr (N == 3) {
3090 const auto q = detail::toQuantity(a);
3091 const auto minOfXY =
min(q, q.get(
Y,
Z,
Z));
3092 return min(minOfXY, q.get(
Z,
Z,
Z)).getX();
3102template <detail::quantity_unary_operand A>
3104 constexpr size_t N = detail::quantity_rank_v<A>;
3105 using UnitT = detail::unit_type_t<A>;
3106 if constexpr (N == 1) {
3107 return detail::toQuantity(a);
3109#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3110 if constexpr (N == 3) {
3111 const auto q = detail::toQuantity(a);
3112 const auto maxOfXY =
max(q, q.get(
Y,
Z,
Z));
3113 return max(maxOfXY, q.get(
Z,
Z,
Z)).getX();
3123template <detail::quantity_unary_operand A>
3125 return grem::isfinite(detail::toQuantity(a)._private_getUnderlyingValue());
3128template <detail::quantity_unary_operand A>
3130 return grem::isinf(detail::toQuantity(a)._private_getUnderlyingValue());
3133template <detail::quantity_unary_operand A>
3135#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3136 constexpr size_t N = detail::quantity_rank_v<A>;
3137 if constexpr (N == 3) {
3138 const auto q = detail::toQuantity(a);
3139 const int mask = _mm_movemask_ps(_mm_cmpunord_ps(q._private_value, q._private_value));
3140 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3142 return grem::isnan(detail::toQuantity(a)._private_value);
3145 return grem::isnan(detail::toQuantity(a)._private_value);
3149template <detail::quantity_unary_operand A>
3151#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3152 constexpr size_t N = detail::quantity_rank_v<A>;
3153 if constexpr (N == 3) {
3154 const int mask = _mm_movemask_ps(detail::toQuantity(a)._private_value);
3155 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3164template <detail::quantity_unary_operand A>
3166 constexpr size_t N = detail::quantity_rank_v<A>;
3167#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3168 if constexpr (N == 3) {
3178template <detail::quantity_unary_operand A>
3180 constexpr size_t N = detail::quantity_rank_v<A>;
3181 static_assert(detail::unit_type_t<A>{} == UNITLESS,
"Quantities that are not unitless cannot be used as an exponent.");
3185template <detail::quantity_unary_operand A>
3187 constexpr size_t N = detail::quantity_rank_v<A>;
3188 static_assert(detail::unit_type_t<A>{} == UNITLESS,
"Quantities that are not unitless cannot be used as an exponent.");
3192template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3194 constexpr size_t N = detail::quantity_rank_v<A>;
3195 static_assert(detail::unit_type_t<A>{} == UNITLESS,
"Quantities that are not unitless cannot be used as a base.");
3196 static_assert(detail::unit_type_t<B>{} == UNITLESS,
"Quantities that are not unitless cannot be used as an exponent.");
3200template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3202 constexpr size_t N = detail::quantity_rank_v<A>;
3203 using UnitT = detail::unit_type_t<A>;
3204 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot wrap each other.");
3208template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3210 constexpr size_t N = detail::quantity_rank_v<A>;
3211 using UnitT = detail::unit_type_t<A>;
3212 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot wrap each other.");
3216template <detail::quantity_unary_operand A>
3218 constexpr size_t N = detail::quantity_rank_v<A>;
3219 using UnitT = detail::unit_type_t<A>;
3220 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot have its absolute value taken because it represents an absolute position.");
3221#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3222 if constexpr (N == 3) {
3223 const auto q = detail::toQuantity(a);
3233template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3238template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3240 constexpr size_t N1 = detail::quantity_rank_v<A>;
3241 constexpr size_t N2 = detail::quantity_rank_v<B>;
3242 using UnitT1 = detail::unit_type_t<A>;
3243 using UnitT2 = detail::unit_type_t<B>;
3244 static_assert(detail::can_multiply<UnitT1, UnitT2>,
"Quantities of these units cannot be multiplied.");
3245 if constexpr (N1 == 1 && N2 == 1) {
3247 }
else if constexpr (N1 == 2 && N2 == 1) {
3248 const vec<2, Scalar> v = detail::toQuantity(a)._private_getUnderlyingValue();
3250 }
else if constexpr (N1 == 1 && N2 == 2) {
3251 const vec<2, Scalar> v = detail::toQuantity(b)._private_getUnderlyingValue();
3253 }
else if constexpr (N1 == 2 && N2 == 2) {
3255 grem::cross(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue()));
3256 }
else if constexpr (N1 == 3 && N2 == 3) {
3257#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3258 const auto qA = detail::toQuantity(a);
3259 const auto qB = detail::toQuantity(b);
3260 return (qB.get(
Y,
Z,
X) * qA - qA.get(
Y,
Z,
X) * qB).get(
Y,
Z,
X);
3266 grem::cross(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue()));
3270template <detail::quantity_unary_operand A>
3272 constexpr size_t N = detail::quantity_rank_v<A>;
3273 using UnitT = detail::unit_type_t<A>;
3274 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot have its square root taken because it represents an absolute position.");
3275#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3276 if constexpr (N == 3) {
3286template <detail::quantity_unary_operand A>
3288 constexpr size_t N = detail::quantity_rank_v<A>;
3289 using UnitT = detail::unit_type_t<A>;
3290 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot have its reciprocal square root taken because it represents an absolute position.");
3294template <detail::quantity_unary_operand A>
3296 using UnitT = detail::unit_type_t<A>;
3297 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot have its square length taken because it represents an absolute position.");
3301template <detail::quantity_unary_operand A>
3303 using UnitT = detail::unit_type_t<A>;
3304 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot have its length taken because it represents an absolute position.");
3308template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3310 using UnitT = detail::unit_type_t<A>;
3311 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of these units cannot have their distance measured.");
3315template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3317 using UnitT = detail::unit_type_t<A>;
3318 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of these units cannot have their squared distance measured.");
3322template <detail::quantity_unary_operand A>
3324 using UnitT = detail::unit_type_t<A>;
3325 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot have its angle taken because it represents an absolute position.");
3329template <detail::quantity_unary_operand A>
3331 using UnitT = detail::unit_type_t<A>;
3332 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot have its angle taken because it represents an absolute position.");
3333 if (
const auto result =
grem::tryGetAngle(detail::toQuantity(a)._private_getUnderlyingValue())) {
3339template <detail::quantity_unary_operand A>
3341 using UnitT = detail::unit_type_t<A>;
3342 static_assert(UnitT::DIMENSION ==
ANGLE,
"Quantity of this unit cannot have its cosine taken because it is not an angle.");
3346template <detail::quantity_unary_operand A>
3348 using UnitT = detail::unit_type_t<A>;
3349 static_assert(UnitT::DIMENSION ==
ANGLE,
"Quantity of this unit cannot have its cosine taken because it is not an angle.");
3353template <detail::quantity_unary_operand A>
3355 using UnitT = detail::unit_type_t<A>;
3356 static_assert(UnitT::DIMENSION ==
ANGLE,
"Quantity of this unit cannot have its cosine taken because it is not an angle.");
3360template <detail::quantity_unary_operand A>
3365template <detail::quantity_unary_operand A>
3370template <detail::quantity_unary_operand A>
3375template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3377 using UnitT = detail::unit_type_t<A>;
3378 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be passed to atan2.");
3379 return Quantity<1, Radians>::reinterpret(grem::atan2(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue()));
3382template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3384 using R =
decltype(a / b);
3385 using UnitT1 = detail::unit_type_t<A>;
3386 using UnitT2 = detail::unit_type_t<B>;
3387 static_assert(detail::can_divide<UnitT1, UnitT2>,
"Quantities of these units cannot be divided.");
3388 if (
const auto quotient =
grem::tryDivide(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue())) {
3394template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3396 constexpr size_t N = detail::quantity_rank_v<A>;
3397 using UnitT = detail::unit_type_t<A>;
3398 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be reflected because it represents an absolute position.");
3399 static_assert(detail::unit_type_t<B>{} == UNITLESS,
"Quantity of this unit cannot be reflected against.");
3403template <detail::quantity_ternary_operand_a A, detail::quantity_ternary_operand_b<A> B, detail::quantity_ternary_operand_c<A, B> C>
3405 constexpr size_t N = detail::quantity_rank_v<A>;
3406 using UnitT = detail::unit_type_t<A>;
3407 static_assert(detail::quantity_rank_v<B> == N,
"Quantities of different ranks cannot be interpolated.");
3408 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be interpolated.");
3409 static_assert(detail::unit_type_t<C>{} == UNITLESS,
"Alpha quantity must be unitless.");
3413template <detail::quantity_ternary_operand_a A, detail::quantity_ternary_operand_b<A> B, detail::quantity_ternary_operand_c<A, B> C>
3415 static_assert(detail::quantity_rank_v<A> == 1 && detail::quantity_rank_v<B> == 1 && detail::quantity_rank_v<C> == 1,
"Non-scalar quantities cannot be deinterpolated.");
3416 using UnitT = detail::unit_type_t<A>;
3417 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be deinterpolated.");
3418 static_assert(detail::unit_type_t<C>{} == UnitT{},
"Quantities of different units cannot be deinterpolated.");
3419 return (value - minValue) / (maxValue - minValue);
3422template <detail::quantity_ternary_operand_a A, detail::quantity_ternary_operand_b<A> B, detail::quantity_ternary_operand_c<A, B> C>
3424 return lerp(a, b, alpha);
3427template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3429 constexpr size_t N = detail::quantity_rank_v<A>;
3430 using UnitT = detail::unit_type_t<A>;
3431 static_assert(detail::quantity_rank_v<B> == N,
"Quantities of different ranks cannot be passed to step.");
3432 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be passed to step.");
3436template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3438 constexpr size_t N = detail::quantity_rank_v<A>;
3439 using UnitT = detail::unit_type_t<A>;
3440 static_assert(detail::quantity_rank_v<B> == N,
"Quantities of different ranks cannot be selected between.");
3441 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be selected between.");
3442 if constexpr (N == 1) {
3446#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3447 if constexpr (N == 3) {
3448 const bvec3 conditions{condition};
3449 const __m128 mask = _mm_castsi128_ps(_mm_sub_epi32(
3450 _mm_set_epi32(
static_cast<int>(conditions.z),
static_cast<int>(conditions.z),
static_cast<int>(conditions.y),
static_cast<int>(conditions.x)), _mm_set1_epi32(1)));
3452 _mm_or_ps(_mm_and_ps(mask, detail::toQuantity(ifFalse)._private_value), _mm_andnot_ps(mask, detail::toQuantity(ifTrue)._private_value)));
3462template <detail::quantity_ternary_operand_a A, detail::quantity_ternary_operand_b<A> B, detail::quantity_ternary_operand_c<A, B> C>
3464 constexpr size_t N = detail::quantity_rank_v<A>;
3465 using UnitT = detail::unit_type_t<A>;
3466 static_assert(detail::quantity_rank_v<B> == N,
"Cannot move towards a quantity of a different rank.");
3467 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Cannot move towards a quantity of a different unit.");
3468 static_assert(detail::quantity_rank_v<C> == 1,
"Cannot move by a non-scalar quantity.");
3469 using AmountUnitT = detail::unit_type_t<C>;
3470 static_assert(!AmountUnitT::MagnitudeType::IS_ABSOLUTE,
"Cannot move by an absolute unit.");
3471 static_assert(AmountUnitT{} ==
Relative<UnitT>{},
"Cannot move by a quantity of a different unit.");
3473 detail::toQuantity(amount)._private_getUnderlyingValue()));
3476template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B,
typename Frequency,
typename Duration>
3478 constexpr size_t N = detail::quantity_rank_v<A>;
3479 using UnitT = detail::unit_type_t<A>;
3480 static_assert(detail::quantity_rank_v<B> == N,
"Cannot decay towards a quantity of a different rank.");
3481 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Cannot decay towards a quantity of a different unit.");
3484 detail::toQuantity(decayRate)._private_getUnderlyingValue(), detail::toQuantity(deltaTime)._private_getUnderlyingValue()));
3487template <detail::quantity_unary_operand A,
typename Frequency,
typename Duration>
3489 constexpr size_t N = detail::quantity_rank_v<A>;
3490 using UnitT = detail::unit_type_t<A>;
3493 detail::toQuantity(deltaTime)._private_getUnderlyingValue()));
3496template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3498 constexpr size_t N = detail::quantity_rank_v<A>;
3499 using UnitT = detail::unit_type_t<A>;
3500 static_assert(detail::quantity_rank_v<B> == N,
"Cannot take the midpoint of two quantities of different ranks.");
3501 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Cannot take the midpoint of two quantities of different units.");
3505template <detail::quantity_unary_operand A>
3507 constexpr size_t N = detail::quantity_rank_v<A>;
3508 using UnitT = detail::unit_type_t<A>;
3512template <detail::quantity_unary_operand A>
3514 constexpr size_t N = detail::quantity_rank_v<A>;
3515 using UnitT = detail::unit_type_t<A>;
3519template <detail::quantity_unary_operand A>
3521 constexpr size_t N = detail::quantity_rank_v<A>;
3522 using UnitT = detail::unit_type_t<A>;
3526template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3528 using UnitT = detail::unit_type_t<A>;
3529 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be compared for equality.");
3530#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3531 constexpr size_t N1 = detail::quantity_rank_v<A>;
3532 constexpr size_t N2 = detail::quantity_rank_v<B>;
3533 if constexpr (N1 == 3 && N2 == 3) {
3534 const int mask = _mm_movemask_ps(_mm_cmpeq_ps(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value));
3535 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3536 }
else if constexpr (N1 == 1 && N2 == 3) {
3537 const int mask = _mm_movemask_ps(_mm_cmpeq_ps(_mm_set1_ps(detail::toQuantity(a)._private_value), detail::toQuantity(b)._private_value));
3538 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3539 }
else if constexpr (N1 == 3 && N2 == 1) {
3540 const int mask = _mm_movemask_ps(_mm_cmpeq_ps(detail::toQuantity(a)._private_value, _mm_set1_ps(detail::toQuantity(b)._private_value)));
3541 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3543 return grem::equal(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue());
3546 return grem::equal(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value);
3550template <detail::quantity_unary_operand A>
3552 return equal(a, A{});
3555template <detail::quantity_unary_operand B>
3557 return equal(B{}, b);
3560template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3562 using UnitT = detail::unit_type_t<A>;
3563 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be compared for inequality.");
3564#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3565 constexpr size_t N1 = detail::quantity_rank_v<A>;
3566 constexpr size_t N2 = detail::quantity_rank_v<B>;
3567 if constexpr (N1 == 3 && N2 == 3) {
3568 const int mask = _mm_movemask_ps(_mm_cmpne_ps(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value));
3569 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3570 }
else if constexpr (N1 == 1 && N2 == 3) {
3571 const int mask = _mm_movemask_ps(_mm_cmpne_ps(_mm_set1_ps(detail::toQuantity(a)._private_value), detail::toQuantity(b)._private_value));
3572 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3573 }
else if constexpr (N1 == 3 && N2 == 1) {
3574 const int mask = _mm_movemask_ps(_mm_cmpne_ps(detail::toQuantity(a)._private_value, _mm_set1_ps(detail::toQuantity(b)._private_value)));
3575 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3577 return grem::notEqual(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue());
3580 return grem::notEqual(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value);
3584template <detail::quantity_unary_operand A>
3589template <detail::quantity_unary_operand B>
3594template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3596 using UnitT = detail::unit_type_t<A>;
3597 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be compared.");
3598#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3599 constexpr size_t N1 = detail::quantity_rank_v<A>;
3600 constexpr size_t N2 = detail::quantity_rank_v<B>;
3601 if constexpr (N1 == 3 && N2 == 3) {
3602 const int mask = _mm_movemask_ps(_mm_cmplt_ps(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value));
3603 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3604 }
else if constexpr (N1 == 1 && N2 == 3) {
3605 const int mask = _mm_movemask_ps(_mm_cmplt_ps(_mm_set1_ps(detail::toQuantity(a)._private_value), detail::toQuantity(b)._private_value));
3606 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3607 }
else if constexpr (N1 == 3 && N2 == 1) {
3608 const int mask = _mm_movemask_ps(_mm_cmplt_ps(detail::toQuantity(a)._private_value, _mm_set1_ps(detail::toQuantity(b)._private_value)));
3609 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3611 return grem::lessThan(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue());
3614 return grem::lessThan(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value);
3618template <detail::quantity_unary_operand A>
3623template <detail::quantity_unary_operand B>
3628template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3630 using UnitT = detail::unit_type_t<A>;
3631 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be compared.");
3632#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3633 constexpr size_t N1 = detail::quantity_rank_v<A>;
3634 constexpr size_t N2 = detail::quantity_rank_v<B>;
3635 if constexpr (N1 == 3 && N2 == 3) {
3636 const int mask = _mm_movemask_ps(_mm_cmple_ps(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value));
3637 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3638 }
else if constexpr (N1 == 1 && N2 == 3) {
3639 const int mask = _mm_movemask_ps(_mm_cmple_ps(_mm_set1_ps(detail::toQuantity(a)._private_value), detail::toQuantity(b)._private_value));
3640 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3641 }
else if constexpr (N1 == 3 && N2 == 1) {
3642 const int mask = _mm_movemask_ps(_mm_cmple_ps(detail::toQuantity(a)._private_value, _mm_set1_ps(detail::toQuantity(b)._private_value)));
3643 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3645 return grem::lessThanEqual(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue());
3648 return grem::lessThanEqual(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value);
3652template <detail::quantity_unary_operand A>
3657template <detail::quantity_unary_operand B>
3662template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3664 using UnitT = detail::unit_type_t<A>;
3665 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be compared.");
3666#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3667 constexpr size_t N1 = detail::quantity_rank_v<A>;
3668 constexpr size_t N2 = detail::quantity_rank_v<B>;
3669 if constexpr (N1 == 3 && N2 == 3) {
3670 const int mask = _mm_movemask_ps(_mm_cmpgt_ps(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value));
3671 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3672 }
else if constexpr (N1 == 1 && N2 == 3) {
3673 const int mask = _mm_movemask_ps(_mm_cmpgt_ps(_mm_set1_ps(detail::toQuantity(a)._private_value), detail::toQuantity(b)._private_value));
3674 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3675 }
else if constexpr (N1 == 3 && N2 == 1) {
3676 const int mask = _mm_movemask_ps(_mm_cmpgt_ps(detail::toQuantity(a)._private_value, _mm_set1_ps(detail::toQuantity(b)._private_value)));
3677 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3679 return grem::greaterThan(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue());
3682 return grem::greaterThan(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value);
3686template <detail::quantity_unary_operand A>
3691template <detail::quantity_unary_operand B>
3696template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3698 using UnitT = detail::unit_type_t<A>;
3699 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be compared.");
3700#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
3701 constexpr size_t N1 = detail::quantity_rank_v<A>;
3702 constexpr size_t N2 = detail::quantity_rank_v<B>;
3703 if constexpr (N1 == 3 && N2 == 3) {
3704 const int mask = _mm_movemask_ps(_mm_cmpge_ps(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value));
3705 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3706 }
else if constexpr (N1 == 1 && N2 == 3) {
3707 const int mask = _mm_movemask_ps(_mm_cmpge_ps(_mm_set1_ps(detail::toQuantity(a)._private_value), detail::toQuantity(b)._private_value));
3708 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3709 }
else if constexpr (N1 == 3 && N2 == 1) {
3710 const int mask = _mm_movemask_ps(_mm_cmpge_ps(detail::toQuantity(a)._private_value, _mm_set1_ps(detail::toQuantity(b)._private_value)));
3711 return bvec3{
static_cast<bool>(mask & 0b001),
static_cast<bool>(mask & 0b010),
static_cast<bool>(mask & 0b100)};
3713 return grem::greaterThanEqual(detail::toQuantity(a)._private_getUnderlyingValue(), detail::toQuantity(b)._private_getUnderlyingValue());
3716 return grem::greaterThanEqual(detail::toQuantity(a)._private_value, detail::toQuantity(b)._private_value);
3720template <detail::quantity_unary_operand A>
3725template <detail::quantity_unary_operand B>
3730template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
3732 constexpr size_t N = detail::quantity_rank_v<A>;
3733 using UnitT = detail::unit_type_t<A>;
3734 static_assert(detail::unit_type_t<B>{} == UnitT{},
"Quantities of different units cannot be clamped.");
3735 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot have its length clamped because it represents an absolute position.");
3739template <
size_t N,
typename UnitT>
3750 template <
typename OtherUnitT>
3768 : _private_value(value) {}
3771 : _private_value(value) {}
3774 : _private_value{value._private_value} {}
3777 : _private_value{x._private_getUnderlyingValue(), y._private_getUnderlyingValue()} {}
3780 : _private_value{x._private_getUnderlyingValue(), y._private_getUnderlyingValue(), z._private_getUnderlyingValue()} {}
3791 if constexpr (N == 2) {
3792 return {
length(Component::reinterpret(_private_value[0])),
length(Component::reinterpret(_private_value[1]))};
3793 }
else if constexpr (N == 3) {
3794 return {
length(Component::reinterpret(_private_value[0])),
length(Component::reinterpret(_private_value[1])),
length(Component::reinterpret(_private_value[2]))};
3799 if constexpr (N == 2) {
3800 return {
length2(Component::reinterpret(_private_value[0])),
length2(Component::reinterpret(_private_value[1]))};
3801 }
else if constexpr (N == 3) {
3802 return {
length2(Component::reinterpret(_private_value[0])),
length2(Component::reinterpret(_private_value[1])),
length2(Component::reinterpret(_private_value[2]))};
3807 return _private_value == other._private_value;
3810 template <
typename OtherUnitT>
3812 return _private_value == other._private_value;
3819 template <
size_t Index>
3821 static_assert(Index <
RANK,
"Swizzle component index out of range.");
3822 return Component::reinterpret(_private_value[Index]);
3825 template <
size_t Index>
3827 static_assert(Index <
RANK,
"Swizzle component index out of range.");
3828 return Component::reinterpret(_private_value[Index]);
3831 template <
size_t Index>
3833 static_assert(Index <
RANK,
"Swizzle component index out of range.");
3834 return Component::reinterpret(_private_value[Index]);
3837 template <
size_t Index>
3839 static_assert(Index <
RANK,
"Swizzle component index out of range.");
3840 return Component::reinterpret(_private_value[Index]);
3849 : _private_value(value) {}
3852 : _private_value(value) {}
3855template <
size_t N,
typename UnitT>
3856requires(
N == 2 ||
N == 3)
3859template <
size_t N,
typename UnitT>
3864template <
size_t N,
typename UnitT>
3869template <
size_t N,
typename UnitT>
3874template <
size_t N,
typename UnitT>
3879template <
size_t N,
typename UnitT1,
typename UnitT2>
3881 static_assert(detail::can_add<UnitT1, UnitT2>,
"Quantities of these units cannot be added.");
3885template <
size_t N,
typename UnitT1,
typename UnitT2>
3887 static_assert(detail::can_subtract<UnitT1, UnitT2>,
"Quantities of these units cannot be subtracted.");
3891template <
size_t N,
typename UnitT1,
typename UnitT2>
3893 static_assert(detail::can_multiply<UnitT1, UnitT2>,
"Quantities of these units cannot be multiplied.");
3897template <
size_t N1,
typename UnitT1, detail::quantity_convertible B>
3899 constexpr size_t N2 = detail::quantity_rank_v<B>;
3900 using UnitT2 = detail::unit_type_t<B>;
3901 static_assert(detail::can_multiply<UnitT1, UnitT2>,
"Quantities of these units cannot be multiplied.");
3905template <
size_t N2,
typename UnitT2, detail::quantity_convertible A>
3907 constexpr size_t N1 = detail::quantity_rank_v<A>;
3908 using UnitT1 = detail::unit_type_t<A>;
3909 static_assert(detail::can_multiply<UnitT1, UnitT2>,
"Quantities of these units cannot be multiplied.");
3913template <
size_t N,
typename UnitT1,
typename UnitT2>
3915 static_assert(detail::can_multiply<UnitT1, UnitT2>,
"Quantities of these units cannot be multiplied.");
3916 if constexpr (N == 2) {
3921 }
else if constexpr (N == 3) {
3930template <detail::quantity_convertible A,
size_t N2,
typename UnitT2>
3932 constexpr size_t N1 = detail::quantity_rank_v<A>;
3933 using UnitT1 = detail::unit_type_t<A>;
3934 static_assert(detail::can_multiply<UnitT1, UnitT2>,
"Quantities of these units cannot be multiplied.");
3935 if constexpr (N1 == 2 && N2 == 2) {
3940 }
else if constexpr (N1 == 3 && N2 == 3) {
3949template <
size_t N,
typename UnitT>
3951 if constexpr (N == 2) {
3953 }
else if constexpr (N == 3) {
3958template <
size_t N,
typename UnitT>
3960 if constexpr (N == 2) {
3962 }
else if constexpr (N == 3) {
3967template <
size_t N,
typename UnitT>
3969 if constexpr (N == 2) {
3971 }
else if constexpr (N == 3) {
4106 static_assert(N == 2 || N == 3);
4112 using Scale<N>::RANK;
4113 using Scale<N>::UNIT;
4114 using Scale<N>::DIMENSION;
4115 using Scale<N>::MAGNITUDE;
4123 if constexpr (N == 3) {
4131 return static_cast<const Scale<N>&
>(*this) ==
static_cast<const Scale<N>&
>(other);
4134 template <
typename OtherUnitT>
4136 return static_cast<const Scale<N>&
>(*this) == other;
4140 return static_cast<const Scale<N>&
>(*this) == other;
4154template <detail::quantity_unary_operand A>
4156 constexpr size_t N = detail::quantity_rank_v<A>;
4157 using UnitT = detail::unit_type_t<A>;
4158#if defined(GREM_USE_SSE_INTRINSICS) && !defined(GREM_PHYSICS_USE_DOUBLE_PRECISION)
4159 if constexpr (N == 3) {
4160 return Quantity<N, UnitT>::reinterpret(_mm_xor_ps(_mm_set1_ps(bit_cast<float32_t>(
static_cast<uint32_t
>(b) << 31)), detail::toQuantity(a)._private_value));
4174template <detail::quantity_binary_operand_a A, detail::quantity_binary_operand_b<A> B>
4176 constexpr size_t N = detail::quantity_rank_v<A>;
4177 using UnitT = detail::unit_type_t<A>;
4181template <
size_t N, detail::quantity_binary_operand_b<Direction<N>> B>
4186template <detail::quantity_unary_operand A>
4188 constexpr size_t N = detail::quantity_rank_v<A>;
4189 using UnitT = detail::unit_type_t<A>;
4190 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be normalized because it represents an absolute position.");
4200template <detail::quantity_unary_operand A>
4202 constexpr size_t N = detail::quantity_rank_v<A>;
4203 using UnitT = detail::unit_type_t<A>;
4204 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be normalized because it represents an absolute position.");
4207 if (lengthSquared >
length2(Scale1D::MACHINE_EPSILON)) {
4218template <detail::quantity_unary_operand A>
4220 constexpr size_t N = detail::quantity_rank_v<A>;
4221 using UnitT = detail::unit_type_t<A>;
4222 static_assert(N == 2,
"Quantity cannot be rotated around an implicit axis because it is not 2D.");
4223 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be rotated because it represents an absolute position.");
4231template <detail::quantity_unary_operand A>
4233 constexpr size_t N = detail::quantity_rank_v<A>;
4234 using UnitT = detail::unit_type_t<A>;
4235 static_assert(N == 2,
"Quantity cannot be rotated around an implicit axis because it is not 2D.");
4236 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be rotated because it represents an absolute position.");
4244template <detail::quantity_unary_operand A>
4246 constexpr size_t N = detail::quantity_rank_v<A>;
4247 using UnitT = detail::unit_type_t<A>;
4248 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be flipped because it represents an absolute position.");
4257template <detail::quantity_unary_operand A>
4259 constexpr size_t N = detail::quantity_rank_v<A>;
4260 using UnitT = detail::unit_type_t<A>;
4261 static_assert(N >= 2,
"Quantity cannot be flipped on the Y axis because it has fewer than 2 dimensions.");
4262 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be flipped because it represents an absolute position.");
4271template <detail::quantity_unary_operand A>
4273 constexpr size_t N = detail::quantity_rank_v<A>;
4274 using UnitT = detail::unit_type_t<A>;
4275 static_assert(N >= 2,
"Quantity cannot be flipped on the Z axis because it has fewer than 3 dimensions.");
4276 static_assert(!UnitT::MagnitudeType::IS_ABSOLUTE,
"Quantity of this unit cannot be flipped because it represents an absolute position.");
4285template <
size_t N,
typename UnitT>
4291template <detail::quantity_unary_operand A>
4293 constexpr size_t N = detail::quantity_rank_v<A>;
4298template <detail::quantity_unary_operand A>
4300 constexpr size_t N = detail::quantity_rank_v<A>;
4309template <
typename UnitT>
4315template <detail::quantity_unary_operand A>
4320template <detail::quantity_unary_operand A>
4339 static_assert(N == 2 || N == 3);
4355 return static_cast<const Basis<N>&
>(*this) ==
static_cast<const Basis<N>&
>(other);
4358 template <
typename OtherUnitT>
4360 return static_cast<const Basis<N>&
>(*this) == other;
4364 return static_cast<const Basis<N>&
>(*this) == other;
4367 template <
size_t Index>
4369 static_assert(Index <
RANK,
"Swizzle component index out of range.");
4373 template <
size_t Index>
4375 static_assert(Index <
RANK,
"Swizzle component index out of range.");
4379 template <
size_t Index>
4381 static_assert(Index <
RANK,
"Swizzle component index out of range.");
4385 template <
size_t Index>
4387 static_assert(Index <
RANK,
"Swizzle component index out of range.");
4392 return OrthonormalBasis{-
static_cast<const Basis<N>&
>(*this)};
4405 :
Basis<N>(basis) {}
4453 : _private_value(static_cast<
Scalar>(angle)) {}
4456 : _private_value(
static_cast<Scalar>(angle)) {}
4458 template <
typename OtherUnitT>
4460 : _private_value(angle.
in(
UNIT)) {}
4463 return static_cast<float>(_private_value);
4467 return static_cast<double>(_private_value);
4470 template <
typename OtherUnitT>
4475 template <unit OtherUnitT>
4477 if constexpr (OtherUnitT::MagnitudeType::VALUE == MagnitudeType::VALUE) {
4480 constexpr Scalar factor =
static_cast<Scalar>(MagnitudeType::VALUE / OtherUnitT::MagnitudeType::VALUE);
4481 return _private_value * factor;
4487 template <
typename UnitT>
4496 template <
typename UnitT>
4563 : _private_value(quaternion) {}
4566 : _private_value(quaternion) {}
4578 template <
typename UnitT>
4580 return (_private_value * b._private_getUnderlyingValue()) * UnitT{};
4651 constexpr Scalar HALF_TURN = numbers::pi_v<Scalar>;
4653 return (
grem::wrap(x - y + HALF_TURN, FULL_TURN) - HALF_TURN) * RADIANS;
4700 return slerp(a, b, alpha);
4704 return slerp(a, b, alpha);
4707template <
size_t N,
typename UnitT>
4709 if constexpr (N == 2) {
4714 }
else if constexpr (N == 3) {
4737 if constexpr (N == 2) {
4739 }
else if constexpr (N == 3) {
4756template <
size_t N,
typename UnitT>
4758 if constexpr (N == 3) {
4851template <
typename UnitT>
5027 return offset + basis * b;
5039 return length(basis * localOffset);
5043 return length2(basis * localOffset);
5046 template <
typename UnitT>
5048 return basis * localQuantity;
5117 : origin(origin + localTransformation.getOffset())
5118 , basis(localTransformation.
getBasis()) {}
5121 : origin(localTransformation.getOffset())
5122 , basis(localTransformation.
getBasis()) {}
5151 return origin + basis * b;
5163 return length(basis * localOffset);
5167 return length2(basis * localOffset);
5170 template <
typename UnitT>
5172 return basis * localQuantity;
5223class InverseTransformation;
5238 return inverseBasis * (b - offset);
5246 return inverseBasis;
5250 return length(inverseBasis * localOffset);
5254 return length2(inverseBasis * localOffset);
5257 template <
typename UnitT>
5259 return inverseBasis * localQuantity;
5263 return normalize(inverseBasis * direction);
5270 template <
size_t OtherN>
5277 template <
size_t OtherN>
5283 template <
size_t OtherN>
5286 template <
size_t OtherN>
5289 template <
size_t OtherN>
5292 template <
size_t OtherN>
5298 , inverseBasis(inverseBasis) {}
5301 Basis<N> inverseBasis{};
5366 return inverseBasis * (b - origin);
5374 return inverseBasis;
5378 return length(inverseBasis * localOffset);
5382 return length2(inverseBasis * localOffset);
5385 template <
typename UnitT>
5387 return inverseBasis * localQuantity;
5391 return normalize(inverseBasis * direction);
5398 template <
size_t OtherN>
5405 template <
size_t OtherN>
5411 template <
size_t OtherN>
5414 template <
size_t OtherN>
5417 template <
size_t OtherN>
5420 template <
size_t OtherN>
5423 template <
size_t OtherN>
5429 , inverseBasis(inverseBasis) {}
5432 Basis<N> inverseBasis{};
6142[[nodiscard]]
consteval Coefficient operator""_x(
unsigned long long value) {
6146[[nodiscard]]
consteval Coefficient operator""_percent(
long double value) {
6150[[nodiscard]]
consteval Coefficient operator""_percent(
unsigned long long value) {
6151 return Coefficient{
static_cast<Scalar>(
static_cast<long double>(value) * 0.01l)};
6154[[nodiscard]]
consteval Angle operator""_radians(
long double value) {
6155 return static_cast<Scalar>(value) * RADIANS;
6158[[nodiscard]]
consteval Angle operator""_radians(
unsigned long long value) {
6159 return static_cast<Scalar>(value) * RADIANS;
6162[[nodiscard]]
consteval Angle operator""_radian(
long double value) {
6163 if (value != 1.0l) {
6164 throw physics::Error{
"Syntax error: Expected \"1.0_radian\". For values other than 1, use the plural form \"_radians\" instead."};
6166 return operator""_radians(value);
6169[[nodiscard]]
consteval Angle operator""_radian(
unsigned long long value) {
6170 if (value != 1ull) {
6171 throw physics::Error{
"Syntax error: Expected \"1_radian\". For values other than 1, use the plural form \"_radians\" instead."};
6173 return operator""_radians(value);
6176[[nodiscard]]
consteval Angle operator""_degrees(
long double value) {
6177 return static_cast<Scalar>(value * 0.01745329251994329576923690768489l) * RADIANS;
6180[[nodiscard]]
consteval Angle operator""_degrees(
unsigned long long value) {
6181 return static_cast<Scalar>(
static_cast<long double>(value) * 0.01745329251994329576923690768489l) * RADIANS;
6184[[nodiscard]]
consteval Angle operator""_degree(
long double value) {
6185 if (value != 1.0l) {
6186 throw physics::Error{
"Syntax error: Expected \"1.0_degree\". For values other than 1, use the plural form \"_degrees\" instead."};
6188 return operator""_degrees(value);
6191[[nodiscard]]
consteval Angle operator""_degree(
unsigned long long value) {
6192 if (value != 1ull) {
6193 throw physics::Error{
"Syntax error: Expected \"1_degree\". For values other than 1, use the plural form \"_degrees\" instead."};
6195 return operator""_degrees(value);
6198[[nodiscard]]
consteval Angle operator""_turns(
long double value) {
6199 return static_cast<Scalar>(value * 6.28318530718l) * RADIANS;
6202[[nodiscard]]
consteval Angle operator""_turns(
unsigned long long value) {
6203 return static_cast<Scalar>(
static_cast<long double>(value) * 6.28318530718l) * RADIANS;
6206[[nodiscard]]
consteval Angle operator""_turn(
long double value) {
6207 if (value != 1.0l) {
6208 throw physics::Error{
"Syntax error: Expected \"1.0_turn\". For values other than 1, use the plural form \"_turns\" instead."};
6210 return operator""_turns(value);
6213[[nodiscard]]
consteval Angle operator""_turn(
unsigned long long value) {
6214 if (value != 1ull) {
6215 throw physics::Error{
"Syntax error: Expected \"1_turn\". For values other than 1, use the plural form \"_turns\" instead."};
6217 return operator""_turns(value);
6220[[nodiscard]]
consteval Mass operator""_kilograms(
long double value) {
6221 return static_cast<Scalar>(value) * KILOGRAMS;
6224[[nodiscard]]
consteval Mass operator""_kilograms(
unsigned long long value) {
6225 return static_cast<Scalar>(value) * KILOGRAMS;
6228[[nodiscard]]
consteval Mass operator""_kilogram(
long double value) {
6229 if (value != 1.0l) {
6230 throw physics::Error{
"Syntax error: Expected \"1.0_kilogram\". For values other than 1, use the plural form \"_kilograms\" instead."};
6232 return operator""_kilograms(value);
6235[[nodiscard]]
consteval Mass operator""_kilogram(
unsigned long long value) {
6236 if (value != 1ull) {
6237 throw physics::Error{
"Syntax error: Expected \"1_kilogram\". For values other than 1, use the plural form \"_kilograms\" instead."};
6239 return operator""_kilograms(value);
6242[[nodiscard]]
consteval Mass operator""_grams(
long double value) {
6243 return static_cast<Scalar>(value * 0.001l) * KILOGRAMS;
6246[[nodiscard]]
consteval Mass operator""_grams(
unsigned long long value) {
6247 return static_cast<Scalar>(
static_cast<long double>(value) * 0.001l) * KILOGRAMS;
6250[[nodiscard]]
consteval Mass operator""_gram(
long double value) {
6251 if (value != 1.0l) {
6252 throw physics::Error{
"Syntax error: Expected \"1.0_gram\". For values other than 1, use the plural form \"_grams\" instead."};
6254 return operator""_grams(value);
6257[[nodiscard]]
consteval Mass operator""_gram(
unsigned long long value) {
6258 if (value != 1ull) {
6259 throw physics::Error{
"Syntax error: Expected \"1_gram\". For values other than 1, use the plural form \"_grams\" instead."};
6261 return operator""_grams(value);
6264[[nodiscard]]
consteval Distance operator""_meters(
long double value) {
6265 return static_cast<Scalar>(value) * METERS;
6268[[nodiscard]]
consteval Distance operator""_meters(
unsigned long long value) {
6269 return static_cast<Scalar>(value) * METERS;
6272[[nodiscard]]
consteval Distance operator""_meter(
long double value) {
6273 if (value != 1.0l) {
6274 throw physics::Error{
"Syntax error: Expected \"1.0_meter\". For values other than 1, use the plural form \"_meters\" instead."};
6276 return operator""_meters(value);
6279[[nodiscard]]
consteval Distance operator""_meter(
unsigned long long value) {
6280 if (value != 1ull) {
6281 throw physics::Error{
"Syntax error: Expected \"1_meter\". For values other than 1, use the plural form \"_meters\" instead."};
6283 return operator""_meters(value);
6286[[nodiscard]]
consteval Distance operator""_kilometers(
long double value) {
6287 return static_cast<Scalar>(value * 1000.0l) * METERS;
6290[[nodiscard]]
consteval Distance operator""_kilometers(
unsigned long long value) {
6291 return static_cast<Scalar>(value * 1000ull) * METERS;
6294[[nodiscard]]
consteval Distance operator""_kilometer(
long double value) {
6295 if (value != 1.0l) {
6296 throw physics::Error{
"Syntax error: Expected \"1.0_kilometer\". For values other than 1, use the plural form \"_kilometers\" instead."};
6298 return operator""_kilometers(value);
6301[[nodiscard]]
consteval Distance operator""_kilometer(
unsigned long long value) {
6302 if (value != 1ull) {
6303 throw physics::Error{
"Syntax error: Expected \"1_kilometer\". For values other than 1, use the plural form \"_kilometers\" instead."};
6305 return operator""_kilometers(value);
6308[[nodiscard]]
consteval Distance operator""_decimeters(
long double value) {
6309 return static_cast<Scalar>(value * 0.1l) * METERS;
6312[[nodiscard]]
consteval Distance operator""_decimeters(
unsigned long long value) {
6313 return static_cast<Scalar>(
static_cast<long double>(value) * 0.1l) * METERS;
6316[[nodiscard]]
consteval Distance operator""_decimeter(
long double value) {
6317 if (value != 1.0l) {
6318 throw physics::Error{
"Syntax error: Expected \"1.0_decimeter\". For values other than 1, use the plural form \"_decimeters\" instead."};
6320 return operator""_decimeters(value);
6323[[nodiscard]]
consteval Distance operator""_decimeter(
unsigned long long value) {
6324 if (value != 1ull) {
6325 throw physics::Error{
"Syntax error: Expected \"1_decimeter\". For values other than 1, use the plural form \"_decimeters\" instead."};
6327 return operator""_decimeters(value);
6330[[nodiscard]]
consteval Distance operator""_centimeters(
long double value) {
6331 return static_cast<Scalar>(value * 0.01l) * METERS;
6334[[nodiscard]]
consteval Distance operator""_centimeters(
unsigned long long value) {
6335 return static_cast<Scalar>(
static_cast<long double>(value) * 0.01l) * METERS;
6338[[nodiscard]]
consteval Distance operator""_centimeter(
long double value) {
6339 if (value != 1.0l) {
6340 throw physics::Error{
"Syntax error: Expected \"1.0_centimeter\". For values other than 1, use the plural form \"_centimeters\" instead."};
6342 return operator""_centimeters(value);
6345[[nodiscard]]
consteval Distance operator""_centimeter(
unsigned long long value) {
6346 if (value != 1ull) {
6347 throw physics::Error{
"Syntax error: Expected \"1_centimeter\". For values other than 1, use the plural form \"_centimeters\" instead."};
6349 return operator""_centimeters(value);
6352[[nodiscard]]
consteval Distance operator""_millimeters(
long double value) {
6353 return static_cast<Scalar>(value * 0.001l) * METERS;
6356[[nodiscard]]
consteval Distance operator""_millimeters(
unsigned long long value) {
6357 return static_cast<Scalar>(
static_cast<long double>(value) * 0.001l) * METERS;
6360[[nodiscard]]
consteval Distance operator""_millimeter(
long double value) {
6361 if (value != 1.0l) {
6362 throw physics::Error{
"Syntax error: Expected \"1.0_millimeter\". For values other than 1, use the plural form \"_millimeters\" instead."};
6364 return operator""_millimeters(value);
6367[[nodiscard]]
consteval Distance operator""_millimeter(
unsigned long long value) {
6368 if (value != 1ull) {
6369 throw physics::Error{
"Syntax error: Expected \"1_millimeter\". For values other than 1, use the plural form \"_millimeters\" instead."};
6371 return operator""_millimeters(value);
6374[[nodiscard]]
consteval Area operator""_square_meters(
long double value) {
6375 return static_cast<Scalar>(value) * SQUARE_METERS;
6378[[nodiscard]]
consteval Area operator""_square_meters(
unsigned long long value) {
6379 return static_cast<Scalar>(value) * SQUARE_METERS;
6382[[nodiscard]]
consteval Area operator""_square_meter(
long double value) {
6383 if (value != 1.0l) {
6384 throw physics::Error{
"Syntax error: Expected \"1.0_square_meter\". For values other than 1, use the plural form \"_square_meters\" instead."};
6386 return operator""_square_meters(value);
6389[[nodiscard]]
consteval Area operator""_square_meter(
unsigned long long value) {
6390 if (value != 1ull) {
6391 throw physics::Error{
"Syntax error: Expected \"1_square_meter\". For values other than 1, use the plural form \"_square_meters\" instead."};
6393 return operator""_square_meters(value);
6396[[nodiscard]]
consteval Area operator""_square_kilometers(
long double value) {
6397 return static_cast<Scalar>(value * 1000000.0l) * SQUARE_METERS;
6400[[nodiscard]]
consteval Area operator""_square_kilometers(
unsigned long long value) {
6401 return static_cast<Scalar>(value * 1000000ull) * SQUARE_METERS;
6404[[nodiscard]]
consteval Area operator""_square_kilometer(
long double value) {
6405 if (value != 1.0l) {
6406 throw physics::Error{
"Syntax error: Expected \"1.0_square_kilometer\". For values other than 1, use the plural form \"_square_kilometers\" instead."};
6408 return operator""_square_kilometers(value);
6411[[nodiscard]]
consteval Area operator""_square_kilometer(
unsigned long long value) {
6412 if (value != 1ull) {
6413 throw physics::Error{
"Syntax error: Expected \"1_square_kilometer\". For values other than 1, use the plural form \"_square_kilometers\" instead."};
6415 return operator""_square_kilometers(value);
6418[[nodiscard]]
consteval Area operator""_square_decimeters(
long double value) {
6419 return static_cast<Scalar>(value * 0.01l) * SQUARE_METERS;
6422[[nodiscard]]
consteval Area operator""_square_decimeters(
unsigned long long value) {
6423 return static_cast<Scalar>(
static_cast<long double>(value) * 0.01l) * SQUARE_METERS;
6426[[nodiscard]]
consteval Area operator""_square_decimeter(
long double value) {
6427 if (value != 1.0l) {
6428 throw physics::Error{
"Syntax error: Expected \"1.0_square_decimeter\". For values other than 1, use the plural form \"_square_decimeters\" instead."};
6430 return operator""_square_decimeters(value);
6433[[nodiscard]]
consteval Area operator""_square_decimeter(
unsigned long long value) {
6434 if (value != 1ull) {
6435 throw physics::Error{
"Syntax error: Expected \"1_square_decimeter\". For values other than 1, use the plural form \"_square_decimeters\" instead."};
6437 return operator""_square_decimeters(value);
6440[[nodiscard]]
consteval Area operator""_square_centimeters(
long double value) {
6441 return static_cast<Scalar>(value * 0.0001l) * SQUARE_METERS;
6444[[nodiscard]]
consteval Area operator""_square_centimeters(
unsigned long long value) {
6445 return static_cast<Scalar>(
static_cast<long double>(value) * 0.0001l) * SQUARE_METERS;
6448[[nodiscard]]
consteval Area operator""_square_centimeter(
long double value) {
6449 if (value != 1.0l) {
6450 throw physics::Error{
"Syntax error: Expected \"1.0_square_centimeter\". For values other than 1, use the plural form \"_square_centimeters\" instead."};
6452 return operator""_square_centimeters(value);
6455[[nodiscard]]
consteval Area operator""_square_centimeter(
unsigned long long value) {
6456 if (value != 1ull) {
6457 throw physics::Error{
"Syntax error: Expected \"1_square_centimeter\". For values other than 1, use the plural form \"_square_centimeters\" instead."};
6459 return operator""_square_centimeters(value);
6462[[nodiscard]]
consteval Area operator""_square_millimeters(
long double value) {
6463 return static_cast<Scalar>(value * 0.000001l) * SQUARE_METERS;
6466[[nodiscard]]
consteval Area operator""_square_millimeters(
unsigned long long value) {
6467 return static_cast<Scalar>(
static_cast<long double>(value) * 0.000001l) * SQUARE_METERS;
6470[[nodiscard]]
consteval Area operator""_square_millimeter(
long double value) {
6471 if (value != 1.0l) {
6472 throw physics::Error{
"Syntax error: Expected \"1.0_square_millimeter\". For values other than 1, use the plural form \"_square_millimeters\" instead."};
6474 return operator""_square_millimeters(value);
6477[[nodiscard]]
consteval Area operator""_square_millimeter(
unsigned long long value) {
6478 if (value != 1ull) {
6479 throw physics::Error{
"Syntax error: Expected \"1_square_millimeter\". For values other than 1, use the plural form \"_square_millimeters\" instead."};
6481 return operator""_square_millimeters(value);
6484[[nodiscard]]
consteval Volume operator""_cubic_meters(
long double value) {
6485 return static_cast<Scalar>(value) * CUBIC_METERS;
6488[[nodiscard]]
consteval Volume operator""_cubic_meters(
unsigned long long value) {
6489 return static_cast<Scalar>(value) * CUBIC_METERS;
6492[[nodiscard]]
consteval Volume operator""_cubic_meter(
long double value) {
6493 if (value != 1.0l) {
6494 throw physics::Error{
"Syntax error: Expected \"1.0_cubic_meter\". For values other than 1, use the plural form \"_cubic_meters\" instead."};
6496 return operator""_cubic_meters(value);
6499[[nodiscard]]
consteval Volume operator""_cubic_meter(
unsigned long long value) {
6500 if (value != 1ull) {
6501 throw physics::Error{
"Syntax error: Expected \"1_cubic_meter\". For values other than 1, use the plural form \"_cubic_meters\" instead."};
6503 return operator""_cubic_meters(value);
6506[[nodiscard]]
consteval Volume operator""_liters(
long double value) {
6507 return static_cast<Scalar>(value * 0.001l) * CUBIC_METERS;
6510[[nodiscard]]
consteval Volume operator""_liters(
unsigned long long value) {
6511 return static_cast<Scalar>(
static_cast<long double>(value) * 0.001l) * CUBIC_METERS;
6514[[nodiscard]]
consteval Volume operator""_liter(
long double value) {
6515 if (value != 1.0l) {
6516 throw physics::Error{
"Syntax error: Expected \"1.0_liter\". For values other than 1, use the plural form \"_liters\" instead."};
6518 return operator""_liters(value);
6521[[nodiscard]]
consteval Volume operator""_liter(
unsigned long long value) {
6522 if (value != 1ull) {
6523 throw physics::Error{
"Syntax error: Expected \"1_liter\". For values other than 1, use the plural form \"_liters\" instead."};
6525 return operator""_liters(value);
6528[[nodiscard]]
consteval Volume operator""_deciliters(
long double value) {
6529 return static_cast<Scalar>(value * 0.0001l) * CUBIC_METERS;
6532[[nodiscard]]
consteval Volume operator""_deciliters(
unsigned long long value) {
6533 return static_cast<Scalar>(
static_cast<long double>(value) * 0.0001l) * CUBIC_METERS;
6536[[nodiscard]]
consteval Volume operator""_deciliter(
long double value) {
6537 if (value != 1.0l) {
6538 throw physics::Error{
"Syntax error: Expected \"1.0_deciliter\". For values other than 1, use the plural form \"_deciliters\" instead."};
6540 return operator""_deciliters(value);
6543[[nodiscard]]
consteval Volume operator""_deciliter(
unsigned long long value) {
6544 if (value != 1ull) {
6545 throw physics::Error{
"Syntax error: Expected \"1_deciliter\". For values other than 1, use the plural form \"_deciliters\" instead."};
6547 return operator""_deciliters(value);
6550[[nodiscard]]
consteval Volume operator""_centiliters(
long double value) {
6551 return static_cast<Scalar>(value * 0.00001l) * CUBIC_METERS;
6554[[nodiscard]]
consteval Volume operator""_centiliters(
unsigned long long value) {
6555 return static_cast<Scalar>(
static_cast<long double>(value) * 0.00001l) * CUBIC_METERS;
6558[[nodiscard]]
consteval Volume operator""_centiliter(
long double value) {
6559 if (value != 1.0l) {
6560 throw physics::Error{
"Syntax error: Expected \"1.0_centiliter\". For values other than 1, use the plural form \"_centiliters\" instead."};
6562 return operator""_centiliters(value);
6565[[nodiscard]]
consteval Volume operator""_centiliter(
unsigned long long value) {
6566 if (value != 1ull) {
6567 throw physics::Error{
"Syntax error: Expected \"1_centiliter\". For values other than 1, use the plural form \"_centiliters\" instead."};
6569 return operator""_centiliters(value);
6572[[nodiscard]]
consteval Volume operator""_milliliters(
long double value) {
6573 return static_cast<Scalar>(value * 0.000001l) * CUBIC_METERS;
6576[[nodiscard]]
consteval Volume operator""_milliliters(
unsigned long long value) {
6577 return static_cast<Scalar>(
static_cast<long double>(value) * 0.000001l) * CUBIC_METERS;
6580[[nodiscard]]
consteval Volume operator""_milliliter(
long double value) {
6581 if (value != 1.0l) {
6582 throw physics::Error{
"Syntax error: Expected \"1.0_milliliter\". For values other than 1, use the plural form \"_milliliters\" instead."};
6584 return operator""_milliliters(value);
6587[[nodiscard]]
consteval Volume operator""_milliliter(
unsigned long long value) {
6588 if (value != 1ull) {
6589 throw physics::Error{
"Syntax error: Expected \"1_milliliter\". For values other than 1, use the plural form \"_milliliters\" instead."};
6591 return operator""_milliliters(value);
6594[[nodiscard]]
consteval Density operator""_kilograms_per_cubic_meter(
long double value) {
6595 return static_cast<Scalar>(value) * KILOGRAMS_PER_CUBIC_METER;
6598[[nodiscard]]
consteval Density operator""_kilograms_per_cubic_meter(
unsigned long long value) {
6599 return static_cast<Scalar>(value) * KILOGRAMS_PER_CUBIC_METER;
6602[[nodiscard]]
consteval Density operator""_kilogram_per_cubic_meter(
long double value) {
6603 if (value != 1.0l) {
6604 throw physics::Error{
"Syntax error: Expected \"1.0_kilogram_per_cubic_meter\". For values other than 1, use the plural form \"_kilograms_per_cubic_meter\" instead."};
6606 return operator""_kilograms_per_cubic_meter(value);
6609[[nodiscard]]
consteval Density operator""_kilogram_per_cubic_meter(
unsigned long long value) {
6610 if (value != 1ull) {
6611 throw physics::Error{
"Syntax error: Expected \"1_kilogram_per_cubic_meter\". For values other than 1, use the plural form \"_kilograms_per_cubic_meter\" instead."};
6613 return operator""_kilograms_per_cubic_meter(value);
6616[[nodiscard]]
consteval Density operator""_grams_per_cubic_centimeter(
long double value) {
6617 return static_cast<Scalar>(value * 1000.0l) * KILOGRAMS_PER_CUBIC_METER;
6620[[nodiscard]]
consteval Density operator""_grams_per_cubic_centimeter(
unsigned long long value) {
6621 return static_cast<Scalar>(value * 1000ull) * KILOGRAMS_PER_CUBIC_METER;
6624[[nodiscard]]
consteval Density operator""_gram_per_cubic_centimeter(
long double value) {
6625 if (value != 1.0l) {
6626 throw physics::Error{
"Syntax error: Expected \"1.0_gram_per_cubic_centimeter\". For values other than 1, use the plural form \"_grams_per_cubic_centimeter\" instead."};
6628 return operator""_grams_per_cubic_centimeter(value);
6631[[nodiscard]]
consteval Density operator""_gram_per_cubic_centimeter(
unsigned long long value) {
6632 if (value != 1ull) {
6633 throw physics::Error{
"Syntax error: Expected \"1_gram_per_cubic_centimeter\". For values other than 1, use the plural form \"_grams_per_cubic_centimeter\" instead."};
6635 return operator""_grams_per_cubic_centimeter(value);
6638[[nodiscard]]
consteval Frequency operator""_Hertz(
long double value) {
6639 return static_cast<Scalar>(value) * HERTZ;
6642[[nodiscard]]
consteval Frequency operator""_Hertz(
unsigned long long value) {
6643 return static_cast<Scalar>(value) * HERTZ;
6646[[nodiscard]]
consteval Frequency operator""_per_second(
long double value) {
6647 return static_cast<Scalar>(value) * HERTZ;
6650[[nodiscard]]
consteval Frequency operator""_per_second(
unsigned long long value) {
6651 return static_cast<Scalar>(value) * HERTZ;
6654[[nodiscard]]
consteval Frequency operator""_per_millisecond(
long double value) {
6655 return static_cast<Scalar>(value * 1000.0l) * HERTZ;
6658[[nodiscard]]
consteval Frequency operator""_per_millisecond(
unsigned long long value) {
6659 return static_cast<Scalar>(value * 1000ull) * HERTZ;
6662[[nodiscard]]
consteval Frequency operator""_per_minute(
long double value) {
6663 return static_cast<Scalar>(value * 0.0166666666667l) * HERTZ;
6666[[nodiscard]]
consteval Frequency operator""_per_minute(
unsigned long long value) {
6667 return static_cast<Scalar>(
static_cast<long double>(value) * 0.0166666666667l) * HERTZ;
6670[[nodiscard]]
consteval Frequency operator""_per_hour(
long double value) {
6671 return static_cast<Scalar>(value * 0.000277777777778l) * HERTZ;
6674[[nodiscard]]
consteval Frequency operator""_per_hour(
unsigned long long value) {
6675 return static_cast<Scalar>(
static_cast<long double>(value) * 0.000277777777778l) * HERTZ;
6679 return static_cast<Scalar>(value) * METER_SECONDS;
6683 return static_cast<Scalar>(value) * METER_SECONDS;
6687 if (value != 1.0l) {
6688 throw physics::Error{
"Syntax error: Expected \"1.0_meter_second\". For values other than 1, use the plural form \"_meter_seconds\" instead."};
6690 return operator""_meter_seconds(value);
6694 if (value != 1ull) {
6695 throw physics::Error{
"Syntax error: Expected \"1_meter_second\". For values other than 1, use the plural form \"_meter_seconds\" instead."};
6697 return operator""_meter_seconds(value);
6700[[nodiscard]]
consteval Wavenumber operator""_per_meter(
long double value) {
6701 return static_cast<Scalar>(value) * PER_METER;
6704[[nodiscard]]
consteval Wavenumber operator""_per_meter(
unsigned long long value) {
6705 return static_cast<Scalar>(value) * PER_METER;
6708[[nodiscard]]
consteval Speed operator""_meters_per_second(
long double value) {
6709 return static_cast<Scalar>(value) * METERS_PER_SECOND;
6712[[nodiscard]]
consteval Speed operator""_meters_per_second(
unsigned long long value) {
6713 return static_cast<Scalar>(value) * METERS_PER_SECOND;
6716[[nodiscard]]
consteval Speed operator""_meter_per_second(
long double value) {
6717 if (value != 1.0l) {
6718 throw physics::Error{
"Syntax error: Expected \"1.0_meter_per_second\". For values other than 1, use the plural form \"_meters_per_second\" instead."};
6720 return operator""_meters_per_second(value);
6723[[nodiscard]]
consteval Speed operator""_meter_per_second(
unsigned long long value) {
6724 if (value != 1ull) {
6725 throw physics::Error{
"Syntax error: Expected \"1_meter_per_second\". For values other than 1, use the plural form \"_meters_per_second\" instead."};
6727 return operator""_meters_per_second(value);
6730[[nodiscard]]
consteval Speed operator""_kilometers_per_second(
long double value) {
6731 return static_cast<Scalar>(value * 1000.0l) * METERS_PER_SECOND;
6734[[nodiscard]]
consteval Speed operator""_kilometers_per_second(
unsigned long long value) {
6735 return static_cast<Scalar>(value * 1000ull) * METERS_PER_SECOND;
6738[[nodiscard]]
consteval Speed operator""_kilometer_per_second(
long double value) {
6739 if (value != 1.0l) {
6740 throw physics::Error{
"Syntax error: Expected \"1.0_kilometer_per_second\". For values other than 1, use the plural form \"_kilometers_per_second\" instead."};
6742 return operator""_kilometers_per_second(value);
6745[[nodiscard]]
consteval Speed operator""_kilometer_per_second(
unsigned long long value) {
6746 if (value != 1ull) {
6747 throw physics::Error{
"Syntax error: Expected \"1_kilometer_per_second\". For values other than 1, use the plural form \"_kilometers_per_second\" instead."};
6749 return operator""_kilometers_per_second(value);
6752[[nodiscard]]
consteval Speed operator""_decimeters_per_second(
long double value) {
6753 return static_cast<Scalar>(value * 0.1l) * METERS_PER_SECOND;
6756[[nodiscard]]
consteval Speed operator""_decimeters_per_second(
unsigned long long value) {
6757 return static_cast<Scalar>(
static_cast<long double>(value) * 0.1l) * METERS_PER_SECOND;
6760[[nodiscard]]
consteval Speed operator""_decimeter_per_second(
long double value) {
6761 if (value != 1.0l) {
6762 throw physics::Error{
"Syntax error: Expected \"1.0_decimeter_per_second\". For values other than 1, use the plural form \"_decimeters_per_second\" instead."};
6764 return operator""_decimeters_per_second(value);
6767[[nodiscard]]
consteval Speed operator""_decimeter_per_second(
unsigned long long value) {
6768 if (value != 1ull) {
6769 throw physics::Error{
"Syntax error: Expected \"1_decimeter_per_second\". For values other than 1, use the plural form \"_decimeters_per_second\" instead."};
6771 return operator""_decimeters_per_second(value);
6774[[nodiscard]]
consteval Speed operator""_centimeters_per_second(
long double value) {
6775 return static_cast<Scalar>(value * 0.01l) * METERS_PER_SECOND;
6778[[nodiscard]]
consteval Speed operator""_centimeters_per_second(
unsigned long long value) {
6779 return static_cast<Scalar>(
static_cast<long double>(value) * 0.01l) * METERS_PER_SECOND;
6782[[nodiscard]]
consteval Speed operator""_centimeter_per_second(
long double value) {
6783 if (value != 1.0l) {
6784 throw physics::Error{
"Syntax error: Expected \"1.0_centimeter_per_second\". For values other than 1, use the plural form \"_centimeters_per_second\" instead."};
6786 return operator""_centimeters_per_second(value);
6789[[nodiscard]]
consteval Speed operator""_centimeter_per_second(
unsigned long long value) {
6790 if (value != 1ull) {
6791 throw physics::Error{
"Syntax error: Expected \"1_centimeter_per_second\". For values other than 1, use the plural form \"_centimeters_per_second\" instead."};
6793 return operator""_centimeters_per_second(value);
6796[[nodiscard]]
consteval Speed operator""_millimeters_per_second(
long double value) {
6797 return static_cast<Scalar>(value * 0.001l) * METERS_PER_SECOND;
6800[[nodiscard]]
consteval Speed operator""_millimeters_per_second(
unsigned long long value) {
6801 return static_cast<Scalar>(
static_cast<long double>(value) * 0.001l) * METERS_PER_SECOND;
6804[[nodiscard]]
consteval Speed operator""_millimeter_per_second(
long double value) {
6805 if (value != 1.0l) {
6806 throw physics::Error{
"Syntax error: Expected \"1.0_millimeter_per_second\". For values other than 1, use the plural form \"_millimeters_per_second\" instead."};
6808 return operator""_millimeters_per_second(value);
6811[[nodiscard]]
consteval Speed operator""_millimeter_per_second(
unsigned long long value) {
6812 if (value != 1ull) {
6813 throw physics::Error{
"Syntax error: Expected \"1_millimeter_per_second\". For values other than 1, use the plural form \"_millimeters_per_second\" instead."};
6815 return operator""_millimeters_per_second(value);
6818[[nodiscard]]
consteval Speed operator""_kilometers_per_hour(
long double value) {
6819 return static_cast<Scalar>(value * 0.277777778l) * METERS_PER_SECOND;
6822[[nodiscard]]
consteval Speed operator""_kilometers_per_hour(
unsigned long long value) {
6823 return static_cast<Scalar>(
static_cast<long double>(value) * 0.277777778l) * METERS_PER_SECOND;
6826[[nodiscard]]
consteval Speed operator""_kilometer_per_hour(
long double value) {
6827 if (value != 1.0l) {
6828 throw physics::Error{
"Syntax error: Expected \"1.0_kilometer_per_hour\". For values other than 1, use the plural form \"_kilometers_per_hour\" instead."};
6830 return operator""_kilometers_per_hour(value);
6833[[nodiscard]]
consteval Speed operator""_kilometer_per_hour(
unsigned long long value) {
6834 if (value != 1ull) {
6835 throw physics::Error{
"Syntax error: Expected \"1_kilometer_per_hour\". For values other than 1, use the plural form \"_kilometers_per_hour\" instead."};
6837 return operator""_kilometers_per_hour(value);
6840[[nodiscard]]
consteval Acceleration operator""_meters_per_second_squared(
long double value) {
6841 return static_cast<Scalar>(value) * METERS_PER_SECOND_SQUARED;
6844[[nodiscard]]
consteval Acceleration operator""_meters_per_second_squared(
unsigned long long value) {
6845 return static_cast<Scalar>(value) * METERS_PER_SECOND_SQUARED;
6848[[nodiscard]]
consteval Acceleration operator""_meter_per_second_squared(
long double value) {
6849 if (value != 1.0l) {
6850 throw physics::Error{
"Syntax error: Expected \"1.0_meter_per_second_squared\". For values other than 1, use the plural form \"_meters_per_second_squared\" instead."};
6852 return operator""_meters_per_second_squared(value);
6855[[nodiscard]]
consteval Acceleration operator""_meter_per_second_squared(
unsigned long long value) {
6856 if (value != 1ull) {
6857 throw physics::Error{
"Syntax error: Expected \"1_meter_per_second_squared\". For values other than 1, use the plural form \"_meters_per_second_squared\" instead."};
6859 return operator""_meters_per_second_squared(value);
6862[[nodiscard]]
consteval Force1D operator""_Newton(
long double value) {
6863 return static_cast<Scalar>(value) * NEWTON;
6866[[nodiscard]]
consteval Force1D operator""_Newton(
unsigned long long value) {
6867 return static_cast<Scalar>(value) * NEWTON;
6870[[nodiscard]]
consteval Force1D operator""_kilogram_meters_per_second_squared(
long double value) {
6871 return static_cast<Scalar>(value) * NEWTON;
6874[[nodiscard]]
consteval Force1D operator""_kilogram_meters_per_second_squared(
unsigned long long value) {
6875 return static_cast<Scalar>(value) * NEWTON;
6878[[nodiscard]]
consteval Force1D operator""_kilogram_meter_per_second_squared(
long double value) {
6879 if (value != 1.0l) {
6881 "Syntax error: Expected \"1.0_kilogram_meter_per_second_squared\". For values other than 1, use the plural form \"_kilogram_meters_per_second_squared\" instead."};
6883 return operator""_kilogram_meters_per_second_squared(value);
6886[[nodiscard]]
consteval Force1D operator""_kilogram_meter_per_second_squared(
unsigned long long value) {
6887 if (value != 1ull) {
6889 "Syntax error: Expected \"1_kilogram_meter_per_second_squared\". For values other than 1, use the plural form \"_kilogram_meters_per_second_squared\" instead."};
6891 return operator""_kilogram_meters_per_second_squared(value);
6894[[nodiscard]]
consteval Torque2D operator""_Newton_meters(
long double value) {
6895 return static_cast<Scalar>(value) * NEWTON_METERS;
6898[[nodiscard]]
consteval Torque2D operator""_Newton_meters(
unsigned long long value) {
6899 return static_cast<Scalar>(value) * NEWTON_METERS;
6902[[nodiscard]]
consteval Torque2D operator""_Newton_meter(
long double value) {
6903 if (value != 1.0l) {
6904 throw physics::Error{
"Syntax error: Expected \"1.0_Newton_meter\". For values other than 1, use the plural form \"_Newton_meters\" instead."};
6906 return operator""_Newton_meters(value);
6909[[nodiscard]]
consteval Torque2D operator""_Newton_meter(
unsigned long long value) {
6910 if (value != 1ull) {
6911 throw physics::Error{
"Syntax error: Expected \"1_Newton_meter\". For values other than 1, use the plural form \"_Newton_meters\" instead."};
6913 return operator""_Newton_meters(value);
6916[[nodiscard]]
consteval Torque2D operator""_kilogram_square_meters_per_second_squared(
long double value) {
6917 return static_cast<Scalar>(value) * NEWTON_METERS;
6920[[nodiscard]]
consteval Torque2D operator""_kilogram_square_meters_per_second_squared(
unsigned long long value) {
6921 return static_cast<Scalar>(value) * NEWTON_METERS;
6924[[nodiscard]]
consteval Torque2D operator""_kilogram_square_meter_per_second_squared(
long double value) {
6925 if (value != 1.0l) {
6927 "Syntax error: Expected \"1.0_kilogram_square_meter_per_second_squared\". For values other than 1, use the plural form "
6928 "\"_kilogram_square_meters_per_second_squared\" instead."};
6930 return operator""_kilogram_square_meters_per_second_squared(value);
6933[[nodiscard]]
consteval Torque2D operator""_kilogram_square_meter_per_second_squared(
unsigned long long value) {
6934 if (value != 1ull) {
6936 "Syntax error: Expected \"1_kilogram_square_meter_per_second_squared\". For values other than 1, use the plural form \"_kilogram_square_meters_per_second_squared\" "
6939 return operator""_kilogram_square_meters_per_second_squared(value);
6942[[nodiscard]]
consteval Impulse operator""_Newton_seconds(
long double value) {
6943 return static_cast<Scalar>(value) * NEWTON_SECONDS;
6946[[nodiscard]]
consteval Impulse operator""_Newton_seconds(
unsigned long long value) {
6947 return static_cast<Scalar>(value) * NEWTON_SECONDS;
6950[[nodiscard]]
consteval Impulse operator""_Newton_second(
long double value) {
6951 if (value != 1.0l) {
6952 throw physics::Error{
"Syntax error: Expected \"1.0_Newton_second\". For values other than 1, use the plural form \"_Newton_seconds\" instead."};
6954 return operator""_Newton_seconds(value);
6957[[nodiscard]]
consteval Impulse operator""_Newton_second(
unsigned long long value) {
6958 if (value != 1ull) {
6959 throw physics::Error{
"Syntax error: Expected \"1_Newton_second\". For values other than 1, use the plural form \"_Newton_seconds\" instead."};
6961 return operator""_Newton_seconds(value);
6964[[nodiscard]]
consteval Momentum operator""_kilogram_meters_per_second(
long double value) {
6965 return static_cast<Scalar>(value) * KILOGRAM_METERS_PER_SECOND;
6968[[nodiscard]]
consteval Momentum operator""_kilogram_meters_per_second(
unsigned long long value) {
6969 return static_cast<Scalar>(value) * KILOGRAM_METERS_PER_SECOND;
6972[[nodiscard]]
consteval Momentum operator""_kilogram_meter_per_second(
long double value) {
6973 if (value != 1.0l) {
6974 throw physics::Error{
"Syntax error: Expected \"1.0_kilogram_meter_per_second\". For values other than 1, use the plural form \"_kilogram_meters_per_second\" instead."};
6976 return operator""_kilogram_meters_per_second(value);
6979[[nodiscard]]
consteval Momentum operator""_kilogram_meter_per_second(
unsigned long long value) {
6980 if (value != 1ull) {
6981 throw physics::Error{
"Syntax error: Expected \"1_kilogram_meter_per_second\". For values other than 1, use the plural form \"_kilogram_meters_per_second\" instead."};
6983 return operator""_kilogram_meters_per_second(value);
6987 return static_cast<Scalar>(value) * KILOGRAM_SQUARE_METERS;
6990[[nodiscard]]
consteval MomentOfInertia2D operator""_kilogram_square_meters(
unsigned long long value) {
6991 return static_cast<Scalar>(value) * KILOGRAM_SQUARE_METERS;
6995 if (value != 1.0l) {
6996 throw physics::Error{
"Syntax error: Expected \"1.0_kilogram_square_meter\". For values other than 1, use the plural form \"_kilogram_square_meters\" instead."};
6998 return operator""_kilogram_square_meters(value);
7001[[nodiscard]]
consteval MomentOfInertia2D operator""_kilogram_square_meter(
unsigned long long value) {
7002 if (value != 1ull) {
7003 throw physics::Error{
"Syntax error: Expected \"1_kilogram_square_meter\". For values other than 1, use the plural form \"_kilogram_square_meters\" instead."};
7005 return operator""_kilogram_square_meters(value);
7009 return static_cast<Scalar>(value) * RADIAN_SECONDS;
7013 return static_cast<Scalar>(value) * RADIAN_SECONDS;
7017 if (value != 1.0l) {
7018 throw physics::Error{
"Syntax error: Expected \"1.0_radian_second\". For values other than 1, use the plural form \"_radian_seconds\" instead."};
7020 return operator""_radian_seconds(value);
7024 if (value != 1ull) {
7025 throw physics::Error{
"Syntax error: Expected \"1_radian_second\". For values other than 1, use the plural form \"_radian_seconds\" instead."};
7027 return operator""_radian_seconds(value);
7031 return static_cast<Scalar>(value * 0.01745329251994329576923690768489l) * RADIAN_SECONDS;
7035 return static_cast<Scalar>(
static_cast<long double>(value) * 0.01745329251994329576923690768489l) * RADIAN_SECONDS;
7039 if (value != 1.0l) {
7040 throw physics::Error{
"Syntax error: Expected \"1.0_degree_second\". For values other than 1, use the plural form \"_degree_seconds\" instead."};
7042 return operator""_degree_seconds(value);
7046 if (value != 1ull) {
7047 throw physics::Error{
"Syntax error: Expected \"1_degree_second\". For values other than 1, use the plural form \"_degree_seconds\" instead."};
7049 return operator""_degree_seconds(value);
7053 return static_cast<Scalar>(value * 6.28318530718l) * RADIAN_SECONDS;
7057 return static_cast<Scalar>(
static_cast<long double>(value) * 6.28318530718l) * RADIAN_SECONDS;
7061 if (value != 1.0l) {
7062 throw physics::Error{
"Syntax error: Expected \"1.0_turn_second\". For values other than 1, use the plural form \"_turn_seconds\" instead."};
7064 return operator""_turn_seconds(value);
7068 if (value != 1ull) {
7069 throw physics::Error{
"Syntax error: Expected \"1_turn_second\". For values other than 1, use the plural form \"_turn_seconds\" instead."};
7071 return operator""_turn_seconds(value);
7075 return static_cast<Scalar>(value) * RADIANS_PER_SECOND;
7079 return static_cast<Scalar>(value) * RADIANS_PER_SECOND;
7083 if (value != 1.0l) {
7084 throw physics::Error{
"Syntax error: Expected \"1.0_radian_per_second\". For values other than 1, use the plural form \"_radians_per_second\" instead."};
7086 return operator""_radians_per_second(value);
7090 if (value != 1ull) {
7091 throw physics::Error{
"Syntax error: Expected \"1_radian_per_second\". For values other than 1, use the plural form \"_radians_per_second\" instead."};
7093 return operator""_radians_per_second(value);
7097 return static_cast<Scalar>(value * 0.01745329251994329576923690768489l) * RADIANS_PER_SECOND;
7101 return static_cast<Scalar>(
static_cast<long double>(value) * 0.01745329251994329576923690768489l) * RADIANS_PER_SECOND;
7105 if (value != 1.0l) {
7106 throw physics::Error{
"Syntax error: Expected \"1.0_degree_per_second\". For values other than 1, use the plural form \"_degrees_per_second\" instead."};
7108 return operator""_degrees_per_second(value);
7112 if (value != 1ull) {
7113 throw physics::Error{
"Syntax error: Expected \"1_degree_per_second\". For values other than 1, use the plural form \"_degrees_per_second\" instead."};
7115 return operator""_degrees_per_second(value);
7119 return static_cast<Scalar>(value * 6.28318530718l) * RADIANS_PER_SECOND;
7123 return static_cast<Scalar>(
static_cast<long double>(value) * 6.28318530718l) * RADIANS_PER_SECOND;
7127 if (value != 1.0l) {
7128 throw physics::Error{
"Syntax error: Expected \"1.0_turn_per_second\". For values other than 1, use the plural form \"_turns_per_second\" instead."};
7130 return operator""_turns_per_second(value);
7134 if (value != 1ull) {
7135 throw physics::Error{
"Syntax error: Expected \"1_turn_per_second\". For values other than 1, use the plural form \"_turns_per_second\" instead."};
7137 return operator""_turns_per_second(value);
7141 return static_cast<Scalar>(value * 0.10471975511965977462l) * RADIANS_PER_SECOND;
7144[[nodiscard]]
consteval AngularVelocity2D operator""_revolutions_per_minute(
unsigned long long value) {
7145 return static_cast<Scalar>(
static_cast<long double>(value) * 0.10471975511965977462l) * RADIANS_PER_SECOND;
7149 if (value != 1.0l) {
7150 throw physics::Error{
"Syntax error: Expected \"1.0_revolution_per_minute\". For values other than 1, use the plural form \"_revolutions_per_minute\" instead."};
7152 return operator""_revolutions_per_minute(value);
7155[[nodiscard]]
consteval AngularVelocity2D operator""_revolution_per_minute(
unsigned long long value) {
7156 if (value != 1ull) {
7157 throw physics::Error{
"Syntax error: Expected \"1_revolution_per_minute\". For values other than 1, use the plural form \"_revolutions_per_minute\" instead."};
7159 return operator""_revolutions_per_minute(value);
7163 return static_cast<Scalar>(value) * RADIANS_PER_SECOND_SQUARED;
7167 return static_cast<Scalar>(value) * RADIANS_PER_SECOND_SQUARED;
7171 if (value != 1.0l) {
7172 throw physics::Error{
"Syntax error: Expected \"1.0_radian_per_second_squared\". For values other than 1, use the plural form \"_radians_per_second_squared\" instead."};
7174 return operator""_radians_per_second_squared(value);
7178 if (value != 1ull) {
7179 throw physics::Error{
"Syntax error: Expected \"1_radian_per_second_squared\". For values other than 1, use the plural form \"_radians_per_second_squared\" instead."};
7181 return operator""_radians_per_second_squared(value);
7185 return static_cast<Scalar>(value) * NEWTON_SECONDS_PER_METER;
7189 return static_cast<Scalar>(value) * NEWTON_SECONDS_PER_METER;
7193 if (value != 1.0l) {
7194 throw physics::Error{
"Syntax error: Expected \"1.0_Newton_second_per_meter\". For values other than 1, use the plural form \"_Newton_seconds_per_meter\" instead."};
7196 return operator""_Newton_seconds_per_meter(value);
7200 if (value != 1ull) {
7201 throw physics::Error{
"Syntax error: Expected \"1_Newton_second_per_meter\". For values other than 1, use the plural form \"_Newton_seconds_per_meter\" instead."};
7203 return operator""_Newton_seconds_per_meter(value);
7207 return static_cast<Scalar>(value) * NEWTON_METER_SECONDS_PER_RADIAN;
7211 return static_cast<Scalar>(value) * NEWTON_METER_SECONDS_PER_RADIAN;
7215 if (value != 1.0l) {
7217 "Syntax error: Expected \"1.0_Newton_meter_second_per_radian\". For values other than 1, use the plural form \"_Newton_meter_seconds_per_radian\" instead."};
7219 return operator""_Newton_meter_seconds_per_radian(value);
7223 if (value != 1ull) {
7225 "Syntax error: Expected \"1_Newton_meter_second_per_radian\". For values other than 1, use the plural form \"_Newton_meter_seconds_per_radian\" instead."};
7227 return operator""_Newton_meter_seconds_per_radian(value);
7230[[nodiscard]]
consteval MassFlowRate operator""_kilograms_per_second(
long double value) {
7231 return static_cast<Scalar>(value) * KILOGRAMS_PER_SECOND;
7234[[nodiscard]]
consteval MassFlowRate operator""_kilograms_per_second(
unsigned long long value) {
7235 return static_cast<Scalar>(value) * KILOGRAMS_PER_SECOND;
7238[[nodiscard]]
consteval MassFlowRate operator""_kilogram_per_second(
long double value) {
7239 if (value != 1.0l) {
7240 throw physics::Error{
"Syntax error: Expected \"1.0_kilogram_per_second\". For values other than 1, use the plural form \"_kilograms_per_second\" instead."};
7242 return operator""_kilograms_per_second(value);
7245[[nodiscard]]
consteval MassFlowRate operator""_kilogram_per_second(
unsigned long long value) {
7246 if (value != 1ull) {
7247 throw physics::Error{
"Syntax error: Expected \"1_kilogram_per_second\". For values other than 1, use the plural form \"_kilograms_per_second\" instead."};
7249 return operator""_kilograms_per_second(value);
7253 return static_cast<Scalar>(value) * CUBIC_METERS_PER_SECOND;
7257 return static_cast<Scalar>(value) * CUBIC_METERS_PER_SECOND;
7261 if (value != 1.0l) {
7262 throw physics::Error{
"Syntax error: Expected \"1.0_cubic_meter_per_second\". For values other than 1, use the plural form \"_cubic_meters_per_second\" instead."};
7264 return operator""_cubic_meters_per_second(value);
7268 if (value != 1ull) {
7269 throw physics::Error{
"Syntax error: Expected \"1_cubic_meter_per_second\". For values other than 1, use the plural form \"_cubic_meters_per_second\" instead."};
7271 return operator""_cubic_meters_per_second(value);
7274[[nodiscard]]
consteval Power operator""_Watts(
long double value) {
7275 return static_cast<Scalar>(value) * WATTS;
7278[[nodiscard]]
consteval Power operator""_Watts(
unsigned long long value) {
7279 return static_cast<Scalar>(value) * WATTS;
7282[[nodiscard]]
consteval Power operator""_Watt(
long double value) {
7283 return operator""_Watts(value);
7286[[nodiscard]]
consteval Power operator""_Watt(
unsigned long long value) {
7287 return operator""_Watts(value);
7290[[nodiscard]]
consteval Power operator""_kilowatts(
long double value) {
7291 return static_cast<Scalar>(value * 1000.0l) * WATTS;
7294[[nodiscard]]
consteval Power operator""_kilowatts(
unsigned long long value) {
7295 return static_cast<Scalar>(
static_cast<long double>(value) * 1000.0l) * WATTS;
7298[[nodiscard]]
consteval Power operator""_kilowatt(
long double value) {
7299 return operator""_kilowatts(value);
7302[[nodiscard]]
consteval Power operator""_kilowatt(
unsigned long long value) {
7303 return operator""_kilowatts(value);
7306[[nodiscard]]
consteval Power operator""_megawatts(
long double value) {
7307 return static_cast<Scalar>(value * 1000000.0l) * WATTS;
7310[[nodiscard]]
consteval Power operator""_megawatts(
unsigned long long value) {
7311 return static_cast<Scalar>(
static_cast<long double>(value) * 1000000.0l) * WATTS;
7314[[nodiscard]]
consteval Power operator""_megawatt(
long double value) {
7315 return operator""_megawatts(value);
7318[[nodiscard]]
consteval Power operator""_megawatt(
unsigned long long value) {
7319 return operator""_megawatts(value);
7322[[nodiscard]]
consteval Energy operator""_Joules(
long double value) {
7323 return static_cast<Scalar>(value) * JOULES;
7326[[nodiscard]]
consteval Energy operator""_Joules(
unsigned long long value) {
7327 return static_cast<Scalar>(value) * JOULES;
7330[[nodiscard]]
consteval Energy operator""_Joule(
long double value) {
7331 return operator""_Joules(value);
7334[[nodiscard]]
consteval Energy operator""_Joule(
unsigned long long value) {
7335 return operator""_Joules(value);
7338[[nodiscard]]
consteval Energy operator""_kilojoules(
long double value) {
7339 return static_cast<Scalar>(value * 1000.0l) * JOULES;
7342[[nodiscard]]
consteval Energy operator""_kilojoules(
unsigned long long value) {
7343 return static_cast<Scalar>(
static_cast<long double>(value) * 1000.0l) * JOULES;
7346[[nodiscard]]
consteval Energy operator""_kilojoule(
long double value) {
7347 return operator""_kilojoules(value);
7350[[nodiscard]]
consteval Energy operator""_kilojoule(
unsigned long long value) {
7351 return operator""_kilojoules(value);
7354[[nodiscard]]
consteval Energy operator""_megajoules(
long double value) {
7355 return static_cast<Scalar>(value * 1000000.0l) * JOULES;
7358[[nodiscard]]
consteval Energy operator""_megajoules(
unsigned long long value) {
7359 return static_cast<Scalar>(
static_cast<long double>(value) * 1000000.0l) * JOULES;
7362[[nodiscard]]
consteval Energy operator""_megajoule(
long double value) {
7363 return operator""_megajoules(value);
7366[[nodiscard]]
consteval Energy operator""_megajoule(
unsigned long long value) {
7367 return operator""_megajoules(value);
7370[[nodiscard]]
consteval Energy operator""_kilowatt_hours(
long double value) {
7371 return static_cast<Scalar>(value * 3600000.0l) * JOULES;
7374[[nodiscard]]
consteval Energy operator""_kilowatt_hours(
unsigned long long value) {
7375 return static_cast<Scalar>(
static_cast<long double>(value) * 3600000.0l) * JOULES;
7378[[nodiscard]]
consteval Energy operator""_kilowatt_hour(
long double value) {
7379 if (value != 1.0l) {
7380 throw physics::Error{
"Syntax error: Expected \"1.0_kilowatt_hour\". For values other than 1, use the plural form \"_kilowatt_hours\" instead."};
7382 return operator""_kilowatt_hours(value);
7385[[nodiscard]]
consteval Energy operator""_kilowatt_hour(
unsigned long long value) {
7386 if (value != 1ull) {
7387 throw physics::Error{
"Syntax error: Expected \"1_kilowatt_hour\". For values other than 1, use the plural form \"_kilowatt_hours\" instead."};
7389 return operator""_kilowatt_hours(value);
7392[[nodiscard]]
consteval Energy operator""_megawatt_hours(
long double value) {
7393 return static_cast<Scalar>(value * 3600000000.0l) * JOULES;
7396[[nodiscard]]
consteval Energy operator""_megawatt_hours(
unsigned long long value) {
7397 return static_cast<Scalar>(
static_cast<long double>(value) * 3600000000.0l) * JOULES;
7400[[nodiscard]]
consteval Energy operator""_megawatt_hour(
long double value) {
7401 if (value != 1.0l) {
7402 throw physics::Error{
"Syntax error: Expected \"1.0_megawatt_hour\". For values other than 1, use the plural form \"_megawatt_hours\" instead."};
7404 return operator""_megawatt_hours(value);
7407[[nodiscard]]
consteval Energy operator""_megawatt_hour(
unsigned long long value) {
7408 if (value != 1ull) {
7409 throw physics::Error{
"Syntax error: Expected \"1_megawatt_hour\". For values other than 1, use the plural form \"_megawatt_hours\" instead."};
7411 return operator""_megawatt_hours(value);
7414[[nodiscard]]
consteval Stiffness operator""_Newton_per_meter(
long double value) {
7415 return static_cast<Scalar>(value) * NEWTON_PER_METER;
7418[[nodiscard]]
consteval Stiffness operator""_Newton_per_meter(
unsigned long long value) {
7419 return static_cast<Scalar>(value) * NEWTON_PER_METER;
7422[[nodiscard]]
consteval Stiffness operator""_Newton_per_millimeter(
long double value) {
7423 return static_cast<Scalar>(value * 1000.0l) * NEWTON_PER_METER;
7426[[nodiscard]]
consteval Stiffness operator""_Newton_per_millimeter(
unsigned long long value) {
7427 return static_cast<Scalar>(
static_cast<long double>(value) * 1000.0l) * NEWTON_PER_METER;
7430[[nodiscard]]
consteval Compliance operator""_meters_per_Newton(
long double value) {
7431 return static_cast<Scalar>(value) * METERS_PER_NEWTON;
7434[[nodiscard]]
consteval Compliance operator""_meters_per_Newton(
unsigned long long value) {
7435 return static_cast<Scalar>(value) * METERS_PER_NEWTON;
7438[[nodiscard]]
consteval Compliance operator""_meter_per_Newton(
long double value) {
7439 if (value != 1.0l) {
7440 throw physics::Error{
"Syntax error: Expected \"1.0_meter_per_Newton\". For values other than 1, use the plural form \"_meters_per_Newton\" instead."};
7442 return operator""_meters_per_Newton(value);
7445[[nodiscard]]
consteval Compliance operator""_meter_per_Newton(
unsigned long long value) {
7446 if (value != 1ull) {
7447 throw physics::Error{
"Syntax error: Expected \"1_meter_per_Newton\". For values other than 1, use the plural form \"_meters_per_Newton\" instead."};
7449 return operator""_meters_per_Newton(value);
7452[[nodiscard]]
consteval Compliance operator""_millimeters_per_Newton(
long double value) {
7453 return static_cast<Scalar>(value * 0.001l) * METERS_PER_NEWTON;
7456[[nodiscard]]
consteval Compliance operator""_millimeters_per_Newton(
unsigned long long value) {
7457 return static_cast<Scalar>(value * 0.001l) * METERS_PER_NEWTON;
7460[[nodiscard]]
consteval Compliance operator""_millimeter_per_Newton(
long double value) {
7461 if (value != 1.0l) {
7462 throw physics::Error{
"Syntax error: Expected \"1.0_millimeter_per_Newton\". For values other than 1, use the plural form \"_millimeters_per_Newton\" instead."};
7464 return operator""_millimeters_per_Newton(value);
7467[[nodiscard]]
consteval Compliance operator""_millimeter_per_Newton(
unsigned long long value) {
7468 if (value != 1ull) {
7469 throw physics::Error{
"Syntax error: Expected \"1_millimeter_per_Newton\". For values other than 1, use the plural form \"_millimeters_per_Newton\" instead."};
7471 return operator""_millimeters_per_Newton(value);
7482template <
typename UnitT>
7497 const auto symbolString = UnitT::getSymbolString();
7498 if (!symbolString.empty()) {
7505template <
typename UnitT>
7520 const auto symbolString = UnitT::getSymbolString();
7521 if (!symbolString.empty()) {
7528template <
typename UnitT>
7543 const auto symbolString = UnitT::getSymbolString();
7544 if (!symbolString.empty()) {
7551template <
typename UnitT>
7566 const auto symbolString = UnitT::getSymbolString();
7567 if (!symbolString.empty()) {
7574template <
typename UnitT>
7589 const auto symbolString = UnitT::getSymbolString();
7590 if (!symbolString.empty()) {
7646template <
typename T>
7649template <
typename T>
7654template <grem::
size_t N,
typename UnitT>
7657 writer.serialize(value._private_getUnderlyingValue());
7661template <grem::
size_t N,
typename UnitT>
7664 decltype(value._private_getUnderlyingValue()) underlyingValue{};
7665 reader.deserialize(underlyingValue);
#define GREM_ALWAYS_INLINE
Definition attributes.hpp:10
#define GREM_VECTORCALL
Definition attributes.hpp:51
Optional value type that holds either a value or no value.
Definition Optional.hpp:58
GREM_ALWAYS_INLINE ComponentProxy operator=(Quantity< 1, UnitT > value) const noexcept
Definition quantities.hpp:1867
GREM_ALWAYS_INLINE ComponentProxy operator+=(Quantity< 1, OtherUnitT > value) const noexcept
Definition quantities.hpp:1910
GREM_ALWAYS_INLINE ComponentProxy operator*=(Scalar value) const noexcept
Definition quantities.hpp:1955
GREM_ALWAYS_INLINE ComponentProxy operator-=(Quantity< 1, OtherUnitT > value) const noexcept
Definition quantities.hpp:1933
GREM_ALWAYS_INLINE ComponentProxy operator=(Zero) const noexcept
Definition quantities.hpp:1888
GREM_ALWAYS_INLINE ComponentProxy operator/=(Scalar value) const noexcept
Definition quantities.hpp:1975
GREM_ALWAYS_INLINE constexpr ComponentProxy(Quantity< N, UnitT > &quantity) noexcept
Definition quantities.hpp:1864
GREM_ALWAYS_INLINE constexpr ConstComponentProxy(const Quantity< N, UnitT > &quantity) noexcept
Definition quantities.hpp:1732
typename Unit::MagnitudeType MagnitudeType
Definition quantities.hpp:1726
GREM_ALWAYS_INLINE constexpr auto operator<=>(const Quantity< 1, OtherUnitT > &other) const noexcept
Definition quantities.hpp:1775
GREM_ALWAYS_INLINE constexpr Quantity< 1, Unitless > in(OtherUnitT unit) const
Definition quantities.hpp:1811
GREM_ALWAYS_INLINE constexpr Quantity< 1, OtherUnitT > as(OtherUnitT unit) const
Definition quantities.hpp:1816
typename Unit::DimensionType DimensionType
Definition quantities.hpp:1725
GREM_ALWAYS_INLINE constexpr auto operator<=>(Arithmetic other) const noexcept
Definition quantities.hpp:1785
GREM_ALWAYS_INLINE constexpr auto operator<=>(const ConstComponentProxy< OtherN, OtherUnitT, OtherIndex > &other) const noexcept
Definition quantities.hpp:1765
static constexpr size_t RANK
Definition quantities.hpp:1727
GREM_ALWAYS_INLINE constexpr bool operator==(const ConstComponentProxy< OtherN, OtherUnitT, OtherIndex > &other) const noexcept
Definition quantities.hpp:1760
GREM_ALWAYS_INLINE constexpr bool operator==(const Quantity< 1, OtherUnitT > &other) const noexcept
Definition quantities.hpp:1770
static constexpr DimensionType DIMENSION
Definition quantities.hpp:1729
const Quantity< N, UnitT > * quantity
Definition quantities.hpp:1834
GREM_ALWAYS_INLINE constexpr auto operator<=>(Zero) const noexcept
Definition quantities.hpp:1794
GREM_ALWAYS_INLINE size_t getMaxIndex() const
Definition quantities.hpp:1829
GREM_ALWAYS_INLINE constexpr bool operator==(Arithmetic other) const noexcept
Definition quantities.hpp:1780
GREM_ALWAYS_INLINE constexpr bool operator==(Zero) const noexcept
Definition quantities.hpp:1790
GREM_ALWAYS_INLINE constexpr size_t size() const noexcept
Definition quantities.hpp:1821
GREM_ALWAYS_INLINE constexpr bool operator==(const DurationBase< Rep, Period > &other) const noexcept
Definition quantities.hpp:1799
static constexpr MagnitudeType MAGNITUDE
Definition quantities.hpp:1730
UnitT Unit
Definition quantities.hpp:1724
GREM_ALWAYS_INLINE size_t getMinIndex() const
Definition quantities.hpp:1825
GREM_ALWAYS_INLINE constexpr auto operator<=>(const DurationBase< Rep, Period > &other) const noexcept
Definition quantities.hpp:1805
GREM_ALWAYS_INLINE constexpr Quantity< 1, UnitT > getValue() const noexcept
Definition quantities.hpp:1836
static constexpr Unit UNIT
Definition quantities.hpp:1728
Definition concepts.hpp:85
Concept that checks if a type is a valid physical dimension type.
Definition quantities.hpp:40
Concept that checks if a type is a valid physical magnitude type.
Definition quantities.hpp:311
Concept that checks if a type is a valid physical unit type.
Definition quantities.hpp:515
Definition concepts.hpp:35
@ N
'n'
Definition keyboard.hpp:84
@ T
't'
Definition keyboard.hpp:90
Definition aliases.hpp:15
Definition quantities.hpp:6134
Definition Broadphase.hpp:24
AngularVelocityTensor< 2 > AngularVelocityTensor2D
Tensor of angular velocity quantities in 2-dimensional space. Unit: Radians per second.
Definition quantities.hpp:5966
Rate< 3 > Rate3D
Frequency in 3-dimensional space. Unit: Hertz (AKA per second).
Definition quantities.hpp:5566
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL notEqual(A a, B b)
Definition quantities.hpp:3561
GREM_ALWAYS_INLINE LocalTransformation< N > GREM_VECTORCALL translateRotate(Length< N > localOffset, Orientation< N > localOrientation)
Definition quantities.hpp:5076
Length1D Distance
Scalar length quantity.
Definition quantities.hpp:4962
canonical_unit_t< BaseSqrt< UnitT > > Sqrt
The canonical unit type resulting from taking the square root of a quantity of the given unit.
Definition quantities.hpp:1040
BaseUnit<(UnitT1::DIMENSION+...+UnitTs::DIMENSION),(UnitT1::MAGNITUDE+...+UnitTs::MAGNITUDE)> BaseSum
The base unit type resulting from adding a set of quantities of the given units.
Definition quantities.hpp:830
canonical_unit_t< BaseKilo< UnitT > > Kilo
The canonical unit type corresponding to a given unit with its magnitude scaled by 1000.
Definition quantities.hpp:1165
GREM_ALWAYS_INLINE constexpr auto rotate90DegreesClockwise(A a)
Definition quantities.hpp:4232
constexpr Dimension ANGULAR_ABSEMENT
T.
Definition quantities.hpp:203
consteval auto operator*(const UnitT1 &a, const UnitlessT2 &b)
Get the unit resulting from multiplying a unit by a dimensionless unit with a magnitude of 1.
Definition quantities.hpp:759
LinearAccelerationTensor< 3 > LinearAccelerationTensor3D
Tensor of linear acceleration quantities in 3-dimensional space. Unit: Meters per second squared.
Definition quantities.hpp:5683
GREM_ALWAYS_INLINE auto GREM_VECTORCALL abs(A a)
Definition quantities.hpp:3217
AngularImpulse< 2 > AngularImpulse2D
Angular impulse in 2-dimensional space. Unit: Newton meter seconds.
Definition quantities.hpp:6030
Force< 1 > Force1D
Force in 1-dimensional space. Unit: Newton (AKA kilogram meters per second squared).
Definition quantities.hpp:5694
GREM_ALWAYS_INLINE Direction3D getAxis(Orientation3D orientation)
Definition quantities.hpp:4785
AbsoluteAngles< 3 > PitchYawRoll
Absolute angles in 3-dimensional space.
Definition quantities.hpp:4062
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL distance2(A a, B b)
Definition quantities.hpp:3316
ForceTensor< 2 > ForceTensor2D
Tensor of force quantities in 2-dimensional space. Unit: Newton (AKA kilogram meters per second squar...
Definition quantities.hpp:5707
LocalTransformation< 2 > LocalTransformation2D
Affine transformation in 2-dimensional local space.
Definition quantities.hpp:5059
AngularQuantity< N, NewtonMeters > Torque
Torque quantity.
Definition quantities.hpp:5718
Direction< 2 > Direction2D
Normalized unit vector in 2-dimensional space. Unitless.
Definition quantities.hpp:4151
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL minComponent(A a)
Definition quantities.hpp:3082
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL lessThan(A a, B b)
Definition quantities.hpp:3595
InverseLocalTransformation< 2 > InverseLocalTransformation2D
Inverse of an affine transformation in 2-dimensional local space.
Definition quantities.hpp:5303
GREM_ALWAYS_INLINE constexpr Quantity< N, UnitT > &GREM_VECTORCALL operator+=(Quantity< N, UnitT > &a, detail::quantity_convertible auto b)
Definition quantities.hpp:2897
Force< 2 > Force2D
Force in 2-dimensional space. Unit: Newton (AKA kilogram meters per second squared).
Definition quantities.hpp:5695
BaseUnit< D, Magnitude< 1.0l >{}> BaseSIUnit
The base relative SI unit type for a given dimension.
Definition quantities.hpp:1283
Quantity< N, MetersPerSecondSquared > LinearAcceleration
Linear acceleration quantity.
Definition quantities.hpp:5660
AngularImpulse< 3 > AngularImpulse3D
Angular impulse in 3-dimensional space. Unit: Newton meter seconds.
Definition quantities.hpp:6031
LinearVelocityTensor< 2 > LinearVelocityTensor2D
Tensor of linear velocity quantities in 2-dimensional space. Unit: Meters per second.
Definition quantities.hpp:5642
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL length(A a)
Definition quantities.hpp:3302
GREM_ALWAYS_INLINE constexpr Quantity< N, UnitT > &GREM_VECTORCALL operator/=(Quantity< N, UnitT > &a, detail::quantity_convertible auto b)
Definition quantities.hpp:2977
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL cross(A a, B b)
Definition quantities.hpp:3239
Quantity< 1, MetersPerNewton > Compliance
Compliance quantity.
Definition quantities.hpp:6132
canonical_unit_t< BaseReciprocal< UnitT > > Reciprocal
The canonical unit type resulting from taking the multiplicative inverse of a quantity of the given u...
Definition quantities.hpp:1072
TorqueTensor< 3 > TorqueTensor3D
Tensor of torque quantities in 3-dimensional space. Unit: Newton meters (AKA kilogram square meters p...
Definition quantities.hpp:5732
AbsoluteAngles< 2 > Roll
Absolute angle in 2-dimensional space.
Definition quantities.hpp:4048
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL lessThanEqual(A a, B b)
Definition quantities.hpp:3629
SquaredLength SquaredDistance
Scalar squared length quantity.
Definition quantities.hpp:4976
AngularSpeed RollRate
Time derivative of roll.
Definition quantities.hpp:5981
constexpr Dimension ENERGY
M L^2 T^-2.
Definition quantities.hpp:216
AngularVelocity< 2 > AngularVelocity2D
Angular velocity in 2-dimensional space. Unit: Radians per second.
Definition quantities.hpp:5947
AngularFrequency< 3 > AngularFrequency3D
Angular frequency in 3-dimensional space. Unit: Hertz (AKA per second).
Definition quantities.hpp:5588
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL unlerp(A value, B minValue, C maxValue)
Definition quantities.hpp:3414
BaseProduct< UnitT, UnitT, UnitT > BaseCubic
The base unit type resulting from taking the cube of a quantity of the given unit.
Definition quantities.hpp:1124
GREM_ALWAYS_INLINE InverseLocalTransformation< N > GREM_VECTORCALL inverseTranslate(Length< N > localOffset)
Definition quantities.hpp:5339
constexpr SIUnit< D > SI_UNIT
The canonical relative SI unit for a given dimension.
Definition quantities.hpp:1299
constexpr Direction2D Y_AXIS_2D
The Y axis in 2-dimensional space.
Definition quantities.hpp:4902
constexpr Dimension ANGULAR_VELOCITY
T^-1.
Definition quantities.hpp:204
GREM_ALWAYS_INLINE AbsoluteAngle getPitch(Orientation3D orientation)
Definition quantities.hpp:4789
Quantity< 1, RadiansPerSecond > AngularSpeed
Scalar angular speed quantity.
Definition quantities.hpp:5955
Quantity< 1, Absolute< Radians > > AbsoluteAngle
Absolute angle in world space.
Definition quantities.hpp:4031
GREM_ALWAYS_INLINE OrthonormalBasis2D rotate(RollRotation r)
Definition quantities.hpp:4723
InverseLocalTransformation< 3 > InverseLocalTransformation3D
Inverse of an affine transformation in 3-dimensional local space.
Definition quantities.hpp:5304
Quantity< 1, SquareMeters > Area
Scalar area quantity.
Definition quantities.hpp:5525
constexpr Direction3D Z_AXIS_3D
The Z axis in 3-dimensional space.
Definition quantities.hpp:4914
LinearVelocityTensor< 3 > LinearVelocityTensor3D
Tensor of linear velocity quantities in 3-dimensional space. Unit: Meters per second.
Definition quantities.hpp:5643
GREM_ALWAYS_INLINE auto GREM_VECTORCALL signbit(A a)
Definition quantities.hpp:3150
AngularQuantity< N, NewtonMeterSeconds > AngularImpulse
Angular impulse quantity.
Definition quantities.hpp:6029
AngularAbsement< 2 > AngularAbsement2D
Angular absement in 2-dimensional space. Unit: Radian seconds.
Definition quantities.hpp:5935
MomentOfInertiaTensor< 3 > MomentOfInertiaTensor3D
Tensor of moment of inertia quantities in 3-dimensional space. Unit: Kilogram square meters.
Definition quantities.hpp:5826
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL cos(A a)
Definition quantities.hpp:3340
Angle getAngleDifferenceAroundAxis(Direction3D axis, Quantity< 3, UnitT > a, Quantity< 3, UnitT > b)
Get the smallest signed angle around an axis between two relative vectors.
Definition quantities.hpp:4852
Quantity< 2, RadiansPerSecond > PitchYawRates
Time derivatives of pitch and yaw.
Definition quantities.hpp:5988
Quantity< 3, Radians > PitchYawRollRotations
Relative rotations of pitch, yaw and roll.
Definition quantities.hpp:4083
LinearVelocity< 1 > LinearVelocity1D
Linear velocity in 1-dimensional space. Unit: Meters per second.
Definition quantities.hpp:5619
std::conditional_t< N==3, TensorQuantity< 3, UnitT >, Quantity< 1, UnitT > > AngularTensorQuantity
Definition quantities.hpp:3857
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL tryDivide(A a, B b)
Definition quantities.hpp:3383
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL inversesqrt(A a)
Definition quantities.hpp:3287
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL midpoint(A a, B b)
Definition quantities.hpp:3497
InverseTransformation< 3 > InverseTransformation3D
Inverse of an affine transformation in 3-dimensional space.
Definition quantities.hpp:5435
typename canonical_unit< UnitT >::type canonical_unit_t
Canonical unit type of a given unit.
Definition quantities.hpp:536
Quantity< 1, PerMeter > Wavenumber
Scalar wavenumber quantity.
Definition quantities.hpp:5608
consteval auto kilo(UnitT a)
Get the canonical unit corresponding to a given unit with its magnitude scaled by 1000.
Definition quantities.hpp:1176
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL clamp(Quantity< N1, UnitT1 > a, Quantity< N2, UnitT2 > b, Quantity< N3, UnitT3 > c)
Definition quantities.hpp:3020
AngularFrequency< 2 > AngularFrequency2D
Angular frequency in 2-dimensional space. Unit: Hertz (AKA per second).
Definition quantities.hpp:5587
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL min(Quantity< N1, UnitT1 > a, Quantity< N2, UnitT2 > b)
Definition quantities.hpp:2982
constexpr Dimension WORK
M L^2 T^-2.
Definition quantities.hpp:214
ForceTensor< 3 > ForceTensor3D
Tensor of force quantities in 3-dimensional space. Unit: Newton (AKA kilogram meters per second squar...
Definition quantities.hpp:5708
LinearAbsement< 2 > LinearAbsement2D
Linear absement in 2-dimensional space. Unit: Meter seconds.
Definition quantities.hpp:5600
InverseTransformation< 2 > InverseTransformation2D
Inverse of an affine transformation in 2-dimensional space.
Definition quantities.hpp:5434
consteval auto cubic(UnitT a)
Get the canonical unit resulting from taking the cube of a quantity of a given unit.
Definition quantities.hpp:1144
decltype(auto) getNormalComponent(Quantity< N, UnitT > &v)
Definition quantities.hpp:3950
float Scalar
Underlying scalar type of physics quantity components.
Definition quantities.hpp:1480
LinearImpulse< 2 > LinearImpulse2D
Linear impulse in 2-dimensional space. Unit: Newton seconds (AKA kilogram meters per second).
Definition quantities.hpp:5744
consteval auto operator+(const UnitT &a)
Get the unit resulting from taking the additive identity of a quantity of a unit.
Definition quantities.hpp:688
constexpr Dimension MOMENTUM
M L T^-1.
Definition quantities.hpp:201
std::conditional_t< N==3, Mask< N >, Mask< 1 > > AngularMask
Angular boolean quantity.
Definition quantities.hpp:2805
GREM_ALWAYS_INLINE constexpr auto inverseTranspose(const TensorQuantity< N, UnitT > &a)
Definition quantities.hpp:3875
constexpr Dimension ABSEMENT
L T.
Definition quantities.hpp:194
Quantity< 1, Square< CubicMeters > > SquaredVolume
Scalar squared volume quantity.
Definition quantities.hpp:5546
constexpr Dimension< 0, 0, 0 > DIMENSIONLESS
Identity dimension.
Definition quantities.hpp:185
OrthonormalBasis< 3 > OrthonormalBasis3D
Basis in 3-dimensional space whose columns are all unit vectors that are orthogonal to each other....
Definition quantities.hpp:4408
Quantity< N, NewtonSeconds > LinearImpulse
Linear impulse quantity.
Definition quantities.hpp:5742
constexpr OrthonormalBasis2D BASIS_2D
Identity basis in 2-dimensional space.
Definition quantities.hpp:4874
GREM_ALWAYS_INLINE constexpr auto flipY(A a)
Definition quantities.hpp:4258
GREM_ALWAYS_INLINE auto GREM_VECTORCALL fmod(A a, B b)
Definition quantities.hpp:3201
GREM_ALWAYS_INLINE LocalTransformation< N > GREM_VECTORCALL translateRotateScale(Length< N > localOffset, Orientation< N > localOrientation, Scale< N > localScale)
Definition quantities.hpp:5063
AngularVelocityTensor< 3 > AngularVelocityTensor3D
Tensor of angular velocity quantities in 3-dimensional space. Unit: Radians per second.
Definition quantities.hpp:5967
Mask< 3 > Mask3D
Boolean quantity in 3-dimensional space. Unitless.
Definition quantities.hpp:2795
LocalInertiaOrientation< 2 > LocalInertiaOrientation2D
Local inertia orientation of an object in 2-dimensional space. Unit: Radians.
Definition quantities.hpp:5885
GREM_ALWAYS_INLINE PitchYawRoll getPitchYawRoll(Orientation3D orientation)
Definition quantities.hpp:4805
Quantity< N, MeterSeconds > LinearAbsement
Linear absement quantity.
Definition quantities.hpp:5598
canonical_unit_t< BaseDifference< UnitT1, UnitT2 > > Difference
The canonical unit type resulting from subtracting two quantities of the given units.
Definition quantities.hpp:860
canonical_unit_t< BaseCenti< UnitT > > Centi
The canonical unit type corresponding to a given unit with its magnitude scaled by 1/100.
Definition quantities.hpp:1229
AngularQuantity< N, PerKilogramSquareMeter > InverseMomentOfInertia
Inverse moment of inertia quantity.
Definition quantities.hpp:5836
constexpr Dimension< 0, 1, 0 > LENGTH
L.
Definition quantities.hpp:187
constexpr Dimension INTEGRATED_ROTATIONAL_MOMENTUM
M L^2.
Definition quantities.hpp:211
Quantity< 1, KilogramsPerSecond > MassFlowRate
Scalar mass flow rate quantity.
Definition quantities.hpp:6090
constexpr Dimension MOMENT_OF_INERTIA
M L^2.
Definition quantities.hpp:202
Direction< 3 > Direction3D
Normalized unit vector in 3-dimensional space. Unitless.
Definition quantities.hpp:4152
Orientation< 2 > Orientation2D
Absolute orientation in 2-dimensional space. Unit: Radians.
Definition quantities.hpp:4592
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL flipSignIf(A a, bool b)
Definition quantities.hpp:4155
OrthonormalBasis< 2 > OrthonormalBasis2D
Basis in 2-dimensional space whose columns are all unit vectors that are orthogonal to each other....
Definition quantities.hpp:4407
GREM_ALWAYS_INLINE auto GREM_VECTORCALL pow(A a, B b)
Definition quantities.hpp:3193
AngularQuantity< N, Unitless > AngularScale
Angular dimensionless scale.
Definition quantities.hpp:4010
AngularMask< 2 > AngularMask2D
Angular boolean quantity in 2-dimensional space. Unitless.
Definition quantities.hpp:2806
constexpr Dimension TORQUE
M L^2 T^-2.
Definition quantities.hpp:199
Position< 1 > Position1D
Absolute position in 1-dimensional space. Unit: Meters.
Definition quantities.hpp:4950
constexpr Dimension DENSITY
M L^-3.
Definition quantities.hpp:192
Orientation< 3 > Orientation3D
Absolute orientation in 3-dimensional space. Unit: Radians.
Definition quantities.hpp:4593
GREM_ALWAYS_INLINE constexpr auto transpose(const TensorQuantity< N, UnitT > &a)
Definition quantities.hpp:3870
AngularImpulseTensor< 3 > AngularImpulseTensor3D
Tensor of angular impulse quantities in 3-dimensional space. Unit: Newton meter seconds (AKA kilogram...
Definition quantities.hpp:6044
GREM_ALWAYS_INLINE constexpr auto inverse(Quantity< N, UnitT > a)
Definition quantities.hpp:3860
Basis< 3 > Basis3D
Basis matrix in 3-dimensional space. Unitless.
Definition quantities.hpp:4000
canonical_unit_t< BaseRelative< UnitT > > Relative
The canonical unit type corresponding to a given unit with its magnitude made relative.
Definition quantities.hpp:953
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL distance(A a, B b)
Definition quantities.hpp:3309
InverseMomentOfInertiaTensor< 2 > InverseMomentOfInertiaTensor2D
Tensor of inverse moment of inertia quantities in 2-dimensional space. Unit: Per kilogram square mete...
Definition quantities.hpp:5849
consteval auto absolute(UnitT a)
Get the canonical unit corresponding to a given unit with its magnitude made absolute.
Definition quantities.hpp:1019
AngularQuantity< N, RadiansPerSecondSquared > AngularAcceleration
Angular acceleration quantity.
Definition quantities.hpp:6005
BaseUnit< sqrt(UnitT::DIMENSION), sqrt(UnitT::MAGNITUDE)> BaseSqrt
The base unit type resulting from taking the square root of a quantity of the given unit.
Definition quantities.hpp:1031
constexpr Dimension POWER
M L^2 T^-3.
Definition quantities.hpp:215
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL acos(A a)
Definition quantities.hpp:3361
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL greaterThanEqual(A a, B b)
Definition quantities.hpp:3697
typename in_base_units< UnitT >::type in_base_units_t
Corresponding instantiation of the BaseUnit type template of a given unit type.
Definition quantities.hpp:820
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL asin(A a)
Definition quantities.hpp:3366
LengthTensor< 2 > LengthTensor2D
Tensor of length quantities in 2-dimensional space. Unit: Meters.
Definition quantities.hpp:4938
canonical_unit_t< BaseDeci< UnitT > > Deci
The canonical unit type corresponding to a given unit with its magnitude scaled by 1/10.
Definition quantities.hpp:1197
canonical_unit_t< BaseMilli< UnitT > > Milli
The canonical unit type corresponding to a given unit with its magnitude scaled by 1/1000.
Definition quantities.hpp:1261
constexpr ComponentSwizzle< 0 > X
Tag specifying the X component at index 0 of a vector.
Definition quantities.hpp:1492
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL expDecay(A value, B targetValue, Frequency decayRate, Duration deltaTime)
Definition quantities.hpp:3477
Quantity< 1, Watts > Power
Scalar mechanical power quantity.
Definition quantities.hpp:6111
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL clampLength(A value, B maxLength)
Definition quantities.hpp:3731
Quantity< 1, CubicMeters > Volume
Scalar volume quantity.
Definition quantities.hpp:5539
Quantity< 1, Seconds > Time
Scalar relative time duration quantity.
Definition quantities.hpp:5518
GREM_ALWAYS_INLINE Orientation3D GREM_VECTORCALL slerp(Orientation3D a, Orientation3D b, Coefficient alpha)
Definition quantities.hpp:4683
Quantity< 1, Joules > Work
Scalar mechanical work quantity.
Definition quantities.hpp:6104
LinearAcceleration< 2 > LinearAcceleration2D
Linear acceleration in 2-dimensional space. Unit: Meters per second squared.
Definition quantities.hpp:5662
TensorQuantity< N, MetersPerSecondSquared > LinearAccelerationTensor
Tensor of linear acceleration quantities.
Definition quantities.hpp:5681
Quantity< 1, PerKilogram > InverseMass
Scalar inverse mass quantity.
Definition quantities.hpp:5511
Quantity< 2, Absolute< Radians > > PitchYaw
Absolute angles in 3-dimensional space without roll.
Definition quantities.hpp:4055
GREM_ALWAYS_INLINE LocalTransformation< N > GREM_VECTORCALL translate(Length< N > localOffset)
Definition quantities.hpp:5094
TensorQuantity< N, NewtonSeconds > LinearImpulseTensor
Tensor of linear impulse quantities.
Definition quantities.hpp:5765
Force< 3 > Force3D
Force in 3-dimensional space. Unit: Newton (AKA kilogram meters per second squared).
Definition quantities.hpp:5696
constexpr Direction3D Y_AXIS_3D
The Y axis in 3-dimensional space.
Definition quantities.hpp:4903
constexpr Direction< N > Z_AXIS
The Z axis in the space with the given number of dimensions.
Definition quantities.hpp:4911
Scale< 3 > Scale3D
Dimensionless scale in 3-dimensional space. Unitless.
Definition quantities.hpp:3987
Quantity< 1, Square< SquareMeters > > SquaredArea
Scalar squared area quantity.
Definition quantities.hpp:5532
GREM_ALWAYS_INLINE auto GREM_VECTORCALL isfinite(A a)
Definition quantities.hpp:3124
GREM_ALWAYS_INLINE constexpr auto rotate90DegreesCounterclockwise(A a)
Definition quantities.hpp:4219
Basis< 2 > Basis2D
Basis matrix in 2-dimensional space. Unitless.
Definition quantities.hpp:3999
TensorQuantity< N, Unitless > Basis
Basis matrix.
Definition quantities.hpp:3998
Length< 1 > Length1D
Relative distance/length offset in 1-dimensional space. Unit: Meters.
Definition quantities.hpp:4925
GREM_ALWAYS_INLINE auto GREM_VECTORCALL exp2(A a)
Definition quantities.hpp:3186
GREM_ALWAYS_INLINE auto GREM_VECTORCALL exp(A a)
Definition quantities.hpp:3179
LinearMomentum< 2 > LinearMomentum2D
Linear momentum in 2-dimensional space. Unit: Kilogram meters per second.
Definition quantities.hpp:5779
AngularTensorQuantity< N, KilogramSquareMetersPerSecond > AngularMomentumTensor
Tensor of angular momentum quantities.
Definition quantities.hpp:6067
AngularMomentumTensor< 2 > AngularMomentumTensor2D
Tensor of angular momentum quantities in 2-dimensional space. Unit: Kilogram square meters per second...
Definition quantities.hpp:6068
Mask< 2 > Mask2D
Boolean quantity in 2-dimensional space. Unitless.
Definition quantities.hpp:2794
InverseMomentOfInertiaTensor< 3 > InverseMomentOfInertiaTensor3D
Tensor of inverse moment of inertia quantities in 3-dimensional space. Unit: Per kilogram square mete...
Definition quantities.hpp:5850
constexpr Dimension< 1, 0, 0 > MASS
M.
Definition quantities.hpp:186
AngularMomentum< 2 > AngularMomentum2D
Angular momentum in 2-dimensional space. Unit: kilogram square meters per second.
Definition quantities.hpp:6056
Quantity< 1, Joules > Energy
Scalar energy quantity.
Definition quantities.hpp:6118
GREM_ALWAYS_INLINE constexpr auto tryDecomposeMagnitudeDirection(A a)
Definition quantities.hpp:4299
Quantity< 1, NewtonPerMeter > Stiffness
Stiffness quantity.
Definition quantities.hpp:6125
constexpr Dimension ANGULAR_MOMENTUM
M L^2 T^-1.
Definition quantities.hpp:207
canonical_unit_t< BaseSIUnit< D > > SIUnit
The canonical relative SI unit type for a given dimension.
Definition quantities.hpp:1291
BaseMultipleOf< UnitT, 0.01l > BaseCenti
The base unit type corresponding to a given unit with its magnitude scaled by 1/100.
Definition quantities.hpp:1220
GREM_ALWAYS_INLINE auto GREM_VECTORCALL isnan(A a)
Definition quantities.hpp:3134
Quantity< 1, NewtonMeterSecondsPerRadian > AngularViscousDamping
Scalar angular viscous damping quantity.
Definition quantities.hpp:6083
Rate< 1 > Rate1D
Frequency in 1-dimensional space. Unit: Hertz (AKA per second).
Definition quantities.hpp:5564
LinearImpulseTensor< 2 > LinearImpulseTensor2D
Tensor of linear impulse quantities in 2-dimensional space. Unit: Newton seconds (AKA kilogram meters...
Definition quantities.hpp:5766
LinearMomentumTensor< 3 > LinearMomentumTensor3D
Tensor of linear momentum quantities in 3-dimensional space. Unit: Kilogram meters per second.
Definition quantities.hpp:5802
constexpr Direction< N > Y_AXIS
The Y axis in the space with the given number of dimensions.
Definition quantities.hpp:4897
GREM_ALWAYS_INLINE Direction2D convertAnglesToForwardDirection(Roll angles)
Definition quantities.hpp:4809
LinearImpulseTensor< 3 > LinearImpulseTensor3D
Tensor of linear impulse quantities in 3-dimensional space. Unit: Newton seconds (AKA kilogram meters...
Definition quantities.hpp:5767
AngularAcceleration< 3 > AngularAcceleration3D
Angular acceleration in 3-dimensional space. Unit: Radians per second squared.
Definition quantities.hpp:6007
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL select(auto condition, A ifTrue, B ifFalse)
Definition quantities.hpp:3437
BaseUnit<(UnitT1::DIMENSION *... *UnitTs::DIMENSION),(UnitT1::MAGNITUDE *... *UnitTs::MAGNITUDE)> BaseProduct
The base unit type resulting from multiplying a set of quantities of the given units.
Definition quantities.hpp:870
AngularAcceleration< 2 > AngularAcceleration2D
Angular acceleration in 2-dimensional space. Unit: Radians per second squared.
Definition quantities.hpp:6006
LinearMomentum1D Momentum
Scalar linear momentum quantity.
Definition quantities.hpp:5790
GREM_ALWAYS_INLINE AbsoluteAngle getYaw(Orientation3D orientation)
Definition quantities.hpp:4793
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL step(A edge, B value)
Definition quantities.hpp:3428
constexpr Dimension INTEGRATED_POSITIONAL_MOMENTUM
M L.
Definition quantities.hpp:209
MomentOfInertiaTensor< 2 > MomentOfInertiaTensor2D
Tensor of moment of inertia quantities in 2-dimensional space. Unit: Kilogram square meters.
Definition quantities.hpp:5825
constexpr Direction3D X_AXIS_3D
The X axis in 3-dimensional space.
Definition quantities.hpp:4889
AngularVelocity< 3 > AngularVelocity3D
Angular velocity in 3-dimensional space. Unit: Radians per second.
Definition quantities.hpp:5948
consteval auto operator-(const UnitT &a)
Get the unit resulting from taking the additive inverse of a quantity of a unit.
Definition quantities.hpp:705
GREM_ALWAYS_INLINE auto GREM_VECTORCALL wrap(A a, B b)
Definition quantities.hpp:3209
AngularTensorQuantity< N, NewtonMeterSeconds > AngularImpulseTensor
Tensor of angular impulse quantities.
Definition quantities.hpp:6041
GREM_ALWAYS_INLINE Basis< N > scale(Quantity< N, UnitT > s)
Definition quantities.hpp:4708
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL lerp(A a, B b, C alpha)
Definition quantities.hpp:3404
constexpr Dimension AREA
L^2.
Definition quantities.hpp:190
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL reflect(A a, B normal)
Definition quantities.hpp:3395
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL greaterThan(A a, B b)
Definition quantities.hpp:3663
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL product(A a)
Definition quantities.hpp:3054
LinearImpulse1D Impulse
Scalar linear impulse quantity.
Definition quantities.hpp:5755
GREM_ALWAYS_INLINE AbsoluteAngle getRoll(Orientation2D orientation)
Definition quantities.hpp:4797
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL round(A a)
Definition quantities.hpp:3506
LinearAcceleration1D Acceleration
Linear acceleration quantity. Unit: Meters per second squared.
Definition quantities.hpp:5664
constexpr Dimension INTEGRATED_POSITIONAL_IMPULSE
M L.
Definition quantities.hpp:208
TensorQuantity< N, Newton > ForceTensor
Tensor of force quantities.
Definition quantities.hpp:5706
constexpr Dimension ANGULAR_IMPULSE
M L^2 T^-1.
Definition quantities.hpp:206
BaseUnit< UnitT::DIMENSION, Magnitude< UnitT::MagnitudeType::VALUE, false >{}> BaseRelative
The base unit type corresponding to a given unit with its magnitude made relative.
Definition quantities.hpp:944
GREM_ALWAYS_INLINE constexpr Quantity< N, UnitT > &GREM_VECTORCALL operator-=(Quantity< N, UnitT > &a, detail::quantity_convertible auto b)
Definition quantities.hpp:2921
MomentOfInertia< 3 > MomentOfInertia3D
Moment of inertia in 3-dimensional space. Unit: Kilogram square meters.
Definition quantities.hpp:5814
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL ceil(A a)
Definition quantities.hpp:3520
GREM_ALWAYS_INLINE InverseLocalTransformation< N > GREM_VECTORCALL inverseTranslateRotateScale(Length< N > localOffset, Orientation< N > localOrientation, Scale< N > localScale)
Definition quantities.hpp:5307
consteval auto per(UnitT a)
Get the canonical unit resulting from taking the multiplicative inverse of a quantity of a given unit...
Definition quantities.hpp:1083
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL tan(A a)
Definition quantities.hpp:3354
constexpr Direction< N > X_AXIS
The X axis in the space with the given number of dimensions.
Definition quantities.hpp:4883
LinearAbsement< 3 > LinearAbsement3D
Linear absement in 3-dimensional space. Unit: Meter seconds.
Definition quantities.hpp:5601
consteval auto deci(UnitT a)
Get the canonical unit corresponding to a given unit with its magnitude scaled by 1/10.
Definition quantities.hpp:1208
constexpr Quantity< 1, UnitT > Quantity< 1, UnitT >::MACHINE_EPSILON
Definition quantities.hpp:1702
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL floor(A a)
Definition quantities.hpp:3513
GREM_ALWAYS_INLINE auto GREM_VECTORCALL isinf(A a)
Definition quantities.hpp:3129
consteval auto multipleOf(UnitT a)
Get the canonical unit corresponding to a given unit with its magnitude scaled by a given multiplier.
Definition quantities.hpp:932
constexpr Dimension WAVENUMBER
L^-1.
Definition quantities.hpp:195
Quantity< 1, Kilograms > Mass
Scalar mass quantity.
Definition quantities.hpp:5504
canonical_unit_t< BaseMultipleOf< UnitT, Multiple > > MultipleOf
The canonical unit type corresponding to a given unit with its magnitude scaled by a given multiplier...
Definition quantities.hpp:919
AngularAccelerationTensor< 2 > AngularAccelerationTensor2D
Tensor of angular acceleration quantities in 2-dimensional space. Unit: Radians per second squared.
Definition quantities.hpp:6018
GREM_ALWAYS_INLINE constexpr auto tryDecomposeMagnitudeAngle(A a)
Definition quantities.hpp:4321
MomentArmTensor< 3 > MomentArmTensor3D
Tensor of moment arm quantities in 3-dimensional space. Unit: Meters.
Definition quantities.hpp:5924
consteval auto square(UnitT a)
Get the canonical unit resulting from squaring a quantity of a given unit.
Definition quantities.hpp:1112
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL sin(A a)
Definition quantities.hpp:3347
LinearVelocity1D Speed
Scalar linear velocity quantity.
Definition quantities.hpp:5631
Scale1D Coefficient
Unitless scalar quantity.
Definition quantities.hpp:3988
AngularTensorQuantity< N, PerKilogramSquareMeter > InverseMomentOfInertiaTensor
Tensor of inverse moment of inertia quantities.
Definition quantities.hpp:5848
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL moveTowards(A value, B targetValue, C amount)
Definition quantities.hpp:3463
constexpr Dimension FORCE
M L T^-2.
Definition quantities.hpp:198
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL normalize(A a)
Definition quantities.hpp:4187
constexpr Dimension< 0, 0, 1 > TIME
T.
Definition quantities.hpp:188
GREM_ALWAYS_INLINE auto GREM_VECTORCALL copysign(A a, B b)
Definition quantities.hpp:4175
LinearMomentum< 3 > LinearMomentum3D
Linear momentum in 3-dimensional space. Unit: Kilogram meters per second.
Definition quantities.hpp:5780
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL length2(A a)
Definition quantities.hpp:3295
AngularQuantity< N, Absolute< Radians > > AbsoluteAngles
Absolute angles in world space.
Definition quantities.hpp:4041
GREM_ALWAYS_INLINE constexpr auto decomposeMagnitudeAngle(A a)
Definition quantities.hpp:4316
BaseMultipleOf< UnitT, 1000.0l > BaseKilo
The base unit type corresponding to a given unit with its magnitude scaled by 1000.
Definition quantities.hpp:1156
constexpr Dimension ANGULAR_ACCELERATION
T^-2.
Definition quantities.hpp:205
LinearVelocity< 2 > LinearVelocity2D
Linear velocity in 2-dimensional space. Unit: Meters per second.
Definition quantities.hpp:5620
TensorQuantity< N, Meters > LengthTensor
Tensor of length quantities.
Definition quantities.hpp:4937
consteval auto centi(UnitT a)
Get the canonical unit corresponding to a given unit with its magnitude scaled by 1/100.
Definition quantities.hpp:1240
Angle getAngleDifference(AbsoluteAngle a, AbsoluteAngle b)
Get the smallest signed angle between two absolute angles.
Definition quantities.hpp:4837
std::conditional_t< N==1, bool, vec< N, bool > > Mask
Boolean quantity.
Definition quantities.hpp:2792
Length< 3 > Length3D
Relative distance/length offset in 3-dimensional space. Unit: Meters.
Definition quantities.hpp:4927
GREM_ALWAYS_INLINE TensorQuantity< N, UnitT > rotateScale(Orientation< N > r, Quantity< N, UnitT > s)
Definition quantities.hpp:4757
Transformation< 2 > Transformation2D
Affine transformation in 2-dimensional space.
Definition quantities.hpp:5183
AngularTensorQuantity< N, RadiansPerSecondSquared > AngularAccelerationTensor
Tensor of angular acceleration quantities.
Definition quantities.hpp:6017
Quantity< N, Newton > Force
Force quantity.
Definition quantities.hpp:5693
MomentArmTensor< 2 > MomentArmTensor2D
Tensor of moment arm quantities in 2-dimensional space. Unit: Meters.
Definition quantities.hpp:5923
BaseMultipleOf< UnitT, 0.001l > BaseMilli
The base unit type corresponding to a given unit with its magnitude scaled by 1/1000.
Definition quantities.hpp:1252
Torque< 3 > Torque3D
Torque in 3-dimensional space. Unit: Newton meters (AKA kilogram square meters per second squared).
Definition quantities.hpp:5720
BaseUnit< DIMENSIONLESS/UnitT::DIMENSION, Magnitude< 1.0l/UnitT::MagnitudeType::VALUE, UnitT::MagnitudeType::IS_ABSOLUTE >{}> BaseReciprocal
The base unit type resulting from taking the multiplicative inverse of a quantity of the given unit.
Definition quantities.hpp:1063
MomentArm< 2 > MomentArm2D
Moment arm in 2-dimensional space. Unit: Meters.
Definition quantities.hpp:5911
constexpr Dimension ACCELERATION
L T^-2.
Definition quantities.hpp:197
AngularAbsement< 3 > AngularAbsement3D
Angular absement in 3-dimensional space. Unit: Radian seconds.
Definition quantities.hpp:5936
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL getAngle(A a)
Definition quantities.hpp:3323
Quantity< 1, CubicMetersPerSecond > VolumetricFlowRate
Scalar volumetric flow rate quantity.
Definition quantities.hpp:6097
canonical_unit_t< BaseQuotient< UnitT1, UnitT2 > > Quotient
The canonical unit type resulting from dividing two quantities of the given units.
Definition quantities.hpp:899
Quantity< N, Meters > Length
Relative distance/length offset quantity.
Definition quantities.hpp:4924
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL sum(A a)
Definition quantities.hpp:3025
Quantity< 1, SquareMeters > SquaredLength
Scalar squared length quantity.
Definition quantities.hpp:4969
Quantity< 2, Radians > PitchYawRotations
Relative rotations of pitch and yaw.
Definition quantities.hpp:4076
LocalInertiaOrientation< 3 > LocalInertiaOrientation3D
Local inertia orientation of an object in 3-dimensional space. Unit: Radians.
Definition quantities.hpp:5886
MomentArm< 3 > MomentArm3D
Moment arm in 3-dimensional space. Unit: Meters.
Definition quantities.hpp:5912
GREM_ALWAYS_INLINE LocalTransformation< N > GREM_VECTORCALL translateScale(Length< N > localOffset, Scale< N > localScale)
Definition quantities.hpp:5089
constexpr Dimension VELOCITY
L T^-1.
Definition quantities.hpp:196
Quantity< N, Hertz > Rate
Frequency quantity.
Definition quantities.hpp:5563
constexpr ComponentSwizzle< 2 > Z
Tag specifying the Z component at index 2 of a vector.
Definition quantities.hpp:1494
InversePrincipalMomentsOfInertia< 2 > InversePrincipalMomentsOfInertia2D
Inverse principal moments of inertia in 2-dimensional inertia major axis space. Unit: Per kilogram sq...
Definition quantities.hpp:5897
consteval auto sqrt(UnitT a)
Get the canonical unit resulting from taking the square root of a quantity of a given unit.
Definition quantities.hpp:1051
Rotation< 3 > Rotation3D
Relative rotation in 3-dimensional space. Unit: Radians.
Definition quantities.hpp:4095
Quantity< N, KilogramMetersPerSecond > LinearMomentum
Linear momentum quantity.
Definition quantities.hpp:5777
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL sign(A a)
Definition quantities.hpp:3165
AngularQuantity< N, Radians > Rotation
Relative rotation quantity.
Definition quantities.hpp:4093
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL dot(A a, B b)
Definition quantities.hpp:3234
AngularQuantity< N, RadiansPerSecond > AngularVelocity
Angular velocity quantity.
Definition quantities.hpp:5946
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL tryNormalize(A a)
Definition quantities.hpp:4201
constexpr Dimension VOLUMETRIC_FLOW_RATE
L^3 T^-1.
Definition quantities.hpp:213
consteval auto relative(UnitT a)
Get the canonical unit corresponding to a given unit with its magnitude made relative.
Definition quantities.hpp:964
LinearAbsement< 1 > LinearAbsement1D
Linear absement in 1-dimensional space. Unit: Meter seconds.
Definition quantities.hpp:5599
Position< 3 > Position3D
Absolute position in 3-dimensional space. Unit: Meters.
Definition quantities.hpp:4952
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL mix(A a, B b, C alpha)
Definition quantities.hpp:3423
TensorQuantity< N, Meters > MomentArmTensor
Tensor of moment arm quantities.
Definition quantities.hpp:5922
TensorQuantity< N, NewtonMeters > TorqueTensor
Tensor of torque quantities.
Definition quantities.hpp:5730
AngularTensorQuantity< N, RadiansPerSecond > AngularVelocityTensor
Tensor of angular velocity quantities.
Definition quantities.hpp:5965
Rate1D Frequency
Scalar frequency quantity.
Definition quantities.hpp:5576
PrincipalMomentsOfInertia< 3 > PrincipalMomentsOfInertia3D
Principal moments of inertia in 3-dimensional inertia major axis space. Unit: kilogram square meters.
Definition quantities.hpp:5862
Quantity< 1, KilogramsPerCubicMeter > Density
Scalar density quantity.
Definition quantities.hpp:5553
Quantity< N, Absolute< Meters > > Position
Absolute position in world space.
Definition quantities.hpp:4949
LinearImpulse< 1 > LinearImpulse1D
Linear impulse in 1-dimensional space. Unit: Newton seconds (AKA kilogram meters per second).
Definition quantities.hpp:5743
Quantity< N, Unitless > Scale
Dimensionless scale.
Definition quantities.hpp:3984
AngularQuantity< N, KilogramSquareMeters > MomentOfInertia
Moment of inertia quantity.
Definition quantities.hpp:5812
consteval auto operator/(const UnitT1 &a, const UnitlessT2 &b)
Get the unit resulting from dividing a unit by a dimensionless unit with a magnitude of 1.
Definition quantities.hpp:799
TorqueTensor< 2 > TorqueTensor2D
Tensor of torque quantities in 2-dimensional space. Unit: Newton meters (AKA kilogram square meters p...
Definition quantities.hpp:5731
BaseProduct< UnitT, UnitT > BaseSquare
The base unit type resulting from squaring a quantity of the given unit.
Definition quantities.hpp:1094
MomentOfInertia< 2 > MomentOfInertia2D
Moment of inertia in 2-dimensional space. Unit: Kilogram square meters.
Definition quantities.hpp:5813
InverseMomentOfInertia< 2 > InverseMomentOfInertia2D
Inverse moment of inertia in 2-dimensional space. Unit: Kilogram square meters.
Definition quantities.hpp:5837
constexpr ComponentSwizzle< 1 > Y
Tag specifying the Y component at index 1 of a vector.
Definition quantities.hpp:1493
std::conditional_t< N==3, Quantity< 3, UnitT >, Quantity< 1, UnitT > > AngularQuantity
Physical quantity type representing an angular quantity in world space, with one component in 2D and ...
Definition quantities.hpp:1515
GREM_ALWAYS_INLINE InverseLocalTransformation< N > GREM_VECTORCALL inverseTranslateRotate(Length< N > localOffset, Orientation< N > localOrientation)
Definition quantities.hpp:5321
LinearMomentum< 1 > LinearMomentum1D
Linear momentum in 1-dimensional space. Unit: Kilogram meters per second.
Definition quantities.hpp:5778
constexpr Angle PI
Pi constant.
Definition quantities.hpp:4024
Quantity< 1, NewtonSecondsPerMeter > LinearViscousDamping
Scalar linear viscous damping quantity.
Definition quantities.hpp:6076
AngularTensorQuantity< N, KilogramSquareMeters > MomentOfInertiaTensor
Tensor of moment of inertia quantities.
Definition quantities.hpp:5824
constexpr Dimension ANGLE
Definition quantities.hpp:189
PrincipalMomentsOfInertia< 2 > PrincipalMomentsOfInertia2D
Principal moments of inertia in 2-dimensional inertia major axis space. Unit: kilogram square meters.
Definition quantities.hpp:5861
constexpr OrthonormalBasis3D BASIS_3D
Identity basis in 3-dimensional space.
Definition quantities.hpp:4875
LinearVelocity< 3 > LinearVelocity3D
Linear velocity in 3-dimensional space. Unit: Meters per second.
Definition quantities.hpp:5621
AngularImpulseTensor< 2 > AngularImpulseTensor2D
Tensor of angular impulse quantities in 2-dimensional space. Unit: Newton meter seconds (AKA kilogram...
Definition quantities.hpp:6042
LinearMomentumTensor< 2 > LinearMomentumTensor2D
Tensor of linear momentum quantities in 2-dimensional space. Unit: Kilogram meters per second.
Definition quantities.hpp:5801
AngularMomentumTensor< 3 > AngularMomentumTensor3D
Tensor of angular momentum quantities in 3-dimensional space. Unit: Kilogram square meters per second...
Definition quantities.hpp:6069
GREM_ALWAYS_INLINE constexpr Quantity< N, UnitT > &GREM_VECTORCALL operator*=(Quantity< N, UnitT > &a, detail::quantity_convertible auto b)
Definition quantities.hpp:2949
GREM_ALWAYS_INLINE Roll convertForwardDirectionToAngles(Direction2D forward)
Definition quantities.hpp:4821
LinearImpulse< 3 > LinearImpulse3D
Linear impulse in 3-dimensional space. Unit: Newton seconds (AKA kilogram meters per second).
Definition quantities.hpp:5745
LengthTensor< 3 > LengthTensor3D
Tensor of length quantities in 3-dimensional space. Unit: Meters.
Definition quantities.hpp:4939
AngularAccelerationTensor< 3 > AngularAccelerationTensor3D
Tensor of angular acceleration quantities in 3-dimensional space. Unit: Radians per second squared.
Definition quantities.hpp:6019
Quantity< 1, Radians > Angle
Angle quantity.
Definition quantities.hpp:4019
Mask< 1 > Mask1D
Boolean quantity in 1-dimensional space. Unitless.
Definition quantities.hpp:2793
AngularQuantity< N, RadianSeconds > AngularAbsement
Angular absement quantity.
Definition quantities.hpp:5934
LinearAcceleration< 3 > LinearAcceleration3D
Linear acceleration in 3-dimensional space. Unit: Meters per second squared.
Definition quantities.hpp:5663
LocalTransformation< 3 > LocalTransformation3D
Affine transformation in 3-dimensional local space.
Definition quantities.hpp:5060
TensorQuantity< N, KilogramMetersPerSecond > LinearMomentumTensor
Tensor of linear momentum quantities.
Definition quantities.hpp:5800
GREM_ALWAYS_INLINE constexpr auto flipZ(A a)
Definition quantities.hpp:4272
BaseUnit<(UnitT1::DIMENSION/UnitT2::DIMENSION),(UnitT1::MAGNITUDE/UnitT2::MAGNITUDE)> BaseQuotient
The base unit type resulting from dividing two quantities of the given units.
Definition quantities.hpp:889
constexpr Direction2D X_AXIS_2D
The X axis in 2-dimensional space.
Definition quantities.hpp:4888
BaseUnit<(UnitT1::DIMENSION - UnitT2::DIMENSION),(UnitT1::MAGNITUDE - UnitT2::MAGNITUDE)> BaseDifference
The base unit type resulting from subtracting two quantities of the given units.
Definition quantities.hpp:850
auto getTangentialComponent(const Quantity< N, UnitT > &v)
Definition quantities.hpp:3968
BaseUnit< UnitT::DIMENSION, UnitT::MAGNITUDE *Magnitude< Multiple >{}> BaseMultipleOf
The base unit type corresponding to a given unit with its magnitude scaled by a given multiplier.
Definition quantities.hpp:909
consteval bool operator==(UnitT1 a, UnitT2 b)
Compare two physical units for equality.
Definition quantities.hpp:670
Quantity< N, MetersPerSecond > LinearVelocity
Linear velocity quantity.
Definition quantities.hpp:5618
GREM_ALWAYS_INLINE InverseLocalTransformation< N > GREM_VECTORCALL inverseTranslateScale(Length< N > localOffset, Scale< N > localScale)
Definition quantities.hpp:5334
InverseMomentOfInertia< 3 > InverseMomentOfInertia3D
Inverse moment of inertia in 3-dimensional space. Unit: Kilogram square meters.
Definition quantities.hpp:5838
Torque< 2 > Torque2D
Torque in 2-dimensional space. Unit: Newton meters (AKA kilogram square meters per second squared).
Definition quantities.hpp:5719
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL atan2(A a, B b)
Definition quantities.hpp:3376
TensorQuantity< N, MetersPerSecond > LinearVelocityTensor
Tensor of linear velocity quantities.
Definition quantities.hpp:5641
Rate< 2 > Rate2D
Frequency in 2-dimensional space. Unit: Hertz (AKA per second).
Definition quantities.hpp:5565
Quantity< 3, RadiansPerSecond > PitchYawRollRates
Time derivatives of pitch, yaw and roll.
Definition quantities.hpp:5995
constexpr Dimension FREQUENCY
T^-1.
Definition quantities.hpp:193
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL max(Quantity< N1, UnitT1 > a, Quantity< N2, UnitT2 > b)
Definition quantities.hpp:3001
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL tryGetAngle(A a)
Definition quantities.hpp:3330
BaseUnit< UnitT::DIMENSION, Magnitude< UnitT::MagnitudeType::VALUE, true >{}> BaseAbsolute
The base unit type corresponding to a given unit with its magnitude made absolute.
Definition quantities.hpp:976
AngularQuantity< N, Hertz > AngularFrequency
Angular frequency quantity.
Definition quantities.hpp:5586
Quantity< 1, Square< MetersPerSecondSquared > > SquaredAcceleration
Scalar squared acceleration quantity.
Definition quantities.hpp:5671
LinearAccelerationTensor< 2 > LinearAccelerationTensor2D
Tensor of linear acceleration quantities in 2-dimensional space. Unit: Meters per second squared.
Definition quantities.hpp:5682
canonical_unit_t< BaseSquare< UnitT > > Square
The canonical unit type resulting from squaring a quantity of the given unit.
Definition quantities.hpp:1102
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL maxComponent(A a)
Definition quantities.hpp:3103
Scale< 1 > Scale1D
Dimensionless scale in 1-dimensional space. Unitless.
Definition quantities.hpp:3985
AngularScale< 2 > AngularScale2D
Angular dimensionless scale in 2-dimensional space. Unitless.
Definition quantities.hpp:4011
Position< 2 > Position2D
Absolute position in 2-dimensional space. Unit: Meters.
Definition quantities.hpp:4951
constexpr Dimension VOLUME
L^3.
Definition quantities.hpp:191
constexpr Dimension MASS_FLOW_RATE
M T^-1.
Definition quantities.hpp:212
canonical_unit_t< BaseCubic< UnitT > > Cubic
The canonical unit type resulting from taking the cube of a quantity of the given unit.
Definition quantities.hpp:1133
AngularMask< 3 > AngularMask3D
Angular boolean quantity in 2-dimensional space. Unitless.
Definition quantities.hpp:2807
GREM_ALWAYS_INLINE constexpr auto flipX(A a)
Definition quantities.hpp:4245
constexpr Dimension IMPULSE
M L T^-1.
Definition quantities.hpp:200
canonical_unit_t< BaseSum< UnitT1, UnitTs... > > Sum
The canonical unit type resulting from adding a set of quantities of the given units.
Definition quantities.hpp:840
AngularQuantity< N, Reciprocal< KilogramSquareMeters > > InversePrincipalMomentsOfInertia
Inverse principal moments of inertia in inertia major axis space.
Definition quantities.hpp:5896
constexpr Dimension INTEGRATED_ROTATIONAL_IMPULSE
M L^2.
Definition quantities.hpp:210
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL equal(A a, B b)
Definition quantities.hpp:3527
AngularMomentum< 3 > AngularMomentum3D
Angular momentum in 3-dimensional space. Unit: kilogram square meters per second.
Definition quantities.hpp:6057
consteval auto milli(UnitT a)
Get the canonical unit corresponding to a given unit with its magnitude scaled by 1/1000.
Definition quantities.hpp:1272
Scale< 2 > Scale2D
Dimensionless scale in 2-dimensional space. Unitless.
Definition quantities.hpp:3986
InversePrincipalMomentsOfInertia< 3 > InversePrincipalMomentsOfInertia3D
Inverse principal moments of inertia in 3-dimensional inertia major axis space. Unit: Per kilogram sq...
Definition quantities.hpp:5899
constexpr OrthonormalBasis< N > BASIS
Identity basis for the given number of dimensions.
Definition quantities.hpp:4862
Quantity< 1, Square< MetersPerSecond > > SquaredSpeed
Scalar squared speed quantity.
Definition quantities.hpp:5650
AngularQuantity< N, KilogramSquareMetersPerSecond > AngularMomentum
Angular momentum quantity.
Definition quantities.hpp:6055
AngularQuantity< N, KilogramSquareMeters > PrincipalMomentsOfInertia
Principal moments of inertia in inertia major axis space.
Definition quantities.hpp:5860
Quantity< 1, Square< RadiansPerSecond > > SquaredAngularSpeed
Scalar squared angular speed quantity.
Definition quantities.hpp:5974
canonical_unit_t< BaseProduct< UnitT1, UnitTs... > > Product
The canonical unit type resulting from multiplying a set of quantities of the given units.
Definition quantities.hpp:880
BaseMultipleOf< UnitT, 0.1l > BaseDeci
The base unit type corresponding to a given unit with its magnitude scaled by 1/10.
Definition quantities.hpp:1188
AngularScale< 3 > AngularScale3D
Angular dimensionless scale in 3-dimensional space. Unitless.
Definition quantities.hpp:4012
AngularQuantity< N, Meters > MomentArm
Moment arm quantity.
Definition quantities.hpp:5910
Rotation< 2 > Rotation2D
Relative rotation in 2-dimensional space. Unit: Radians.
Definition quantities.hpp:4094
GREM_ALWAYS_INLINE constexpr auto decomposeMagnitudeDirection(A a)
Definition quantities.hpp:4292
Length< 2 > Length2D
Relative distance/length offset in 2-dimensional space. Unit: Meters.
Definition quantities.hpp:4926
GREM_ALWAYS_INLINE constexpr auto GREM_VECTORCALL atan(A a)
Definition quantities.hpp:3371
Transformation< 3 > Transformation3D
Affine transformation in 3-dimensional space.
Definition quantities.hpp:5184
Angle RollRotation
Relative rotation of roll.
Definition quantities.hpp:4069
LinearAcceleration< 1 > LinearAcceleration1D
Linear acceleration in 1-dimensional space. Unit: Meters per second squared.
Definition quantities.hpp:5661
Definition aliases.hpp:20
GREM_ALWAYS_INLINE qua< T > GREM_VECTORCALL quatLookAt(vec< 3, T > direction, vec< 3, T > up)
Definition math.hpp:3230
GREM_ALWAYS_INLINE constexpr bool GREM_VECTORCALL lessThan(T a, T b)
Definition math.hpp:1240
Clock::duration Duration
Definition Clock.hpp:25
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL cos(vec< N, T > a)
Definition math.hpp:1389
constexpr tuple_element_t< Index, Pair< T1, T2 > > & get(Pair< T1, T2 > &t) noexcept
Definition Pair.hpp:202
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL sin(vec< N, T > a)
Definition math.hpp:1393
GREM_ALWAYS_INLINE constexpr bool GREM_VECTORCALL lessThanEqual(T a, T b)
Definition math.hpp:1245
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL asin(vec< N, T > a)
Definition math.hpp:1395
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL flipSignIf(T value, bool flip)
Get a value with its sign flipped if a boolean is true.
Definition math.hpp:3983
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL sqrt(T a)
Get the square root of a value.
Definition math.hpp:1114
GREM_ALWAYS_INLINE constexpr bool GREM_VECTORCALL notEqual(T a, T b)
Definition math.hpp:1235
GREM_ALWAYS_INLINE qua< T > GREM_VECTORCALL roll(T angle)
Definition math.hpp:3263
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL normalize(vec< N, T > a)
Convert a vector to a unit vector of length 1 in the same direction.
Definition math.hpp:2057
GREM_ALWAYS_INLINE constexpr vec< N, T > flipY(vec< N, T > a)
Get a vector flipped along the Y axis.
Definition math.hpp:3943
vec< 4, bool > bvec4
Definition math.hpp:372
constexpr auto count(input_range auto &&range, const auto &value)
Definition algorithms.hpp:234
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL wrap(T value, T limit) noexcept
Wrap a scalar value around a range of non-negative values.
Definition math.hpp:1218
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL floor(vec< N, T > a)
Definition math.hpp:1421
GREM_ALWAYS_INLINE constexpr mat< 1, 1, T > GREM_VECTORCALL inverseTranspose(const mat< 1, 1, T > &a)
Definition math.hpp:2343
DurationBase< int64_t, Ratio< 60 *60, 1 > > Hours
Definition time.hpp:51
GREM_ALWAYS_INLINE constexpr decltype(auto) clamp(T &&value, Low &&minValue, High &&maxValue)
Clamp a value to a specific interval.
Definition fundamentals.hpp:630
GREM_ALWAYS_INLINE T GREM_VECTORCALL getPitch(qua< T > orientation)
Definition math.hpp:3190
GREM_ALWAYS_INLINE constexpr Optional< T > GREM_VECTORCALL tryDivide(T a, T b)
Try to divide a floating-point value by a scalar and produce a defined result.
Definition math.hpp:2101
GREM_ALWAYS_INLINE constexpr bool GREM_VECTORCALL greaterThan(T a, T b)
Definition math.hpp:1250
DurationBase< int64_t, Ratio< 1, 1 '000 > > Milliseconds
Definition time.hpp:54
float float32_t
Definition fundamentals.hpp:155
GREM_ALWAYS_INLINE constexpr qua< T > slerp(qua< T > a, qua< T > b, T alpha)
Perform spherical linear interpolation (slerp) between two quaternions.
Definition math.hpp:3814
GREM_ALWAYS_INLINE qua< T > GREM_VECTORCALL yaw(T angle)
Definition math.hpp:3257
GREM_ALWAYS_INLINE T copysign(T magnitude, T sign)
Get a value with the sign of a different value.
Definition math.hpp:3601
GREM_ALWAYS_INLINE qua< T > GREM_VECTORCALL pitch(T angle)
Definition math.hpp:3251
GREM_ALWAYS_INLINE constexpr mat< R, C, T > transpose(const mat< C, R, T > &a)
Definition math.hpp:2247
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL cross(vec< 2, T > a, vec< 2, T > b)
Definition math.hpp:2426
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL pow(T a, T b) noexcept
Calculate the result of raising a given value to a given power.
Definition math.hpp:1179
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL abs(vec< N, T > a)
Definition math.hpp:1386
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL exp(T a) noexcept
Calculate the result of Euler's number raised to a given power.
Definition math.hpp:1154
GREM_ALWAYS_INLINE constexpr T expDecay(T value, T targetValue, Frequency decayRate, Duration deltaTime)
Exponentially decay a value towards a target value over a given time.
Definition math.hpp:4118
GREM_ALWAYS_INLINE qua< T > GREM_VECTORCALL angleAxis(T angle, vec< 3, T > axis)
Definition math.hpp:3245
GREM_ALWAYS_INLINE constexpr T clampLength(T value, T maxLength)
Get a value with the same sign as a given value, but whose magnitude has been clamped to a maximum le...
Definition math.hpp:4025
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL step(T edge, T value)
Evaluate a step function with a given edge value.
Definition math.hpp:3642
GREM_ALWAYS_INLINE constexpr vec< N, T > flipX(vec< N, T > a)
Get a vector flipped along the X axis.
Definition math.hpp:3930
GREM_ALWAYS_INLINE vec< 2, T > GREM_VECTORCALL convertAnglesToForwardDirection(T rollAngle)
Definition math.hpp:3336
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL product(vec< 1, T > a)
Definition math.hpp:1876
std::ratio< Num, Den > Ratio
Definition time.hpp:19
String formatString(FormatString< Args... > format, const Args &... args)
Format specification syntax examples:
Definition formatting.hpp:448
constexpr auto rotate(forward_range auto &&range, auto middle)
Definition algorithms.hpp:641
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL minComponent(vec< 1, T > a)
Definition math.hpp:1898
DurationBase< int64_t, Ratio< 60, 1 > > Minutes
Definition time.hpp:52
GREM_ALWAYS_INLINE T GREM_VECTORCALL getRoll(qua< T > orientation)
Definition math.hpp:3201
GREM_ALWAYS_INLINE vec< 1, bool > GREM_VECTORCALL isinf(const vec< 1, T > &values)
Check if each component of a vector is infinity.
Definition math.hpp:3480
vec< 3, bool > bvec3
Definition math.hpp:371
std::chrono::duration< Rep, Period > DurationBase
Definition time.hpp:39
GREM_ALWAYS_INLINE constexpr vec< N, T > reflect(vec< N, T > a, vec< N, T > normal)
Get a vector reflected against a plane with a given normal vector.
Definition math.hpp:3970
DurationBase< int64_t, Ratio< 1, 1 > > Seconds
Definition time.hpp:53
constexpr bool equal(input_range auto &&rangeA, input_range auto &&rangeB)
Definition algorithms.hpp:358
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL mix(T a, T b, T alpha)
Blend between two values based on an alpha value.
Definition math.hpp:3837
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL ceil(vec< N, T > a)
Definition math.hpp:1422
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL atan(vec< N, T > a)
Definition math.hpp:1399
GREM_ALWAYS_INLINE T GREM_VECTORCALL convertForwardDirectionToAngles(vec< 2, T > forward)
Definition math.hpp:3351
StringBase< char, std::char_traits< char >, std::allocator< char > > String
Definition String.hpp:17
GREM_ALWAYS_INLINE constexpr decltype(auto) max(A &&a, B &&b)
Get the greater of two values, or the first value if they are equivalent.
Definition fundamentals.hpp:598
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL fmod(T a, T b) noexcept
Calculate the floating-point remainder of a scalar division.
Definition math.hpp:1192
GREM_ALWAYS_INLINE constexpr vec< N, T > flipZ(vec< N, T > a)
Get a vector flipped along the Z axis.
Definition math.hpp:3956
GREM_ALWAYS_INLINE vec< N, bool > GREM_VECTORCALL signbit(vec< N, T > values)
Get the sign bits of the components of a vector.
Definition math.hpp:3584
GREM_ALWAYS_INLINE constexpr bool GREM_VECTORCALL greaterThanEqual(T a, T b)
Definition math.hpp:1255
GREM_ALWAYS_INLINE qua< T > GREM_VECTORCALL convertAnglesToQuaternion(T pitchAngle, T yawAngle, T rollAngle)
Definition math.hpp:3271
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL round(vec< N, T > a)
Definition math.hpp:1418
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL tan(vec< N, T > a)
Definition math.hpp:1397
GREM_ALWAYS_INLINE qua< T > GREM_VECTORCALL convert3x3MatrixToQuaternion(const mat< 3, 3, T > &a)
Definition math.hpp:2569
GREM_ALWAYS_INLINE qua< T > GREM_VECTORCALL rotation(vec< 3, T > from, vec< 3, T > to)
Definition math.hpp:3214
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL exp2(T a) noexcept
Calculate the result of 2 raised to a given power.
Definition math.hpp:1166
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL inversesqrt(T a)
Get the reciprocal of the square root of a value.
Definition math.hpp:1136
GREM_ALWAYS_INLINE constexpr qua< T > GREM_VECTORCALL conjugate(qua< T > a)
Definition math.hpp:2260
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL getAngle(vec< 2, T > a)
Get the absolute angle of a 2-dimensional vector, in radians.
Definition math.hpp:2136
GREM_ALWAYS_INLINE vec< 1, bool > GREM_VECTORCALL isnan(const vec< 1, T > &values)
Check if each component of a vector is NaN (not a number).
Definition math.hpp:3532
GREM_ALWAYS_INLINE constexpr mat< 1, 1, T > GREM_VECTORCALL inverse(const mat< 1, 1, T > &a)
Definition math.hpp:2267
GREM_ALWAYS_INLINE vec< 3, T > GREM_VECTORCALL getAxis(qua< T > orientation)
Definition math.hpp:3182
StringViewBase< char, std::char_traits< char > > StringView
Definition StringView.hpp:16
GREM_ALWAYS_INLINE constexpr vec< N, T > GREM_VECTORCALL acos(vec< N, T > a)
Definition math.hpp:1391
GREM_ALWAYS_INLINE constexpr decltype(auto) min(A &&a, B &&b)
Get the smaller of two values, or the first value if they are equivalent.
Definition fundamentals.hpp:585
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL sign(T a)
Get the sign multiplier of a scalar.
Definition math.hpp:1204
GREM_ALWAYS_INLINE constexpr Optional< T > GREM_VECTORCALL tryGetAngle(vec< 2, T > a)
Try to get the absolute angle of a 2-dimensional vector, in radians.
Definition math.hpp:2149
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL sum(vec< 1, T > a)
Definition math.hpp:1854
GREM_ALWAYS_INLINE T GREM_VECTORCALL getYaw(qua< T > orientation)
Definition math.hpp:3195
GREM_ALWAYS_INLINE constexpr T GREM_VECTORCALL maxComponent(vec< 1, T > a)
Definition math.hpp:1920
GREM_ALWAYS_INLINE vec< 1, bool > GREM_VECTORCALL isfinite(const vec< 1, T > &values)
Check if each component of a vector is finite.
Definition math.hpp:3428
GREM_ALWAYS_INLINE constexpr T moveTowards(T value, T targetValue, T delta)
Move a value linearly towards a target by some distance, without overshoot.
Definition math.hpp:4077
GREM_ALWAYS_INLINE constexpr T select(bool condition, T ifTrue, T ifFalse)
Choose between two values based on a condition.
Definition math.hpp:927
Definition fundamentals.hpp:27
static constexpr T MAX
Definition fundamentals.hpp:29
static constexpr T MIN
Definition fundamentals.hpp:28
void deserializeFrom(auto &reader, grem::physics::Quantity< N, UnitT > &value)
Definition quantities.hpp:7663
Base template to specialize in order to implement JSON deserialization for a specific type.
Definition json.hpp:4569
void serializeTo(auto &writer, const grem::physics::Quantity< N, UnitT > &value)
Definition quantities.hpp:7656
Base template to specialize in order to implement JSON serialization for a specific type.
Definition json.hpp:4551
The canonical unit type corresponding to a given unit with its magnitude made absolute.
Definition quantities.hpp:985
consteval Absolute(UnitT other)
Implicitly convert a unit to its absolute unit.
Definition quantities.hpp:998
static constexpr auto getSymbolString()
Get an ASCII string representation of the unit symbol of this unit, e.g. "kg m^2/s" if D is ANGULAR_M...
Definition quantities.hpp:987
Physical base unit type template.
Definition quantities.hpp:545
static constexpr auto getSymbolString()
Get an ASCII string representation of the unit symbol of this unit, e.g. "kg m^2/s" if D is ANGULAR_M...
Definition quantities.hpp:557
consteval auto operator+(const OtherUnitT &other) const
Get the canonical unit resulting from adding a quantity of another unit to a quantity of this unit.
Definition quantities.hpp:609
consteval auto operator/(const OtherUnitT &other) const
Get the canonical unit resulting from dividing a quantity of this unit by a quantity of another unit.
Definition quantities.hpp:654
static constexpr MagnitudeType MAGNITUDE
Definition quantities.hpp:549
consteval auto operator-() const
Get the canonical unit resulting from taking the additive inverse of a quantity of this unit.
Definition quantities.hpp:595
consteval auto operator+() const
Get the canonical unit resulting from taking the additive identity of a quantity of this unit.
Definition quantities.hpp:584
consteval auto operator-(const OtherUnitT &other) const
Get the canonical unit resulting from subtracting a quantity of another unit from a quantity of this ...
Definition quantities.hpp:624
static constexpr DimensionType DIMENSION
Definition quantities.hpp:548
consteval auto operator*(const OtherUnitT &other) const
Get the canonical unit resulting from multiplying a quantity of this unit with a quantity of another ...
Definition quantities.hpp:639
std::remove_cvref_t< decltype(M)> MagnitudeType
Magintude type of the unit.
Definition quantities.hpp:547
std::remove_cvref_t< decltype(D)> DimensionType
Dimension type of the unit.
Definition quantities.hpp:546
Tag type for specifying a specific vector components.
Definition quantities.hpp:1489
static constexpr size_t INDEX
Index of the corresponding vector component.
Definition quantities.hpp:1490
Definition quantities.hpp:4310
Quantity< 1, Radians > angle
Definition quantities.hpp:4312
Definition quantities.hpp:4286
Direction< N > direction
Definition quantities.hpp:4288
Physical dimension type template.
Definition quantities.hpp:56
static constexpr int LENGTH
Length exponent of the dimension.
Definition quantities.hpp:58
consteval bool operator==(const Dimension &other) const noexcept
Compare this dimension to another for equality.
Definition quantities.hpp:76
static constexpr int MASS
Mass exponent of the dimension.
Definition quantities.hpp:57
friend consteval auto sqrt(const Dimension &dimension)
Get the dimension resulting from taking the square root of a quantity of a dimension.
Definition quantities.hpp:176
consteval bool operator==(const Dimension< OtherMass, OtherLength, OtherTime > &other) const noexcept
Compare this dimension to another for equality.
Definition quantities.hpp:89
consteval auto operator+(const Dimension &other) const
Get the dimension resulting from adding a quantity of another dimension to a quantity of this dimensi...
Definition quantities.hpp:122
consteval auto operator+() const
Get the dimension resulting from taking the additive identity of a quantity of this dimension.
Definition quantities.hpp:100
static constexpr auto getSIUnitSymbolString()
Get an ASCII string representation of the symbol of the SI unit for this dimension,...
Definition quantities.hpp:219
static constexpr int TIME
Time exponent of the dimension.
Definition quantities.hpp:59
consteval auto operator-(const Dimension &other) const
Get the dimension resulting from subtracting a quantity of another dimension from a quantity of this ...
Definition quantities.hpp:135
consteval auto operator-() const
Get the dimension resulting from taking the additive inverse of a quantity of this dimension.
Definition quantities.hpp:110
consteval auto operator/(const Dimension< OtherMass, OtherLength, OtherTime > &other) const
Get the dimension resulting from dividing a quantity of this dimension by a quantity of another dimen...
Definition quantities.hpp:163
consteval auto operator*(const Dimension< OtherMass, OtherLength, OtherTime > &other) const
Get the dimension resulting from multiplying a quantity of this dimension with a quantity of another ...
Definition quantities.hpp:149
Normalized unit vector.
Definition quantities.hpp:4105
GREM_ALWAYS_INLINE constexpr Direction() noexcept
Definition quantities.hpp:4121
GREM_ALWAYS_INLINE constexpr bool operator==(const Quantity< 2, OtherUnitT > &other) const noexcept
Definition quantities.hpp:4135
GREM_ALWAYS_INLINE constexpr Direction GREM_VECTORCALL operator-() const
Definition quantities.hpp:4143
GREM_ALWAYS_INLINE constexpr bool operator==(Zero other) const noexcept
Definition quantities.hpp:4139
GREM_ALWAYS_INLINE constexpr bool operator==(const Direction &other) const noexcept
Definition quantities.hpp:4130
static GREM_ALWAYS_INLINE constexpr Direction reinterpret(auto other)
Definition quantities.hpp:4117
Exception type for domain-specific errors originating from the grem::physics module.
Definition Error.hpp:17
Local inertia orientation of an object, rotating from inertia major axis space to shape-local space.
Definition quantities.hpp:5873
Physical magnitude type template.
Definition quantities.hpp:326
consteval auto operator*(const Magnitude< OtherValue, OtherIsAbsolute > &other) const
Get the magnitude resulting from multiplying a quantity of this magnitude with a quantity of another ...
Definition quantities.hpp:443
consteval auto operator-(const Magnitude< OtherValue, OtherIsAbsolute > &other) const
Get the magnitude resulting from subtracting a quantity of another magnitude from a quantity of this ...
Definition quantities.hpp:420
consteval auto operator-() const
Get the magnitude resulting from taking the additive inverse of a quantity of this magnitude.
Definition quantities.hpp:378
consteval bool operator==(const Magnitude &other) const noexcept
Compare this magnitude to another for equality.
Definition quantities.hpp:337
consteval bool operator==(const Magnitude< OtherValue, OtherIsAbsolute > &other) const noexcept
Compare this magnitude to another for equality.
Definition quantities.hpp:350
static constexpr bool IS_ABSOLUTE
Simplified indicator of the magnitude's reference frame (true for global world space,...
Definition quantities.hpp:328
consteval auto operator+(const Magnitude< OtherValue, OtherIsAbsolute > &other) const
Get the magnitude resulting from adding a quantity of another magnitude to a quantity of this magnitu...
Definition quantities.hpp:397
consteval auto operator+() const
Get the magnitude resulting from taking the additive identity of a quantity of this magnitude.
Definition quantities.hpp:363
friend consteval auto sqrt(const Magnitude &magnitude)
Get the magnitude resulting from taking the square root of a quantity of a magnitude.
Definition quantities.hpp:479
static constexpr long double VALUE
Quantity multiplier of the magnitude.
Definition quantities.hpp:327
consteval auto operator/(const Magnitude< OtherValue, OtherIsAbsolute > &other) const
Get the magnitude resulting from dividing a quantity of this magnitude by a quantity of another magni...
Definition quantities.hpp:463
static constexpr MagnitudeType MAGNITUDE
Definition quantities.hpp:4446
typename Unit::DimensionType DimensionType
Definition quantities.hpp:4441
GREM_ALWAYS_INLINE constexpr Orientation(Quantity< 1, OtherUnitT > angle) noexcept
Definition quantities.hpp:4459
GREM_ALWAYS_INLINE constexpr bool operator==(const Orientation &) const noexcept=default
static constexpr size_t RANK
Definition quantities.hpp:4443
GREM_ALWAYS_INLINE constexpr Quantity< 1, Unitless > in(OtherUnitT) const
Definition quantities.hpp:4476
GREM_ALWAYS_INLINE constexpr Orientation() noexcept=default
GREM_ALWAYS_INLINE Quantity< 1, UnitT > GREM_VECTORCALL operator()(Quantity< 1, UnitT > b) const
Definition quantities.hpp:4497
GREM_ALWAYS_INLINE constexpr Orientation(double angle) noexcept
Definition quantities.hpp:4455
static constexpr DimensionType DIMENSION
Definition quantities.hpp:4445
GREM_ALWAYS_INLINE Quantity< 2, UnitT > GREM_VECTORCALL operator()(Quantity< 2, UnitT > b) const
Definition quantities.hpp:4488
GREM_ALWAYS_INLINE Direction2D GREM_VECTORCALL operator()(Direction2D b) const
Definition quantities.hpp:4492
GREM_ALWAYS_INLINE constexpr size_t size() const noexcept
Definition quantities.hpp:4501
static constexpr Unit UNIT
Definition quantities.hpp:4444
typename Unit::MagnitudeType MagnitudeType
Definition quantities.hpp:4442
Absolute< Radians > Unit
Definition quantities.hpp:4440
GREM_ALWAYS_INLINE Quantity< 3, UnitT > GREM_VECTORCALL operator()(Quantity< 3, UnitT > b) const
Definition quantities.hpp:4579
typename Unit::DimensionType DimensionType
Definition quantities.hpp:4515
static GREM_ALWAYS_INLINE Orientation angleAxis(AbsoluteAngle angle, Scale3D axis)
Definition quantities.hpp:4530
static GREM_ALWAYS_INLINE Orientation pitch(AbsoluteAngle angle)
Definition quantities.hpp:4534
Absolute< Radians > Unit
Definition quantities.hpp:4514
GREM_ALWAYS_INLINE constexpr Orientation() noexcept=default
static GREM_ALWAYS_INLINE Orientation lookAt(Scale3D direction, Scale3D up)
Definition quantities.hpp:4526
static GREM_ALWAYS_INLINE Orientation roll(AbsoluteAngle angle)
Definition quantities.hpp:4542
typename Unit::MagnitudeType MagnitudeType
Definition quantities.hpp:4516
static constexpr MagnitudeType MAGNITUDE
Definition quantities.hpp:4520
static GREM_ALWAYS_INLINE Orientation rotation(Scale3D from, Scale3D to)
Definition quantities.hpp:4522
GREM_ALWAYS_INLINE constexpr Orientation(qua< double > quaternion) noexcept
Definition quantities.hpp:4565
static GREM_ALWAYS_INLINE Orientation fromAngles(PitchYawRoll angles)
Definition quantities.hpp:4550
GREM_ALWAYS_INLINE Direction3D GREM_VECTORCALL operator()(Direction3D b) const
Definition quantities.hpp:4583
static GREM_ALWAYS_INLINE Orientation yaw(AbsoluteAngle angle)
Definition quantities.hpp:4538
GREM_ALWAYS_INLINE constexpr bool operator==(const Orientation &) const noexcept=default
static constexpr size_t RANK
Definition quantities.hpp:4517
static constexpr DimensionType DIMENSION
Definition quantities.hpp:4519
static GREM_ALWAYS_INLINE Orientation fromAngles(AbsoluteAngle pitchAngle, AbsoluteAngle yawAngle, AbsoluteAngle rollAngle)
Definition quantities.hpp:4546
AbsoluteAngle Component
Definition quantities.hpp:4513
static constexpr Unit UNIT
Definition quantities.hpp:4518
GREM_ALWAYS_INLINE constexpr size_t size() const noexcept
Definition quantities.hpp:4587
static GREM_ALWAYS_INLINE Orientation fromBasis(const Basis3D &basis)
Definition quantities.hpp:4554
Absolute orientation in world space.
Definition quantities.hpp:4431
Basis whose columns are all unit vectors that are orthogonal to each other.
Definition quantities.hpp:4338
GREM_ALWAYS_INLINE Component operator[](meta::Constant< Index >) const noexcept
Definition quantities.hpp:4386
GREM_ALWAYS_INLINE constexpr bool operator==(const TensorQuantity< N, OtherUnitT > &other) const noexcept
Definition quantities.hpp:4359
GREM_ALWAYS_INLINE Component operator[](ComponentSwizzle< Index >) const noexcept
Definition quantities.hpp:4374
static GREM_ALWAYS_INLINE constexpr OrthonormalBasis reinterpret(const auto &value)
Definition quantities.hpp:4350
GREM_ALWAYS_INLINE Component operator[](ComponentSwizzle< Index >) noexcept
Definition quantities.hpp:4368
GREM_ALWAYS_INLINE Component operator[](meta::Constant< Index >) noexcept
Definition quantities.hpp:4380
GREM_ALWAYS_INLINE constexpr bool operator==(const OrthonormalBasis &other) const noexcept
Definition quantities.hpp:4354
GREM_ALWAYS_INLINE constexpr bool operator==(Zero other) const noexcept
Definition quantities.hpp:4363
Direction< N > Component
Definition quantities.hpp:4341
GREM_ALWAYS_INLINE Direction< N > GREM_VECTORCALL operator*(Direction< N > direction) const
Definition quantities.hpp:4399
GREM_ALWAYS_INLINE constexpr OrthonormalBasis GREM_VECTORCALL operator-() const
Definition quantities.hpp:4391
GREM_ALWAYS_INLINE OrthonormalBasis GREM_VECTORCALL operator*(const OrthonormalBasis &other) const
Definition quantities.hpp:4395
GREM_ALWAYS_INLINE constexpr Quantity(Quantity &&) noexcept=default
GREM_ALWAYS_INLINE constexpr size_t size() const noexcept
Definition quantities.hpp:1666
static constexpr DimensionType DIMENSION
Definition quantities.hpp:1524
GREM_ALWAYS_INLINE constexpr auto operator<=>(const Quantity &other) const noexcept
Definition quantities.hpp:1585
UnitT Unit
Definition quantities.hpp:1519
GREM_ALWAYS_INLINE constexpr Quantity & operator=(Zero)
Definition quantities.hpp:1571
GREM_ALWAYS_INLINE constexpr bool operator==(const Quantity &other) const noexcept
Definition quantities.hpp:1576
static constexpr size_t RANK
Definition quantities.hpp:1522
GREM_ALWAYS_INLINE constexpr bool operator==(const Quantity< 1, OtherUnitT > &other) const noexcept
Definition quantities.hpp:1581
GREM_ALWAYS_INLINE constexpr auto operator<=>(Arithmetic other) const noexcept
Definition quantities.hpp:1600
GREM_ALWAYS_INLINE constexpr Quantity(const Quantity &)=default
static constexpr Unit UNIT
Definition quantities.hpp:1523
GREM_ALWAYS_INLINE constexpr Quantity()=default
GREM_ALWAYS_INLINE size_t getMinIndex() const
Definition quantities.hpp:1670
GREM_ALWAYS_INLINE constexpr Quantity< 1, OtherUnitT > as(OtherUnitT) const
Definition quantities.hpp:1661
friend struct Quantity
Definition quantities.hpp:1680
static const Quantity SMALLEST_SUBNORMAL
Definition quantities.hpp:1529
GREM_ALWAYS_INLINE constexpr auto operator<=>(const Quantity< 1, OtherUnitT > &other) const noexcept
Definition quantities.hpp:1590
GREM_ALWAYS_INLINE constexpr auto operator<=>(Zero) const noexcept
Definition quantities.hpp:1608
GREM_ALWAYS_INLINE constexpr bool operator==(Zero) const noexcept
Definition quantities.hpp:1604
static constexpr MagnitudeType MAGNITUDE
Definition quantities.hpp:1525
static const Quantity MAX
Definition quantities.hpp:1527
GREM_ALWAYS_INLINE size_t getMaxIndex() const
Definition quantities.hpp:1674
static const Quantity MIN
Definition quantities.hpp:1526
static const Quantity QUIET_NAN
Definition quantities.hpp:1532
GREM_ALWAYS_INLINE constexpr Quantity(const DurationBase< Rep, Period > &duration)
Definition quantities.hpp:1568
static GREM_ALWAYS_INLINE constexpr Quantity reinterpret(floating_point auto value)
Definition quantities.hpp:1539
GREM_ALWAYS_INLINE constexpr bool operator==(Arithmetic other) const noexcept
Definition quantities.hpp:1595
static const Quantity INF
Definition quantities.hpp:1531
typename Unit::MagnitudeType MagnitudeType
Definition quantities.hpp:1521
GREM_ALWAYS_INLINE constexpr auto operator<=>(const DurationBase< Rep, Period > &other) const noexcept
Definition quantities.hpp:1622
GREM_ALWAYS_INLINE constexpr Quantity(const Quantity< 1, OtherUnitT > &q)
Definition quantities.hpp:1562
GREM_ALWAYS_INLINE constexpr bool operator==(const DurationBase< Rep, Period > &other) const noexcept
Definition quantities.hpp:1613
GREM_ALWAYS_INLINE constexpr Quantity< 1, Unitless > in(OtherUnitT) const
Definition quantities.hpp:1651
static const Quantity MACHINE_EPSILON
Definition quantities.hpp:1530
static GREM_ALWAYS_INLINE constexpr Quantity reinterpret(Quantity< 1, OtherUnitT > other)
Definition quantities.hpp:1535
typename Unit::DimensionType DimensionType
Definition quantities.hpp:1520
GREM_ALWAYS_INLINE constexpr Quantity(floating_point auto value)
Definition quantities.hpp:1558
static const Quantity SMALLEST_NORMAL
Definition quantities.hpp:1528
static const Quantity SMALLEST_NORMAL
Definition quantities.hpp:2008
static constexpr size_t RANK
Definition quantities.hpp:2002
GREM_ALWAYS_INLINE ComponentProxy< 2, UnitT, Index > operator[](meta::Constant< Index >) noexcept
Definition quantities.hpp:2201
GREM_ALWAYS_INLINE void setX(Component x) noexcept
Definition quantities.hpp:2096
GREM_ALWAYS_INLINE Component getY() const noexcept
Definition quantities.hpp:2184
GREM_ALWAYS_INLINE constexpr Quantity & operator=(Zero)
Definition quantities.hpp:2068
static const Quantity MAX
Definition quantities.hpp:2007
GREM_ALWAYS_INLINE constexpr Quantity< 2, OtherUnitT > as(OtherUnitT) const
Definition quantities.hpp:2231
static GREM_ALWAYS_INLINE constexpr Quantity reinterpret(Quantity< 2, OtherUnitT > other)
Definition quantities.hpp:2015
GREM_ALWAYS_INLINE constexpr Quantity(Quantity &&) noexcept=default
GREM_ALWAYS_INLINE constexpr Quantity(const Quantity &)=default
GREM_ALWAYS_INLINE constexpr Quantity(Zero, Component y)
Definition quantities.hpp:2048
GREM_ALWAYS_INLINE constexpr Quantity(const Quantity< 2, OtherUnitT > &q)
Definition quantities.hpp:2063
typename Unit::MagnitudeType MagnitudeType
Definition quantities.hpp:2001
GREM_ALWAYS_INLINE ComponentProxy< 2, UnitT, Index > operator[](ComponentSwizzle< Index >) noexcept
Definition quantities.hpp:2189
GREM_ALWAYS_INLINE ConstComponentProxy< 2, UnitT, Index > operator[](ComponentSwizzle< Index >) const noexcept
Definition quantities.hpp:2195
Quantity< 1, UnitT > Component
Definition quantities.hpp:1998
GREM_ALWAYS_INLINE Quantity< 2, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, Zero) const noexcept
Definition quantities.hpp:2127
static constexpr MagnitudeType MAGNITUDE
Definition quantities.hpp:2005
GREM_ALWAYS_INLINE constexpr bool operator==(const Quantity< 2, OtherUnitT > &other) const noexcept
Definition quantities.hpp:2078
static const Quantity MACHINE_EPSILON
Definition quantities.hpp:2010
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, ComponentSwizzle< IndexY > SwizzleY, ComponentSwizzle< IndexZ > SwizzleZ) const noexcept
Definition quantities.hpp:2141
static GREM_ALWAYS_INLINE constexpr Quantity reinterpret(vec< 2, float > value)
Definition quantities.hpp:2019
GREM_ALWAYS_INLINE Quantity< 2, Unitless > in(OtherUnitT) const
Definition quantities.hpp:2221
friend class ComponentProxy
Definition quantities.hpp:2260
GREM_ALWAYS_INLINE Quantity< 2, UnitT > get(Zero, Zero) const noexcept
Definition quantities.hpp:2136
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(Zero, ComponentSwizzle< IndexY > SwizzleY, ComponentSwizzle< IndexZ > SwizzleZ) const noexcept
Definition quantities.hpp:2157
GREM_ALWAYS_INLINE constexpr bool operator==(const Quantity &other) const noexcept
Definition quantities.hpp:2073
static const Quantity INF
Definition quantities.hpp:2011
friend struct Quantity
Definition quantities.hpp:2254
GREM_ALWAYS_INLINE Quantity< 2, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, ComponentSwizzle< IndexY > SwizzleY) const noexcept
Definition quantities.hpp:2122
static constexpr Unit UNIT
Definition quantities.hpp:2003
GREM_ALWAYS_INLINE constexpr size_t size() const noexcept
Definition quantities.hpp:2236
static constexpr DimensionType DIMENSION
Definition quantities.hpp:2004
GREM_ALWAYS_INLINE constexpr Quantity(Component x, Zero)
Definition quantities.hpp:2051
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(Zero, ComponentSwizzle< IndexY > SwizzleY, Zero) const noexcept
Definition quantities.hpp:2167
GREM_ALWAYS_INLINE size_t getMaxIndex() const
Definition quantities.hpp:2246
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, Zero, ComponentSwizzle< IndexZ > SwizzleZ) const noexcept
Definition quantities.hpp:2152
GREM_ALWAYS_INLINE constexpr Quantity(vec< 2, double > v)
Definition quantities.hpp:2059
GREM_ALWAYS_INLINE Component getX() const noexcept
Definition quantities.hpp:2180
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(Zero, Zero, Zero) const noexcept
Definition quantities.hpp:2176
static const Quantity SMALLEST_SUBNORMAL
Definition quantities.hpp:2009
GREM_ALWAYS_INLINE constexpr Quantity(Component x, Component y)
Definition quantities.hpp:2045
typename Unit::DimensionType DimensionType
Definition quantities.hpp:2000
static GREM_ALWAYS_INLINE constexpr Quantity reinterpret(vec< 2, double > value)
Definition quantities.hpp:2023
GREM_ALWAYS_INLINE Quantity< 2, UnitT > get(Zero, ComponentSwizzle< IndexY > SwizzleY) const noexcept
Definition quantities.hpp:2132
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, ComponentSwizzle< IndexY > SwizzleY, Zero) const noexcept
Definition quantities.hpp:2147
static const Quantity QUIET_NAN
Definition quantities.hpp:2012
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(Zero, Zero, ComponentSwizzle< IndexZ > SwizzleZ) const noexcept
Definition quantities.hpp:2172
GREM_ALWAYS_INLINE Component get(ComponentSwizzle< Index > Swizzle) const noexcept
Definition quantities.hpp:2113
GREM_ALWAYS_INLINE void setY(Component y) noexcept
Definition quantities.hpp:2104
GREM_ALWAYS_INLINE void setX(Zero) noexcept
Definition quantities.hpp:2100
friend class ConstComponentProxy
Definition quantities.hpp:2257
GREM_ALWAYS_INLINE Component get(Zero) const noexcept
Definition quantities.hpp:2117
GREM_ALWAYS_INLINE void setY(Zero) noexcept
Definition quantities.hpp:2108
static const Quantity MIN
Definition quantities.hpp:2006
GREM_ALWAYS_INLINE constexpr bool operator==(Zero) const noexcept
Definition quantities.hpp:2082
UnitT Unit
Definition quantities.hpp:1999
GREM_ALWAYS_INLINE ConstComponentProxy< 2, UnitT, Index > operator[](meta::Constant< Index >) const noexcept
Definition quantities.hpp:2207
GREM_ALWAYS_INLINE void set(ComponentSwizzle< Index > Swizzle, Zero) noexcept
Definition quantities.hpp:2092
GREM_ALWAYS_INLINE constexpr Quantity(Component value)
Definition quantities.hpp:2042
GREM_ALWAYS_INLINE void set(ComponentSwizzle< Index > Swizzle, Component value) noexcept
Definition quantities.hpp:2087
GREM_ALWAYS_INLINE size_t getMinIndex() const
Definition quantities.hpp:2240
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, Zero, Zero) const noexcept
Definition quantities.hpp:2162
GREM_ALWAYS_INLINE constexpr Quantity(Zero, Zero)
Definition quantities.hpp:2054
GREM_ALWAYS_INLINE constexpr Quantity(vec< 2, float > v)
Definition quantities.hpp:2056
GREM_ALWAYS_INLINE constexpr Quantity()=default
GREM_ALWAYS_INLINE constexpr Quantity(Zero, Component y, Zero)
Definition quantities.hpp:2379
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(Zero, ComponentSwizzle< IndexY > SwizzleY, ComponentSwizzle< IndexZ > SwizzleZ) const noexcept
Definition quantities.hpp:2525
GREM_ALWAYS_INLINE void setZ(Component z) noexcept
Definition quantities.hpp:2468
static GREM_ALWAYS_INLINE constexpr Quantity reinterpret(vec< 3, float > value)
Definition quantities.hpp:2318
GREM_ALWAYS_INLINE constexpr Quantity(Zero, Zero, Zero)
Definition quantities.hpp:2385
GREM_ALWAYS_INLINE constexpr Quantity(Component value)
Definition quantities.hpp:2355
GREM_ALWAYS_INLINE Component getZ() const noexcept
Definition quantities.hpp:2556
UnitT Unit
Definition quantities.hpp:2297
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, ComponentSwizzle< IndexY > SwizzleY, Zero) const noexcept
Definition quantities.hpp:2515
GREM_ALWAYS_INLINE constexpr Quantity(Quantity< 2, UnitT > xy, Zero)
Definition quantities.hpp:2403
GREM_ALWAYS_INLINE void set(ComponentSwizzle< Index > Swizzle, Component value) noexcept
Definition quantities.hpp:2443
GREM_ALWAYS_INLINE Quantity< 2, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, Zero) const noexcept
Definition quantities.hpp:2491
GREM_ALWAYS_INLINE constexpr bool operator==(const Quantity< 3, OtherUnitT > &other) const noexcept
Definition quantities.hpp:2430
GREM_ALWAYS_INLINE Component getY() const noexcept
Definition quantities.hpp:2552
GREM_ALWAYS_INLINE void setX(Zero) noexcept
Definition quantities.hpp:2456
static constexpr Unit UNIT
Definition quantities.hpp:2301
GREM_ALWAYS_INLINE Quantity< 2, UnitT > get(Zero, Zero) const noexcept
Definition quantities.hpp:2500
GREM_ALWAYS_INLINE constexpr Quantity(Zero, Component y, Component z)
Definition quantities.hpp:2367
GREM_ALWAYS_INLINE Component get(Zero) const noexcept
Definition quantities.hpp:2481
Quantity< 1, UnitT > Component
Definition quantities.hpp:2296
GREM_ALWAYS_INLINE constexpr Quantity(const Quantity< 3, OtherUnitT > &q)
Definition quantities.hpp:2395
GREM_ALWAYS_INLINE constexpr Quantity(Zero, Zero, Component z)
Definition quantities.hpp:2373
friend class ComponentProxy
Definition quantities.hpp:2650
static const Quantity SMALLEST_SUBNORMAL
Definition quantities.hpp:2308
GREM_ALWAYS_INLINE constexpr Quantity(Zero, Quantity< 2, UnitT > yz)
Definition quantities.hpp:2409
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, Zero, Zero) const noexcept
Definition quantities.hpp:2530
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, ComponentSwizzle< IndexY > SwizzleY, ComponentSwizzle< IndexZ > SwizzleZ) const noexcept
Definition quantities.hpp:2505
GREM_ALWAYS_INLINE constexpr Quantity(Component x, Component y, Zero)
Definition quantities.hpp:2376
static GREM_ALWAYS_INLINE constexpr Quantity reinterpret(Quantity< 3, OtherUnitT > other)
Definition quantities.hpp:2314
static constexpr DimensionType DIMENSION
Definition quantities.hpp:2302
GREM_ALWAYS_INLINE void setZ(Zero) noexcept
Definition quantities.hpp:2472
friend struct Quantity
Definition quantities.hpp:2644
GREM_ALWAYS_INLINE void setY(Component y) noexcept
Definition quantities.hpp:2460
GREM_ALWAYS_INLINE size_t getMinIndex() const
Definition quantities.hpp:2612
GREM_ALWAYS_INLINE constexpr Quantity(Quantity< 2, UnitT > xy, Component z)
Definition quantities.hpp:2400
GREM_ALWAYS_INLINE constexpr Quantity(Quantity &&) noexcept=default
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(Zero, Zero, ComponentSwizzle< IndexZ > SwizzleZ) const noexcept
Definition quantities.hpp:2540
GREM_ALWAYS_INLINE constexpr Quantity< 3, OtherUnitT > as(OtherUnitT) const
Definition quantities.hpp:2603
GREM_ALWAYS_INLINE constexpr Quantity(vec< 3, float > v)
Definition quantities.hpp:2388
GREM_ALWAYS_INLINE Component get(ComponentSwizzle< Index > Swizzle) const noexcept
Definition quantities.hpp:2477
GREM_ALWAYS_INLINE void setY(Zero) noexcept
Definition quantities.hpp:2464
GREM_ALWAYS_INLINE constexpr bool operator==(const Quantity &other) const noexcept
Definition quantities.hpp:2421
GREM_ALWAYS_INLINE Quantity< 2, UnitT > get(Zero, ComponentSwizzle< IndexY > SwizzleY) const noexcept
Definition quantities.hpp:2496
GREM_ALWAYS_INLINE void set(ComponentSwizzle< Index > Swizzle, Zero) noexcept
Definition quantities.hpp:2448
typename Unit::MagnitudeType MagnitudeType
Definition quantities.hpp:2299
GREM_ALWAYS_INLINE constexpr size_t size() const noexcept
Definition quantities.hpp:2608
static GREM_ALWAYS_INLINE constexpr Quantity reinterpret(vec< 3, double > value)
Definition quantities.hpp:2322
GREM_ALWAYS_INLINE ComponentProxy< 3, UnitT, Index > operator[](ComponentSwizzle< Index >) noexcept
Definition quantities.hpp:2561
static const Quantity QUIET_NAN
Definition quantities.hpp:2311
GREM_ALWAYS_INLINE size_t getMaxIndex() const
Definition quantities.hpp:2627
GREM_ALWAYS_INLINE Quantity< 3, Unitless > in(OtherUnitT) const
Definition quantities.hpp:2593
GREM_ALWAYS_INLINE Component getX() const noexcept
Definition quantities.hpp:2548
GREM_ALWAYS_INLINE constexpr Quantity(Component x, Quantity< 2, UnitT > yz)
Definition quantities.hpp:2406
GREM_ALWAYS_INLINE ComponentProxy< 3, UnitT, Index > operator[](meta::Constant< Index >) noexcept
Definition quantities.hpp:2573
static const Quantity INF
Definition quantities.hpp:2310
GREM_ALWAYS_INLINE ConstComponentProxy< 3, UnitT, Index > operator[](meta::Constant< Index >) const noexcept
Definition quantities.hpp:2579
static const Quantity MACHINE_EPSILON
Definition quantities.hpp:2309
GREM_ALWAYS_INLINE constexpr Quantity()=default
static constexpr MagnitudeType MAGNITUDE
Definition quantities.hpp:2303
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, Zero, ComponentSwizzle< IndexZ > SwizzleZ) const noexcept
Definition quantities.hpp:2520
static const Quantity MIN
Definition quantities.hpp:2305
GREM_ALWAYS_INLINE constexpr Quantity(vec< 3, double > v)
Definition quantities.hpp:2391
GREM_ALWAYS_INLINE void setX(Component x) noexcept
Definition quantities.hpp:2452
GREM_ALWAYS_INLINE constexpr Quantity(Component x, Zero, Zero)
Definition quantities.hpp:2382
friend class ConstComponentProxy
Definition quantities.hpp:2647
static const Quantity SMALLEST_NORMAL
Definition quantities.hpp:2307
static constexpr size_t RANK
Definition quantities.hpp:2300
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(Zero, ComponentSwizzle< IndexY > SwizzleY, Zero) const noexcept
Definition quantities.hpp:2535
GREM_ALWAYS_INLINE constexpr Quantity(Component x, Zero, Component z)
Definition quantities.hpp:2370
typename Unit::DimensionType DimensionType
Definition quantities.hpp:2298
GREM_ALWAYS_INLINE constexpr Quantity(Component x, Component y, Component z)
Definition quantities.hpp:2358
static const Quantity MAX
Definition quantities.hpp:2306
GREM_ALWAYS_INLINE ConstComponentProxy< 3, UnitT, Index > operator[](ComponentSwizzle< Index >) const noexcept
Definition quantities.hpp:2567
GREM_ALWAYS_INLINE Quantity< 2, UnitT > get(ComponentSwizzle< IndexX > SwizzleX, ComponentSwizzle< IndexY > SwizzleY) const noexcept
Definition quantities.hpp:2486
GREM_ALWAYS_INLINE Quantity< 3, UnitT > get(Zero, Zero, Zero) const noexcept
Definition quantities.hpp:2544
static const Quantity ZERO
Definition quantities.hpp:2304
GREM_ALWAYS_INLINE constexpr Quantity & operator=(Zero)
Definition quantities.hpp:2412
GREM_ALWAYS_INLINE constexpr bool operator==(Zero) const noexcept
Definition quantities.hpp:2438
GREM_ALWAYS_INLINE constexpr Quantity(const Quantity &)=default
Physical quantity type.
Definition quantities.hpp:1504
Definition quantities.hpp:3740
static GREM_ALWAYS_INLINE constexpr TensorQuantity reinterpret(const TensorQuantity< N, OtherUnitT > &other)
Definition quantities.hpp:3751
static constexpr size_t RANK
Definition quantities.hpp:3745
GREM_ALWAYS_INLINE constexpr bool operator==(const TensorQuantity &other) const noexcept
Definition quantities.hpp:3806
typename Unit::MagnitudeType MagnitudeType
Definition quantities.hpp:3744
constexpr TensorQuantity(const mat< N, N, double > &value) noexcept
Definition quantities.hpp:3770
constexpr TensorQuantity(Component x, Component y) noexcept
Definition quantities.hpp:3776
constexpr TensorQuantity(Component x, Component y, Component z) noexcept
Definition quantities.hpp:3779
GREM_ALWAYS_INLINE Component operator[](meta::Constant< Index >) const noexcept
Definition quantities.hpp:3838
GREM_ALWAYS_INLINE constexpr bool operator==(const TensorQuantity< N, OtherUnitT > &other) const noexcept
Definition quantities.hpp:3811
static GREM_ALWAYS_INLINE constexpr TensorQuantity reinterpret(const mat< N, N, double > &value)
Definition quantities.hpp:3759
GREM_ALWAYS_INLINE constexpr bool operator==(Zero) const noexcept
Definition quantities.hpp:3815
typename Unit::DimensionType DimensionType
Definition quantities.hpp:3743
GREM_ALWAYS_INLINE Component operator[](meta::Constant< Index >) noexcept
Definition quantities.hpp:3832
GREM_ALWAYS_INLINE constexpr size_t size() const noexcept
Definition quantities.hpp:3843
constexpr TensorQuantity() noexcept=default
constexpr TensorQuantity(Quantity< 1, Unitless > value) noexcept
Definition quantities.hpp:3773
static constexpr DimensionType DIMENSION
Definition quantities.hpp:3747
GREM_ALWAYS_INLINE Component operator[](ComponentSwizzle< Index >) const noexcept
Definition quantities.hpp:3826
static GREM_ALWAYS_INLINE constexpr TensorQuantity reinterpret(const mat< N, N, float > &value)
Definition quantities.hpp:3755
GREM_ALWAYS_INLINE Quantity< N, Square< Relative< Unitless > > > getScale2() const noexcept
Definition quantities.hpp:3798
GREM_ALWAYS_INLINE Quantity< N, Relative< Unitless > > getScale() const noexcept
Definition quantities.hpp:3790
static constexpr Unit UNIT
Definition quantities.hpp:3746
UnitT Unit
Definition quantities.hpp:3742
Quantity< N, UnitT > Component
Definition quantities.hpp:3741
static constexpr MagnitudeType MAGNITUDE
Definition quantities.hpp:3748
GREM_ALWAYS_INLINE Component operator[](ComponentSwizzle< Index >) noexcept
Definition quantities.hpp:3820
Abstract physical quantity representing the origin of the global world space reference frame,...
Definition quantities.hpp:1417
GREM_ALWAYS_INLINE consteval Zero(Zero *value)
Implicitly convert a compile-time 0 literal to a zero.
Definition quantities.hpp:1468
GREM_ALWAYS_INLINE consteval Zero(double value)
Explicitly construct a zero from a compile-time double.
Definition quantities.hpp:1438
GREM_ALWAYS_INLINE consteval Zero(float value)
Explicitly construct a zero from a compile-time float.
Definition quantities.hpp:1425
GREM_ALWAYS_INLINE consteval Zero(int value)
Explicitly construct a zero from a compile-time int.
Definition quantities.hpp:1451
T y
Definition math.hpp:830
T w
Definition math.hpp:832
T x
Definition math.hpp:829
T z
Definition math.hpp:831