9 #ifndef TurtleBrains_Constants_hpp
10 #define TurtleBrains_Constants_hpp
16 template<
typename Type> constexpr Type Pi(
void) {
return static_cast<Type
>(3.141592653589793); }
17 template<
typename Type> constexpr Type TwoPi(
void) {
return static_cast<Type
>(Pi<long double>() * 2.0); }
19 static const float kPi = Pi<float>();
20 static const float kTwoPi = TwoPi<float>();
47 template<
typename Type> constexpr Type DegreesToRadians(
const Type& degrees) {
return degrees * Pi<Type>() / Type(180.0); }
52 template<
typename Type> constexpr Type RadiansToDegrees(
const Type& radians) {
return radians * Type(180.0) / Pi<Type>(); }
59 template<
typename Type> constexpr Type PoundsToKilograms(
const Type& pounds) {
return static_cast<Type
>(pounds *
kPoundsToKilograms); }
64 template<
typename Type> constexpr Type KilogramsToPounds(
const Type& kilograms) {
return static_cast<Type
>(kilograms *
kKilogramsToPounds); }
71 template<
typename Type> constexpr Type InchesToMeters(
const Type& inches) {
return static_cast<Type
>(inches *
kInchesToMeters); }
76 template<
typename Type> constexpr Type FeetToMeters(
const Type& feet) {
return static_cast<Type
>(feet *
kFeetToMeters); };
81 template<
typename Type> constexpr Type MetersToFeet(
const Type& meters) {
return static_cast<Type
>(meters *
kMetersToFeet); };
86 template<
typename Type> constexpr Type MilesToKilometers(
const Type& mile) {
return static_cast<Type
>(mile *
kMilesToKilometers); }
91 template<
typename Type> constexpr Type KilometersToMiles(
const Type& kilometers) {
return static_cast<Type
>(kilometers *
kKilometersToMiles); }
97 template<
typename Type> constexpr Type KilometersToMeters(
const Type& kmh) {
return static_cast<Type
>(kmh * 1000.0f); }
104 template<
typename Type> constexpr Type MileHourToMeterSecond(
const Type& mph) {
return static_cast<Type
>(mph / 2.2369362920544f); }
109 template<
typename Type> constexpr Type MeterSecondToMileHour(
const Type& meterSec) {
return static_cast<Type
>(meterSec * 2.2369362920544f); }
114 template<
typename Type> constexpr Type KilometerHourToMeterSecond(
const Type& kmh) {
return static_cast<Type
>(kmh / 3.6f); }
119 template<
typename Type> constexpr Type MeterSecondToKilometerHour(
const Type& meterSecond) {
return static_cast<Type
>(meterSecond * 3.6f); }
126 template<
typename Type> constexpr Type FootPoundsToNewtonMeters(
const Type& footPounds) {
return static_cast<Type
>(footPounds /
kFootPoundsToNewtonMeters); }
131 template<
typename Type> constexpr Type NewtonMetersToFootPounds(
const Type& newtonMeters) {
return static_cast<Type
>(newtonMeters /
kNewtonMetersToFootPounds); }
138 template<
typename Type> constexpr Type FahrenheitToCelsius(
const Type& fahrenheit) {
return static_cast<Type
>((fahrenheit - 32.0f) / 1.8000f); }
143 template<
typename Type> constexpr Type CelsiusToFahrenheit(
const Type& celsius) {
return static_cast<Type
>((celsius * 1.8000f) + 32.0f); }
const float kPoundsToKilograms(0.45359237f)
A constant for the conversion of 1 pound (lb) to 1 kilogram (kg).
Contains objects and functions for dealing with Vector and Matrix math.
const float kKilogramsToPounds(1.0f/kPoundsToKilograms)
A constant for the conversion of 1 kilogram (kg) to 1 pound (lb).
const float kInchesToMeters(0.0254f)
A constant for the distance conversion of 1 inch to 1 meter.
const float kFeetToMeters(0.3048f)
A constant for the distance conversion from 1 foot to 1 meter.
static const float kTolerance(0.00001f)
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
const float kMetersToInches(1.0f/kInchesToMeters)
A constant for the distance conversion of 1 meter to 1 inch.
const float kMilesToKilometers(1.609344f)
A constant for the distance conversion from 1 mile to 1 kilometer.
static const float kPi
A constant for the mathematical concept of Pi stored in a float.
Definition: tb_constants.hpp:19
const float kKilometersToMiles(1.0f/kMilesToKilometers)
A constant for the distance conversion from 1 kilometer to 1 mile.
const float kNewtonMetersToFootPounds(1.0f/kFootPoundsToNewtonMeters)
A constant for the torque conversion from Nm to ft-lbs.
static const float kTwoPi
A constant for Pi * 2 stored in a float.
Definition: tb_constants.hpp:20
const float kFootPoundsToNewtonMeters(0.73756214837f)
A constant for the torque in ft-lbs to Nm.
const float kMetersToFeet(1.0f/kFeetToMeters)
A constant for the distance conversion from 1 meter to 1 foot.