Продолжение переименования типов и функций
This commit is contained in:
parent
605afabd94
commit
3b6efaafa9
25 changed files with 768 additions and 916 deletions
|
@ -52,31 +52,31 @@ typedef enum {
|
|||
|
||||
// ========= Convert radians to degrees ========= //
|
||||
|
||||
static inline float fp32_radians_to_degrees(const float radians)
|
||||
inline float fp32_radians_to_degrees(const float radians)
|
||||
{
|
||||
return radians * FP32_DEGREES_IN_RADIAN;
|
||||
}
|
||||
|
||||
static inline double fp64_radians_to_degrees(const double radians)
|
||||
inline double fp64_radians_to_degrees(const double radians)
|
||||
{
|
||||
return radians * FP64_DEGREES_IN_RADIAN;
|
||||
}
|
||||
|
||||
// ========== Convert radians to turns ========== //
|
||||
|
||||
static inline float fp32_radians_to_turns(const float radians)
|
||||
inline float fp32_radians_to_turns(const float radians)
|
||||
{
|
||||
return radians * FP32_TURNS_IN_RADIAN;
|
||||
}
|
||||
|
||||
static inline double fp64_radians_to_turns(const double radians)
|
||||
inline double fp64_radians_to_turns(const double radians)
|
||||
{
|
||||
return radians * FP64_TURNS_IN_RADIAN;
|
||||
}
|
||||
|
||||
// ========= Convert radians to any unit ======== //
|
||||
|
||||
static inline float fp32_radians_to_units(const float radians, const angle_unit_t to_unit)
|
||||
inline float fp32_radians_to_units(const float radians, const angle_unit_t to_unit)
|
||||
{
|
||||
if (to_unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return radians * FP32_DEGREES_IN_RADIAN;
|
||||
|
@ -89,7 +89,7 @@ static inline float fp32_radians_to_units(const float radians, const angle_unit_
|
|||
return radians;
|
||||
}
|
||||
|
||||
static inline double fp64_radians_to_units(const double radians, const angle_unit_t to_unit)
|
||||
inline double fp64_radians_to_units(const double radians, const angle_unit_t to_unit)
|
||||
{
|
||||
if (to_unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return radians * FP64_DEGREES_IN_RADIAN;
|
||||
|
@ -104,7 +104,7 @@ static inline double fp64_radians_to_units(const double radians, const angle_uni
|
|||
|
||||
// ============ Normalize radians ============= //
|
||||
|
||||
static inline float fp32_radians_normalize(const float radians, const angle_range_t range)
|
||||
inline float fp32_radians_normalize(const float radians, const angle_range_t range)
|
||||
{
|
||||
if (range == BG_ANGLE_RANGE_UNSIGNED) {
|
||||
if (0.0f <= radians && radians < FP32_TWO_PI) {
|
||||
|
@ -128,7 +128,7 @@ static inline float fp32_radians_normalize(const float radians, const angle_rang
|
|||
return turns * FP32_TWO_PI;
|
||||
}
|
||||
|
||||
static inline double fp64_radians_normalize(const double radians, const angle_range_t range)
|
||||
inline double fp64_radians_normalize(const double radians, const angle_range_t range)
|
||||
{
|
||||
if (range == BG_ANGLE_RANGE_UNSIGNED) {
|
||||
if (0.0 <= radians && radians < FP64_TWO_PI) {
|
||||
|
@ -156,31 +156,31 @@ static inline double fp64_radians_normalize(const double radians, const angle_ra
|
|||
|
||||
// ========= Convert degrees to radians ========= //
|
||||
|
||||
static inline float fp32_degrees_to_radians(const float degrees)
|
||||
inline float fp32_degrees_to_radians(const float degrees)
|
||||
{
|
||||
return degrees * FP32_RADIANS_IN_DEGREE;
|
||||
}
|
||||
|
||||
static inline double fp64_degrees_to_radians(const double degrees)
|
||||
inline double fp64_degrees_to_radians(const double degrees)
|
||||
{
|
||||
return degrees * FP64_RADIANS_IN_DEGREE;
|
||||
}
|
||||
|
||||
// ========== Convert degrees to turns ========== //
|
||||
|
||||
static inline float fp32_degrees_to_turns(const float radians)
|
||||
inline float fp32_degrees_to_turns(const float radians)
|
||||
{
|
||||
return radians * FP32_TURNS_IN_DEGREE;
|
||||
}
|
||||
|
||||
static inline double fp64_degrees_to_turns(const double radians)
|
||||
inline double fp64_degrees_to_turns(const double radians)
|
||||
{
|
||||
return radians * FP64_TURNS_IN_DEGREE;
|
||||
}
|
||||
|
||||
// ========= Convert degreess to any unit ======== //
|
||||
|
||||
static inline float fp32_degrees_to_units(const float degrees, const angle_unit_t to_unit)
|
||||
inline float fp32_degrees_to_units(const float degrees, const angle_unit_t to_unit)
|
||||
{
|
||||
if (to_unit == BG_ANGLE_UNIT_RADIANS) {
|
||||
return degrees * FP32_RADIANS_IN_DEGREE;
|
||||
|
@ -193,7 +193,7 @@ static inline float fp32_degrees_to_units(const float degrees, const angle_unit_
|
|||
return degrees;
|
||||
}
|
||||
|
||||
static inline double fp64_degrees_to_units(const double degrees, const angle_unit_t to_unit)
|
||||
inline double fp64_degrees_to_units(const double degrees, const angle_unit_t to_unit)
|
||||
{
|
||||
if (to_unit == BG_ANGLE_UNIT_RADIANS) {
|
||||
return degrees * FP64_RADIANS_IN_DEGREE;
|
||||
|
@ -208,7 +208,7 @@ static inline double fp64_degrees_to_units(const double degrees, const angle_uni
|
|||
|
||||
// ============ Normalize degrees ============= //
|
||||
|
||||
static inline float fp32_degrees_normalize(const float degrees, const angle_range_t range)
|
||||
inline float fp32_degrees_normalize(const float degrees, const angle_range_t range)
|
||||
{
|
||||
if (range == BG_ANGLE_RANGE_UNSIGNED) {
|
||||
if (0.0f <= degrees && degrees < 360.0f) {
|
||||
|
@ -232,7 +232,7 @@ static inline float fp32_degrees_normalize(const float degrees, const angle_rang
|
|||
return turns * 360.0f;
|
||||
}
|
||||
|
||||
static inline double fp64_degrees_normalize(const double degrees, const angle_range_t range)
|
||||
inline double fp64_degrees_normalize(const double degrees, const angle_range_t range)
|
||||
{
|
||||
if (range == BG_ANGLE_RANGE_UNSIGNED) {
|
||||
if (0.0 <= degrees && degrees < 360.0) {
|
||||
|
@ -260,31 +260,31 @@ static inline double fp64_degrees_normalize(const double degrees, const angle_ra
|
|||
|
||||
// ========== Convert turns to radians ========== //
|
||||
|
||||
static inline float fp32_turns_to_radians(const float turns)
|
||||
inline float fp32_turns_to_radians(const float turns)
|
||||
{
|
||||
return turns * FP32_TWO_PI;
|
||||
}
|
||||
|
||||
static inline double fp64_turns_to_radians(const double turns)
|
||||
inline double fp64_turns_to_radians(const double turns)
|
||||
{
|
||||
return turns * FP64_TWO_PI;
|
||||
}
|
||||
|
||||
// ========== Convert turns to degrees ========== //
|
||||
|
||||
static inline float fp32_turns_to_degrees(const float turns)
|
||||
inline float fp32_turns_to_degrees(const float turns)
|
||||
{
|
||||
return turns * 360.0f;
|
||||
}
|
||||
|
||||
static inline double fp64_turns_to_degrees(const double turns)
|
||||
inline double fp64_turns_to_degrees(const double turns)
|
||||
{
|
||||
return turns * 360.0;
|
||||
}
|
||||
|
||||
// ========= Convert turns to any unit ======== //
|
||||
|
||||
static inline float fp32_turns_to_units(const float turns, const angle_unit_t to_unit)
|
||||
inline float fp32_turns_to_units(const float turns, const angle_unit_t to_unit)
|
||||
{
|
||||
if (to_unit == BG_ANGLE_UNIT_RADIANS) {
|
||||
return turns * FP32_TWO_PI;
|
||||
|
@ -297,7 +297,7 @@ static inline float fp32_turns_to_units(const float turns, const angle_unit_t to
|
|||
return turns;
|
||||
}
|
||||
|
||||
static inline double fp64_turns_to_units(const double turns, const angle_unit_t to_unit)
|
||||
inline double fp64_turns_to_units(const double turns, const angle_unit_t to_unit)
|
||||
{
|
||||
if (to_unit == BG_ANGLE_UNIT_RADIANS) {
|
||||
return turns * FP64_TWO_PI;
|
||||
|
@ -312,7 +312,7 @@ static inline double fp64_turns_to_units(const double turns, const angle_unit_t
|
|||
|
||||
// ============= Normalize turns ============== //
|
||||
|
||||
static inline float fp32_turns_normalize(const float turns, const angle_range_t range)
|
||||
inline float fp32_turns_normalize(const float turns, const angle_range_t range)
|
||||
{
|
||||
if (range == BG_ANGLE_RANGE_UNSIGNED) {
|
||||
if (0.0f <= turns && turns < 1.0f) {
|
||||
|
@ -334,7 +334,7 @@ static inline float fp32_turns_normalize(const float turns, const angle_range_t
|
|||
return rest;
|
||||
}
|
||||
|
||||
static inline double fp64_turns_normalize(const double turns, const angle_range_t range)
|
||||
inline double fp64_turns_normalize(const double turns, const angle_range_t range)
|
||||
{
|
||||
if (range == BG_ANGLE_RANGE_UNSIGNED) {
|
||||
if (0.0 <= turns && turns < 1.0) {
|
||||
|
@ -360,7 +360,7 @@ static inline double fp64_turns_normalize(const double turns, const angle_range_
|
|||
|
||||
// ========= Convert any unit to radians ======== //
|
||||
|
||||
static inline float fp32_angle_to_radians(const float angle, const angle_unit_t unit)
|
||||
inline float fp32_angle_to_radians(const float angle, const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return angle * FP32_RADIANS_IN_DEGREE;
|
||||
|
@ -373,7 +373,7 @@ static inline float fp32_angle_to_radians(const float angle, const angle_unit_t
|
|||
return angle;
|
||||
}
|
||||
|
||||
static inline double fp64_angle_to_radians(const double angle, const angle_unit_t unit)
|
||||
inline double fp64_angle_to_radians(const double angle, const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return angle * FP64_RADIANS_IN_DEGREE;
|
||||
|
@ -388,7 +388,7 @@ static inline double fp64_angle_to_radians(const double angle, const angle_unit_
|
|||
|
||||
// ========= Convert any unit to degreess ======== //
|
||||
|
||||
static inline float fp32_angle_to_degrees(const float angle, const angle_unit_t unit)
|
||||
inline float fp32_angle_to_degrees(const float angle, const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_RADIANS) {
|
||||
return angle * FP32_DEGREES_IN_RADIAN;
|
||||
|
@ -401,7 +401,7 @@ static inline float fp32_angle_to_degrees(const float angle, const angle_unit_t
|
|||
return angle;
|
||||
}
|
||||
|
||||
static inline double fp64_angle_to_degrees(const double angle, const angle_unit_t unit)
|
||||
inline double fp64_angle_to_degrees(const double angle, const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_RADIANS) {
|
||||
return angle * FP64_DEGREES_IN_RADIAN;
|
||||
|
@ -416,7 +416,7 @@ static inline double fp64_angle_to_degrees(const double angle, const angle_unit_
|
|||
|
||||
// ========= Convert any unit to turns ======== //
|
||||
|
||||
static inline float fp32_angle_to_turns(const float angle, const angle_unit_t unit)
|
||||
inline float fp32_angle_to_turns(const float angle, const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_RADIANS) {
|
||||
return angle * FP32_TURNS_IN_RADIAN;
|
||||
|
@ -429,7 +429,7 @@ static inline float fp32_angle_to_turns(const float angle, const angle_unit_t un
|
|||
return angle;
|
||||
}
|
||||
|
||||
static inline double fp64_angle_to_turns(const double angle, const angle_unit_t unit)
|
||||
inline double fp64_angle_to_turns(const double angle, const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_RADIANS) {
|
||||
return angle * FP64_TURNS_IN_RADIAN;
|
||||
|
@ -444,7 +444,7 @@ static inline double fp64_angle_to_turns(const double angle, const angle_unit_t
|
|||
|
||||
// ============= Get Full Circle ============== //
|
||||
|
||||
static inline float fp32_angle_get_full_circle(const angle_unit_t unit)
|
||||
inline float fp32_angle_get_full_circle(const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return 360.0f;
|
||||
|
@ -457,7 +457,7 @@ static inline float fp32_angle_get_full_circle(const angle_unit_t unit)
|
|||
return FP32_TWO_PI;
|
||||
}
|
||||
|
||||
static inline double fp64_angle_get_full_circle(const angle_unit_t unit)
|
||||
inline double fp64_angle_get_full_circle(const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return 360.0;
|
||||
|
@ -472,7 +472,7 @@ static inline double fp64_angle_get_full_circle(const angle_unit_t unit)
|
|||
|
||||
// ============= Get Half Circle ============== //
|
||||
|
||||
static inline float fp32_angle_get_half_circle(const angle_unit_t unit)
|
||||
inline float fp32_angle_get_half_circle(const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return 180.0f;
|
||||
|
@ -485,7 +485,7 @@ static inline float fp32_angle_get_half_circle(const angle_unit_t unit)
|
|||
return FP32_PI;
|
||||
}
|
||||
|
||||
static inline double fp64_angle_get_half_circle(const angle_unit_t unit)
|
||||
inline double fp64_angle_get_half_circle(const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return 180.0;
|
||||
|
@ -500,7 +500,7 @@ static inline double fp64_angle_get_half_circle(const angle_unit_t unit)
|
|||
|
||||
// ============= Get Half Circle ============== //
|
||||
|
||||
static inline float fp32_angle_get_quater_circle(const angle_unit_t unit)
|
||||
inline float fp32_angle_get_quater_circle(const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return 90.0f;
|
||||
|
@ -513,7 +513,7 @@ static inline float fp32_angle_get_quater_circle(const angle_unit_t unit)
|
|||
return FP32_HALF_OF_PI;
|
||||
}
|
||||
|
||||
static inline double fp64_angle_get_quater_circle(const angle_unit_t unit)
|
||||
inline double fp64_angle_get_quater_circle(const angle_unit_t unit)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return 90.0;
|
||||
|
@ -528,7 +528,7 @@ static inline double fp64_angle_get_quater_circle(const angle_unit_t unit)
|
|||
|
||||
// ================ Normalize ================= //
|
||||
|
||||
static inline float fp32_angle_normalize(const float angle, const angle_unit_t unit, const angle_range_t range)
|
||||
inline float fp32_angle_normalize(const float angle, const angle_unit_t unit, const angle_range_t range)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return fp32_degrees_normalize(angle, range);
|
||||
|
@ -541,7 +541,7 @@ static inline float fp32_angle_normalize(const float angle, const angle_unit_t u
|
|||
return fp32_radians_normalize(angle, range);
|
||||
}
|
||||
|
||||
static inline double fp64_angle_normalize(const double angle, const angle_unit_t unit, const angle_range_t range)
|
||||
inline double fp64_angle_normalize(const double angle, const angle_unit_t unit, const angle_range_t range)
|
||||
{
|
||||
if (unit == BG_ANGLE_UNIT_DEGREES) {
|
||||
return fp64_degrees_normalize(angle, range);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue