Переименование типов на на общепринятый формат, отказ от суффикса _t, так как он зарезервирован POSIX

This commit is contained in:
Andrey Pokidov 2025-01-15 23:56:17 +07:00
parent 3805354611
commit 0027924f86
26 changed files with 574 additions and 571 deletions

View file

@ -32,7 +32,7 @@ typedef enum {
BGC_ANGLE_UNIT_RADIANS = 1,
BGC_ANGLE_UNIT_DEGREES = 2,
BGC_ANGLE_UNIT_TURNS = 3
} bgc_angle_unit_t;
} BgcAngleUnitEnum;
typedef enum {
/**
@ -46,7 +46,7 @@ typedef enum {
* (-180, 180] degrees, (-PI, PI] radians, (-0.5, 0.5] turns, (-200, 200] gradians
*/
BGC_ANGLE_RANGE_SIGNED = 2
} bgc_angle_range_t;
} BgcAngleRangeEnum;
// !================= Radians ==================! //
@ -76,7 +76,7 @@ inline double bgc_radians_to_turns_fp64(const double radians)
// ========= Convert radians to any unit ======== //
inline float bgc_radians_to_units_fp32(const float radians, const bgc_angle_unit_t to_unit)
inline float bgc_radians_to_units_fp32(const float radians, const BgcAngleUnitEnum to_unit)
{
if (to_unit == BGC_ANGLE_UNIT_DEGREES) {
return radians * BGC_DEGREES_IN_RADIAN_FP32;
@ -89,7 +89,7 @@ inline float bgc_radians_to_units_fp32(const float radians, const bgc_angle_unit
return radians;
}
inline double bgc_radians_to_units_fp64(const double radians, const bgc_angle_unit_t to_unit)
inline double bgc_radians_to_units_fp64(const double radians, const BgcAngleUnitEnum to_unit)
{
if (to_unit == BGC_ANGLE_UNIT_DEGREES) {
return radians * BGC_DEGREES_IN_RADIAN_FP64;
@ -104,7 +104,7 @@ inline double bgc_radians_to_units_fp64(const double radians, const bgc_angle_un
// ============ Normalize radians ============= //
inline float bgc_radians_normalize_fp32(const float radians, const bgc_angle_range_t range)
inline float bgc_radians_normalize_fp32(const float radians, const BgcAngleRangeEnum range)
{
if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0f <= radians && radians < BGC_TWO_PI_FP32) {
@ -128,7 +128,7 @@ inline float bgc_radians_normalize_fp32(const float radians, const bgc_angle_ran
return turns * BGC_TWO_PI_FP32;
}
inline double bgc_radians_normalize_fp64(const double radians, const bgc_angle_range_t range)
inline double bgc_radians_normalize_fp64(const double radians, const BgcAngleRangeEnum range)
{
if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0 <= radians && radians < BGC_TWO_PI_FP64) {
@ -180,7 +180,7 @@ inline double fp64_degrees_to_turns(const double radians)
// ========= Convert degreess to any unit ======== //
inline float bgc_degrees_to_units_fp32(const float degrees, const bgc_angle_unit_t to_unit)
inline float bgc_degrees_to_units_fp32(const float degrees, const BgcAngleUnitEnum to_unit)
{
if (to_unit == BGC_ANGLE_UNIT_RADIANS) {
return degrees * BGC_RADIANS_IN_DEGREE_FP32;
@ -193,7 +193,7 @@ inline float bgc_degrees_to_units_fp32(const float degrees, const bgc_angle_unit
return degrees;
}
inline double bgc_degrees_to_units_fp64(const double degrees, const bgc_angle_unit_t to_unit)
inline double bgc_degrees_to_units_fp64(const double degrees, const BgcAngleUnitEnum to_unit)
{
if (to_unit == BGC_ANGLE_UNIT_RADIANS) {
return degrees * BGC_RADIANS_IN_DEGREE_FP64;
@ -208,7 +208,7 @@ inline double bgc_degrees_to_units_fp64(const double degrees, const bgc_angle_un
// ============ Normalize degrees ============= //
inline float bgc_degrees_normalize_fp32(const float degrees, const bgc_angle_range_t range)
inline float bgc_degrees_normalize_fp32(const float degrees, const BgcAngleRangeEnum range)
{
if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0f <= degrees && degrees < 360.0f) {
@ -232,7 +232,7 @@ inline float bgc_degrees_normalize_fp32(const float degrees, const bgc_angle_ran
return turns * 360.0f;
}
inline double bgc_degrees_normalize_fp64(const double degrees, const bgc_angle_range_t range)
inline double bgc_degrees_normalize_fp64(const double degrees, const BgcAngleRangeEnum range)
{
if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0 <= degrees && degrees < 360.0) {
@ -284,7 +284,7 @@ inline double bgc_turns_to_degrees_fp64(const double turns)
// ========= Convert turns to any unit ======== //
inline float bgc_turns_to_units_fp32(const float turns, const bgc_angle_unit_t to_unit)
inline float bgc_turns_to_units_fp32(const float turns, const BgcAngleUnitEnum to_unit)
{
if (to_unit == BGC_ANGLE_UNIT_RADIANS) {
return turns * BGC_TWO_PI_FP32;
@ -297,7 +297,7 @@ inline float bgc_turns_to_units_fp32(const float turns, const bgc_angle_unit_t t
return turns;
}
inline double bgc_turns_to_units_fp64(const double turns, const bgc_angle_unit_t to_unit)
inline double bgc_turns_to_units_fp64(const double turns, const BgcAngleUnitEnum to_unit)
{
if (to_unit == BGC_ANGLE_UNIT_RADIANS) {
return turns * BGC_TWO_PI_FP64;
@ -312,7 +312,7 @@ inline double bgc_turns_to_units_fp64(const double turns, const bgc_angle_unit_t
// ============= Normalize turns ============== //
inline float bgc_turns_normalize_fp32(const float turns, const bgc_angle_range_t range)
inline float bgc_turns_normalize_fp32(const float turns, const BgcAngleRangeEnum range)
{
if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0f <= turns && turns < 1.0f) {
@ -334,7 +334,7 @@ inline float bgc_turns_normalize_fp32(const float turns, const bgc_angle_range_t
return rest;
}
inline double bgc_turns_normalize_fp64(const double turns, const bgc_angle_range_t range)
inline double bgc_turns_normalize_fp64(const double turns, const BgcAngleRangeEnum range)
{
if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0 <= turns && turns < 1.0) {
@ -360,7 +360,7 @@ inline double bgc_turns_normalize_fp64(const double turns, const bgc_angle_range
// ========= Convert any unit to radians ======== //
inline float bgc_angle_to_radians_fp32(const float angle, const bgc_angle_unit_t unit)
inline float bgc_angle_to_radians_fp32(const float angle, const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return angle * BGC_RADIANS_IN_DEGREE_FP32;
@ -373,7 +373,7 @@ inline float bgc_angle_to_radians_fp32(const float angle, const bgc_angle_unit_t
return angle;
}
inline double bgc_angle_to_radians_fp64(const double angle, const bgc_angle_unit_t unit)
inline double bgc_angle_to_radians_fp64(const double angle, const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return angle * BGC_RADIANS_IN_DEGREE_FP64;
@ -388,7 +388,7 @@ inline double bgc_angle_to_radians_fp64(const double angle, const bgc_angle_unit
// ========= Convert any unit to degreess ======== //
inline float bgc_angle_to_degrees_fp32(const float angle, const bgc_angle_unit_t unit)
inline float bgc_angle_to_degrees_fp32(const float angle, const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_RADIANS) {
return angle * BGC_DEGREES_IN_RADIAN_FP32;
@ -401,7 +401,7 @@ inline float bgc_angle_to_degrees_fp32(const float angle, const bgc_angle_unit_t
return angle;
}
inline double bgc_angle_to_degrees_fp64(const double angle, const bgc_angle_unit_t unit)
inline double bgc_angle_to_degrees_fp64(const double angle, const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_RADIANS) {
return angle * BGC_DEGREES_IN_RADIAN_FP64;
@ -416,7 +416,7 @@ inline double bgc_angle_to_degrees_fp64(const double angle, const bgc_angle_unit
// ========= Convert any unit to turns ======== //
inline float bgc_angle_to_turns_fp32(const float angle, const bgc_angle_unit_t unit)
inline float bgc_angle_to_turns_fp32(const float angle, const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_RADIANS) {
return angle * BGC_TURNS_IN_RADIAN_FP32;
@ -429,7 +429,7 @@ inline float bgc_angle_to_turns_fp32(const float angle, const bgc_angle_unit_t u
return angle;
}
inline double bgc_angle_to_turns_fp64(const double angle, const bgc_angle_unit_t unit)
inline double bgc_angle_to_turns_fp64(const double angle, const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_RADIANS) {
return angle * BGC_TURNS_IN_RADIAN_FP64;
@ -444,7 +444,7 @@ inline double bgc_angle_to_turns_fp64(const double angle, const bgc_angle_unit_t
// ============= Get Full Circle ============== //
inline float bgc_angle_get_full_circle_fp32(const bgc_angle_unit_t unit)
inline float bgc_angle_get_full_circle_fp32(const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 360.0f;
@ -457,7 +457,7 @@ inline float bgc_angle_get_full_circle_fp32(const bgc_angle_unit_t unit)
return BGC_TWO_PI_FP32;
}
inline double bgc_angle_get_full_circle_fp64(const bgc_angle_unit_t unit)
inline double bgc_angle_get_full_circle_fp64(const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 360.0;
@ -472,7 +472,7 @@ inline double bgc_angle_get_full_circle_fp64(const bgc_angle_unit_t unit)
// ============= Get Half Circle ============== //
inline float bgc_angle_get_half_circle_fp32(const bgc_angle_unit_t unit)
inline float bgc_angle_get_half_circle_fp32(const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 180.0f;
@ -485,7 +485,7 @@ inline float bgc_angle_get_half_circle_fp32(const bgc_angle_unit_t unit)
return BGC_PI_FP32;
}
inline double bgc_angle_get_half_circle_fp64(const bgc_angle_unit_t unit)
inline double bgc_angle_get_half_circle_fp64(const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 180.0;
@ -500,7 +500,7 @@ inline double bgc_angle_get_half_circle_fp64(const bgc_angle_unit_t unit)
// ============= Get Half Circle ============== //
inline float bgc_angle_get_quater_circle_fp32(const bgc_angle_unit_t unit)
inline float bgc_angle_get_quater_circle_fp32(const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 90.0f;
@ -513,7 +513,7 @@ inline float bgc_angle_get_quater_circle_fp32(const bgc_angle_unit_t unit)
return BGC_HALF_OF_PI_FP32;
}
inline double bgc_angle_get_quater_circle_fp64(const bgc_angle_unit_t unit)
inline double bgc_angle_get_quater_circle_fp64(const BgcAngleUnitEnum unit)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 90.0;
@ -528,7 +528,7 @@ inline double bgc_angle_get_quater_circle_fp64(const bgc_angle_unit_t unit)
// ================ Normalize ================= //
inline float bgc_angle_normalize_fp32(const float angle, const bgc_angle_unit_t unit, const bgc_angle_range_t range)
inline float bgc_angle_normalize_fp32(const float angle, const BgcAngleUnitEnum unit, const BgcAngleRangeEnum range)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return bgc_degrees_normalize_fp32(angle, range);
@ -541,7 +541,7 @@ inline float bgc_angle_normalize_fp32(const float angle, const bgc_angle_unit_t
return bgc_radians_normalize_fp32(angle, range);
}
inline double bgc_angle_normalize_fp64(const double angle, const bgc_angle_unit_t unit, const bgc_angle_range_t range)
inline double bgc_angle_normalize_fp64(const double angle, const BgcAngleUnitEnum unit, const BgcAngleRangeEnum range)
{
if (unit == BGC_ANGLE_UNIT_DEGREES) {
return bgc_degrees_normalize_fp64(angle, range);