forked from mpusz/mp-units
refactor: all examples refactored to use a simplified quantity creation
This commit is contained in:
@@ -45,11 +45,10 @@ auto get_gliders()
|
||||
using namespace mp_units::si::unit_symbols;
|
||||
UNITS_DIAGNOSTIC_PUSH
|
||||
UNITS_DIAGNOSTIC_IGNORE_MISSING_BRACES
|
||||
static const std::array gliders = {
|
||||
glider{"SZD-30 Pirat", {83 * isq::speed[km / h], -0.7389 * rate_of_climb_speed[m / s]}},
|
||||
glider{"SZD-51 Junior", {80 * isq::speed[km / h], -0.6349 * rate_of_climb_speed[m / s]}},
|
||||
glider{"SZD-48 Jantar Std 3", {110 * isq::speed[km / h], -0.77355 * rate_of_climb_speed[m / s]}},
|
||||
glider{"SZD-56 Diana", {110 * isq::speed[km / h], -0.63657 * rate_of_climb_speed[m / s]}}};
|
||||
static const std::array gliders = {glider{"SZD-30 Pirat", {83 * (km / h), -0.7389 * (m / s)}},
|
||||
glider{"SZD-51 Junior", {80 * (km / h), -0.6349 * (m / s)}},
|
||||
glider{"SZD-48 Jantar Std 3", {110 * (km / h), -0.77355 * (m / s)}},
|
||||
glider{"SZD-56 Diana", {110 * (km / h), -0.63657 * (m / s)}}};
|
||||
UNITS_DIAGNOSTIC_POP
|
||||
return gliders;
|
||||
}
|
||||
@@ -57,10 +56,9 @@ auto get_gliders()
|
||||
auto get_weather_conditions()
|
||||
{
|
||||
using namespace mp_units::si::unit_symbols;
|
||||
static const std::array weather_conditions = {
|
||||
std::pair{"Good", weather{1900 * isq::height[m], 4.3 * rate_of_climb_speed[m / s]}},
|
||||
std::pair{"Medium", weather{1550 * isq::height[m], 2.8 * rate_of_climb_speed[m / s]}},
|
||||
std::pair{"Bad", weather{850 * isq::height[m], 1.8 * rate_of_climb_speed[m / s]}}};
|
||||
static const std::array weather_conditions = {std::pair{"Good", weather{1900 * m, 4.3 * (m / s)}},
|
||||
std::pair{"Medium", weather{1550 * m, 2.8 * (m / s)}},
|
||||
std::pair{"Bad", weather{850 * m, 1.8 * (m / s)}}};
|
||||
return weather_conditions;
|
||||
}
|
||||
|
||||
@@ -69,8 +67,8 @@ auto get_waypoints()
|
||||
using namespace geographic::literals;
|
||||
using namespace mp_units::international::unit_symbols;
|
||||
static const std::array waypoints = {
|
||||
waypoint{"EPPR", {54.24772_N, 18.6745_E}, altitude{16. * isq::altitude[ft]}}, // N54°14'51.8" E18°40'28.2"
|
||||
waypoint{"EPGI", {53.52442_N, 18.84947_E}, altitude{115. * isq::altitude[ft]}} // N53°31'27.9" E18°50'58.1"
|
||||
waypoint{"EPPR", {54.24772_N, 18.6745_E}, altitude{16. * ft}}, // N54°14'51.8" E18°40'28.2"
|
||||
waypoint{"EPGI", {53.52442_N, 18.84947_E}, altitude{115. * ft}} // N53°31'27.9" E18°50'58.1"
|
||||
};
|
||||
return waypoints;
|
||||
}
|
||||
@@ -159,12 +157,12 @@ void example()
|
||||
{
|
||||
using namespace mp_units::si::unit_symbols;
|
||||
|
||||
const safety sfty = {300 * isq::height[m]};
|
||||
const safety sfty = {300 * m};
|
||||
const auto gliders = get_gliders();
|
||||
const auto waypoints = get_waypoints();
|
||||
const auto weather_conditions = get_weather_conditions();
|
||||
const task t = {waypoints[0], waypoints[1], waypoints[0]};
|
||||
const aircraft_tow tow = {400 * isq::height[m], 1.6 * rate_of_climb_speed[m / s]};
|
||||
const aircraft_tow tow = {400 * m, 1.6 * (m / s)};
|
||||
// TODO use C++20 date library when available
|
||||
// set `start_time` to 11:00 am today
|
||||
const timestamp start_time(std::chrono::system_clock::now());
|
||||
|
||||
Reference in New Issue
Block a user