Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jerk and RPS units #327

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions include/units.h
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ namespace units
typedef base_unit<detail::meter_ratio<1>, std::ratio<0>, std::ratio<-1>> velocity_unit; ///< Represents an SI derived unit of velocity
typedef base_unit<detail::meter_ratio<0>, std::ratio<0>, std::ratio<-1>, std::ratio<1>> angular_velocity_unit; ///< Represents an SI derived unit of angular velocity
typedef base_unit<detail::meter_ratio<1>, std::ratio<0>, std::ratio<-2>> acceleration_unit; ///< Represents an SI derived unit of acceleration
typedef base_unit<detail::meter_ratio<1>, std::ratio<0>, std::ratio<-3>> jerk_unit; ///< Represents an SI derived unit of jerk
typedef base_unit<detail::meter_ratio<1>, std::ratio<1>, std::ratio<-2>> force_unit; ///< Represents an SI derived unit of force
typedef base_unit<detail::meter_ratio<-1>, std::ratio<1>, std::ratio<-2>> pressure_unit; ///< Represents an SI derived unit of pressure
typedef base_unit<detail::meter_ratio<0>, std::ratio<0>, std::ratio<1>, std::ratio<0>, std::ratio<1>> charge_unit; ///< Represents an SI derived unit of charge
Expand Down Expand Up @@ -1884,6 +1885,7 @@ namespace units
* - \ref velocityContainers "velocity unit containers"
* - \ref angularVelocityContainers "angular velocity unit containers"
* - \ref accelerationContainers "acceleration unit containers"
* - \ref jerkContainers "jerk unit containers"
* - \ref forceContainers "force unit containers"
* - \ref pressureContainers "pressure unit containers"
* - \ref chargeContainers "charge unit containers"
Expand Down Expand Up @@ -3633,6 +3635,7 @@ namespace units
UNIT_ADD(angular_velocity, radians_per_second, radians_per_second, rad_per_s, unit<std::ratio<1>, units::category::angular_velocity_unit>)
UNIT_ADD(angular_velocity, degrees_per_second, degrees_per_second, deg_per_s, compound_unit<angle::degrees, inverse<time::seconds>>)
UNIT_ADD(angular_velocity, revolutions_per_minute, revolutions_per_minute, rpm, unit<std::ratio<2, 60>, radians_per_second, std::ratio<1>>)
UNIT_ADD(angular_velocity, revolutions_per_second, revolutions_per_second, rps, unit<std::ratio<2, 1>, radians_per_second, std::ratio<1>>)
UNIT_ADD(angular_velocity, milliarcseconds_per_year, milliarcseconds_per_year, mas_per_yr, compound_unit<angle::milliarcseconds, inverse<time::year>>)

UNIT_ADD_CATEGORY_TRAIT(angular_velocity)
Expand All @@ -3658,6 +3661,25 @@ namespace units
UNIT_ADD_CATEGORY_TRAIT(acceleration)
#endif

//------------------------------
// UNITS OF JERK
//------------------------------

/**
* @namespace units::jerk
* @brief namespace for unit types and containers representing jerk values
* @details The SI unit for jerk is `meters_per_second_cubed`, and the corresponding `base_unit` category is
* `jerk_unit`.
* @anchor jerkContainers
* @sa See unit_t for more information on unit type containers.
*/
#if !defined(DISABLE_PREDEFINED_UNITS) || defined(ENABLE_PREDEFINED_JERK_UNITS)
UNIT_ADD(jerk, meters_per_second_cubed, meters_per_second_cubed, mps_cb, unit<std::ratio<1>, units::category::jerk_unit>)
UNIT_ADD(jerk, feet_per_second_cubed, feet_per_second_cubed, fps_cb, compound_unit<length::feet, inverse<cubed<time::seconds>>>)

UNIT_ADD_CATEGORY_TRAIT(jerk)
#endif

//------------------------------
// UNITS OF FORCE
//------------------------------
Expand Down