Переход на версию 0.3: изменение подхода к именованию сущностей, добавление, изменение и удаление ряда функций
This commit is contained in:
parent
d33daf4e2d
commit
f7e41645fe
87 changed files with 4580 additions and 4051 deletions
|
|
@ -13,101 +13,114 @@
|
|||
typedef struct
|
||||
{
|
||||
float _cos, _sin;
|
||||
} BgcCotesNumberFP32;
|
||||
} BGC_FP32_CotesNumber;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double _cos, _sin;
|
||||
} BgcCotesNumberFP64;
|
||||
} BGC_FP64_CotesNumber;
|
||||
|
||||
// ================= Constants ================== //
|
||||
|
||||
extern const BgcCotesNumberFP32 BGC_IDLE_COTES_NUMBER_FP32;
|
||||
extern const BgcCotesNumberFP64 BGC_IDLE_COTES_NUMBER_FP64;
|
||||
extern const BGC_FP32_CotesNumber BGC_FP32_IDLE_COTES_NUMBER;
|
||||
extern const BGC_FP64_CotesNumber BGC_FP64_IDLE_COTES_NUMBER;
|
||||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
inline void bgc_cotes_number_reset_fp32(BgcCotesNumberFP32* number)
|
||||
inline void bgc_fp32_cotes_number_reset(BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
number->_cos = 1.0f;
|
||||
number->_sin = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_reset_fp64(BgcCotesNumberFP64* number)
|
||||
inline void bgc_fp64_cotes_number_reset(BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
number->_cos = 1.0;
|
||||
number->_sin = 0.0;
|
||||
}
|
||||
|
||||
// ================== Set Turn ================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_make_for_angle(const float angle, const int angle_unit, BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
const float radians = bgc_fp32_angle_to_radians(angle, angle_unit);
|
||||
|
||||
number->_cos = cosf(radians);
|
||||
number->_sin = sinf(radians);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_make_for_angle(const double angle, const int angle_unit, BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
const double radians = bgc_fp64_angle_to_radians(angle, angle_unit);
|
||||
|
||||
number->_cos = cos(radians);
|
||||
number->_sin = sin(radians);
|
||||
}
|
||||
|
||||
|
||||
// ================== Set Turn ================== //
|
||||
|
||||
inline int bgc_fp32_cotes_number_is_idle(const BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
return bgc_fp32_is_unit(number->_cos) && bgc_fp32_is_zero(number->_sin);
|
||||
}
|
||||
|
||||
inline int bgc_fp64_cotes_number_is_idle(const BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
return bgc_fp64_is_unit(number->_cos) && bgc_fp64_is_zero(number->_sin);
|
||||
}
|
||||
|
||||
// ==================== Set ===================== //
|
||||
|
||||
void _bgc_cotes_number_normalize_fp32(const float square_modulus, BgcCotesNumberFP32* twin);
|
||||
void _bgc_fp32_cotes_number_normalize(BGC_FP32_CotesNumber* twin);
|
||||
|
||||
void _bgc_cotes_number_normalize_fp64(const double square_modulus, BgcCotesNumberFP64* twin);
|
||||
void _bgc_fp64_cotes_number_normalize(BGC_FP64_CotesNumber* twin);
|
||||
|
||||
inline void bgc_cotes_number_set_values_fp32(const float x1, const float x2, BgcCotesNumberFP32* number)
|
||||
inline void bgc_fp32_cotes_number_make(const float x1, const float x2, BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
const float square_modulus = x1 * x1 + x2 * x2;
|
||||
|
||||
number->_cos = x1;
|
||||
number->_sin = x2;
|
||||
|
||||
if (!bgc_is_sqare_unit_fp32(square_modulus)) {
|
||||
_bgc_cotes_number_normalize_fp32(square_modulus, number);
|
||||
if (!bgc_fp32_is_square_unit(square_modulus)) {
|
||||
_bgc_fp32_cotes_number_normalize(number);
|
||||
}
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_set_values_fp64(const double x1, const double x2, BgcCotesNumberFP64* number)
|
||||
inline void bgc_fp64_cotes_number_make(const double x1, const double x2, BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
const double square_modulus = x1 * x1 + x2 * x2;
|
||||
|
||||
number->_cos = x1;
|
||||
number->_sin = x2;
|
||||
|
||||
if (!bgc_is_sqare_unit_fp64(square_modulus)) {
|
||||
_bgc_cotes_number_normalize_fp64(square_modulus, number);
|
||||
if (!bgc_fp64_is_square_unit(square_modulus)) {
|
||||
_bgc_fp64_cotes_number_normalize(number);
|
||||
}
|
||||
}
|
||||
|
||||
// ================== Set Turn ================== //
|
||||
|
||||
inline void bgc_cotes_number_set_turn_fp32(const float angle, const BgcAngleUnitEnum unit, BgcCotesNumberFP32* number)
|
||||
{
|
||||
const float radians = bgc_angle_to_radians_fp32(angle, unit);
|
||||
|
||||
number->_cos = cosf(radians);
|
||||
number->_sin = sinf(radians);
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_set_turn_fp64(const double angle, const BgcAngleUnitEnum unit, BgcCotesNumberFP64* number)
|
||||
{
|
||||
const double radians = bgc_angle_to_radians_fp64(angle, unit);
|
||||
|
||||
number->_cos = cos(radians);
|
||||
number->_sin = sin(radians);
|
||||
}
|
||||
|
||||
// =================== Angle =================== //
|
||||
|
||||
inline float bgc_cotes_number_get_angle_fp32(const BgcCotesNumberFP32* number, const BgcAngleUnitEnum unit)
|
||||
inline float bgc_fp32_cotes_number_get_angle(const BGC_FP32_CotesNumber* number, const int angle_unit)
|
||||
{
|
||||
return bgc_radians_to_units_fp32(atan2f(number->_sin, number->_cos), unit);
|
||||
return bgc_fp32_radians_to_units(atan2f(number->_sin, number->_cos), angle_unit);
|
||||
}
|
||||
|
||||
inline double bgc_cotes_number_get_angle_fp64(const BgcCotesNumberFP64* number, const BgcAngleUnitEnum unit)
|
||||
inline double bgc_fp64_cotes_number_get_angle(const BGC_FP64_CotesNumber* number, const int angle_unit)
|
||||
{
|
||||
return bgc_radians_to_units_fp64(atan2(number->_sin, number->_cos), unit);
|
||||
return bgc_fp64_radians_to_units(atan2(number->_sin, number->_cos), angle_unit);
|
||||
}
|
||||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_cotes_number_copy_fp32(const BgcCotesNumberFP32* source, BgcCotesNumberFP32* destination)
|
||||
inline void bgc_fp32_cotes_number_copy(const BGC_FP32_CotesNumber* source, BGC_FP32_CotesNumber* destination)
|
||||
{
|
||||
destination->_cos = source->_cos;
|
||||
destination->_sin = source->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_copy_fp64(const BgcCotesNumberFP64* source, BgcCotesNumberFP64* destination)
|
||||
inline void bgc_fp64_cotes_number_copy(const BGC_FP64_CotesNumber* source, BGC_FP64_CotesNumber* destination)
|
||||
{
|
||||
destination->_cos = source->_cos;
|
||||
destination->_sin = source->_sin;
|
||||
|
|
@ -115,7 +128,7 @@ inline void bgc_cotes_number_copy_fp64(const BgcCotesNumberFP64* source, BgcCote
|
|||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void bgc_cotes_number_swap_fp32(BgcCotesNumberFP32* number1, BgcCotesNumberFP32* number2)
|
||||
inline void bgc_fp32_cotes_number_swap(BGC_FP32_CotesNumber* number1, BGC_FP32_CotesNumber* number2)
|
||||
{
|
||||
const float cos = number1->_cos;
|
||||
const float sin = number1->_sin;
|
||||
|
|
@ -127,7 +140,7 @@ inline void bgc_cotes_number_swap_fp32(BgcCotesNumberFP32* number1, BgcCotesNumb
|
|||
number2->_sin = sin;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_swap_fp64(BgcCotesNumberFP64* number1, BgcCotesNumberFP64* number2)
|
||||
inline void bgc_fp64_cotes_number_swap(BGC_FP64_CotesNumber* number1, BGC_FP64_CotesNumber* number2)
|
||||
{
|
||||
const double cos = number1->_cos;
|
||||
const double sin = number1->_sin;
|
||||
|
|
@ -141,61 +154,35 @@ inline void bgc_cotes_number_swap_fp64(BgcCotesNumberFP64* number1, BgcCotesNumb
|
|||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_cotes_number_convert_fp64_to_fp32(const BgcCotesNumberFP64* source, BgcCotesNumberFP32* destination)
|
||||
inline void bgc_fp64_cotes_number_convert_to_fp32(const BGC_FP64_CotesNumber* source, BGC_FP32_CotesNumber* destination)
|
||||
{
|
||||
bgc_cotes_number_set_values_fp32((float)source->_cos, (float)source->_sin, destination);
|
||||
bgc_fp32_cotes_number_make((float)source->_cos, (float)source->_sin, destination);
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_convert_fp32_to_fp64(const BgcCotesNumberFP32* source, BgcCotesNumberFP64* destination)
|
||||
inline void bgc_fp32_cotes_number_convert_to_fp64(const BGC_FP32_CotesNumber* source, BGC_FP64_CotesNumber* destination)
|
||||
{
|
||||
bgc_cotes_number_set_values_fp64((double)source->_cos, (double)source->_sin, destination);
|
||||
bgc_fp64_cotes_number_make((double)source->_cos, (double)source->_sin, destination);
|
||||
}
|
||||
|
||||
// ================== Negative ================== //
|
||||
// =================== Revert =================== //
|
||||
|
||||
inline void bgc_cotes_number_make_opposite_fp32(BgcCotesNumberFP32* number)
|
||||
{
|
||||
number->_cos = -number->_cos;
|
||||
number->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_make_opposite_fp64(BgcCotesNumberFP64* number)
|
||||
{
|
||||
number->_cos = -number->_cos;
|
||||
number->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_get_opposite_fp32(const BgcCotesNumberFP32* number, BgcCotesNumberFP32* opposite)
|
||||
{
|
||||
opposite->_cos = -number->_cos;
|
||||
opposite->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_get_opposite_fp64(const BgcCotesNumberFP64* number, BgcCotesNumberFP64* opposite)
|
||||
{
|
||||
opposite->_cos = -number->_cos;
|
||||
opposite->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
// =================== Invert =================== //
|
||||
|
||||
inline void bgc_cotes_number_invert_fp32(BgcCotesNumberFP32* number)
|
||||
inline void bgc_fp32_cotes_number_revert(BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
number->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_invert_fp64(BgcCotesNumberFP64* number)
|
||||
inline void bgc_fp64_cotes_number_revert(BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
number->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_get_inverse_fp32(const BgcCotesNumberFP32* number, BgcCotesNumberFP32* inverse)
|
||||
inline void bgc_fp32_cotes_number_get_reverse(const BGC_FP32_CotesNumber* number, BGC_FP32_CotesNumber* inverse)
|
||||
{
|
||||
inverse->_cos = number->_cos;
|
||||
inverse->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_get_inverse_fp64(const BgcCotesNumberFP64* number, BgcCotesNumberFP64* inverse)
|
||||
inline void bgc_fp64_cotes_number_get_inverse(const BGC_FP64_CotesNumber* number, BGC_FP64_CotesNumber* inverse)
|
||||
{
|
||||
inverse->_cos = number->_cos;
|
||||
inverse->_sin = -number->_sin;
|
||||
|
|
@ -203,7 +190,7 @@ inline void bgc_cotes_number_get_inverse_fp64(const BgcCotesNumberFP64* number,
|
|||
|
||||
// ================= Exponation ================= //
|
||||
|
||||
inline void bgc_cotes_number_get_exponation_fp32(const BgcCotesNumberFP32* base, const float exponent, BgcCotesNumberFP32* power)
|
||||
inline void bgc_fp32_cotes_number_get_exponation(const BGC_FP32_CotesNumber* base, const float exponent, BGC_FP32_CotesNumber* power)
|
||||
{
|
||||
const float power_angle = exponent * atan2f(base->_sin, base->_cos);
|
||||
|
||||
|
|
@ -211,7 +198,7 @@ inline void bgc_cotes_number_get_exponation_fp32(const BgcCotesNumberFP32* base,
|
|||
power->_sin = sinf(power_angle);
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_get_exponation_fp64(const BgcCotesNumberFP64* base, const double exponent, BgcCotesNumberFP64* power)
|
||||
inline void bgc_fp64_cotes_number_get_exponation(const BGC_FP64_CotesNumber* base, const double exponent, BGC_FP64_CotesNumber* power)
|
||||
{
|
||||
const double power_angle = exponent * atan2(base->_sin, base->_cos);
|
||||
|
||||
|
|
@ -221,18 +208,18 @@ inline void bgc_cotes_number_get_exponation_fp64(const BgcCotesNumberFP64* base,
|
|||
|
||||
// ================ Combination ================= //
|
||||
|
||||
inline void bgc_cotes_number_combine_fp32(const BgcCotesNumberFP32* number1, const BgcCotesNumberFP32* number2, BgcCotesNumberFP32* result)
|
||||
inline void bgc_fp32_cotes_number_combine(const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2, BGC_FP32_CotesNumber* result)
|
||||
{
|
||||
bgc_cotes_number_set_values_fp32(
|
||||
bgc_fp32_cotes_number_make(
|
||||
number1->_cos * number2->_cos - number1->_sin * number2->_sin,
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos,
|
||||
result
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_combine_fp64(const BgcCotesNumberFP64* number1, const BgcCotesNumberFP64* number2, BgcCotesNumberFP64* result)
|
||||
inline void bgc_fp64_cotes_number_combine(const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2, BGC_FP64_CotesNumber* result)
|
||||
{
|
||||
bgc_cotes_number_set_values_fp64(
|
||||
bgc_fp64_cotes_number_make(
|
||||
number1->_cos * number2->_cos - number1->_sin * number2->_sin,
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos,
|
||||
result
|
||||
|
|
@ -241,18 +228,18 @@ inline void bgc_cotes_number_combine_fp64(const BgcCotesNumberFP64* number1, con
|
|||
|
||||
// ================= Exclusion ================== //
|
||||
|
||||
inline void bgc_cotes_number_exclude_fp32(const BgcCotesNumberFP32* base, const BgcCotesNumberFP32* excludant, BgcCotesNumberFP32* difference)
|
||||
inline void bgc_fp32_cotes_number_exclude(const BGC_FP32_CotesNumber* base, const BGC_FP32_CotesNumber* excludant, BGC_FP32_CotesNumber* difference)
|
||||
{
|
||||
bgc_cotes_number_set_values_fp32(
|
||||
bgc_fp32_cotes_number_make(
|
||||
base->_cos * excludant->_cos + base->_sin * excludant->_sin,
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin,
|
||||
difference
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_exclude_fp64(const BgcCotesNumberFP64* base, const BgcCotesNumberFP64* excludant, BgcCotesNumberFP64* difference)
|
||||
inline void bgc_fp64_cotes_number_exclude(const BGC_FP64_CotesNumber* base, const BGC_FP64_CotesNumber* excludant, BGC_FP64_CotesNumber* difference)
|
||||
{
|
||||
bgc_cotes_number_set_values_fp64(
|
||||
bgc_fp64_cotes_number_make(
|
||||
base->_cos * excludant->_cos + base->_sin * excludant->_sin,
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin,
|
||||
difference
|
||||
|
|
@ -261,7 +248,7 @@ inline void bgc_cotes_number_exclude_fp64(const BgcCotesNumberFP64* base, const
|
|||
|
||||
// ============== Rotation Matrix =============== //
|
||||
|
||||
inline void bgc_cotes_number_get_rotation_matrix_fp32(const BgcCotesNumberFP32* number, BgcMatrix2x2FP32* matrix)
|
||||
inline void bgc_fp32_cotes_number_get_rotation_matrix(const BGC_FP32_CotesNumber* number, BGC_FP32_Matrix2x2* matrix)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = -number->_sin;
|
||||
|
|
@ -269,7 +256,7 @@ inline void bgc_cotes_number_get_rotation_matrix_fp32(const BgcCotesNumberFP32*
|
|||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_get_rotation_matrix_fp64(const BgcCotesNumberFP64* number, BgcMatrix2x2FP64* matrix)
|
||||
inline void bgc_fp64_cotes_number_get_rotation_matrix(const BGC_FP64_CotesNumber* number, BGC_FP64_Matrix2x2* matrix)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = -number->_sin;
|
||||
|
|
@ -279,7 +266,7 @@ inline void bgc_cotes_number_get_rotation_matrix_fp64(const BgcCotesNumberFP64*
|
|||
|
||||
// ============== Reverse Matrix ================ //
|
||||
|
||||
inline void bgc_cotes_number_get_reverse_matrix_fp32(const BgcCotesNumberFP32* number, BgcMatrix2x2FP32* matrix)
|
||||
inline void bgc_fp32_cotes_number_get_reverse_matrix(const BGC_FP32_CotesNumber* number, BGC_FP32_Matrix2x2* matrix)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = number->_sin;
|
||||
|
|
@ -287,7 +274,7 @@ inline void bgc_cotes_number_get_reverse_matrix_fp32(const BgcCotesNumberFP32* n
|
|||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_get_reverse_matrix_fp64(const BgcCotesNumberFP64* number, BgcMatrix2x2FP64* matrix)
|
||||
inline void bgc_fp64_cotes_number_get_reverse_matrix(const BGC_FP64_CotesNumber* number, BGC_FP64_Matrix2x2* matrix)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = number->_sin;
|
||||
|
|
@ -297,7 +284,7 @@ inline void bgc_cotes_number_get_reverse_matrix_fp64(const BgcCotesNumberFP64* n
|
|||
|
||||
// ================ Turn Vector ================= //
|
||||
|
||||
inline void bgc_cotes_number_turn_vector_fp32(const BgcCotesNumberFP32* number, const BgcVector2FP32* vector, BgcVector2FP32* result)
|
||||
inline void bgc_fp32_cotes_number_turn_vector(const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector, BGC_FP32_Vector2* result)
|
||||
{
|
||||
const float x1 = number->_cos * vector->x1 - number->_sin * vector->x2;
|
||||
const float x2 = number->_sin * vector->x1 + number->_cos * vector->x2;
|
||||
|
|
@ -306,7 +293,7 @@ inline void bgc_cotes_number_turn_vector_fp32(const BgcCotesNumberFP32* number,
|
|||
result->x2 = x2;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_turn_vector_fp64(const BgcCotesNumberFP64* number, const BgcVector2FP64* vector, BgcVector2FP64* result)
|
||||
inline void bgc_fp64_cotes_number_turn_vector(const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector, BGC_FP64_Vector2* result)
|
||||
{
|
||||
const double x1 = number->_cos * vector->x1 - number->_sin * vector->x2;
|
||||
const double x2 = number->_sin * vector->x1 + number->_cos * vector->x2;
|
||||
|
|
@ -317,7 +304,7 @@ inline void bgc_cotes_number_turn_vector_fp64(const BgcCotesNumberFP64* number,
|
|||
|
||||
// ============ Turn Vector Backward ============ //
|
||||
|
||||
inline void bgc_cotes_number_turn_vector_back_fp32(const BgcCotesNumberFP32* number, const BgcVector2FP32* vector, BgcVector2FP32* result)
|
||||
inline void bgc_fp32_cotes_number_turn_vector_back(const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector, BGC_FP32_Vector2* result)
|
||||
{
|
||||
const float x1 = number->_sin * vector->x2 + number->_cos * vector->x1;
|
||||
const float x2 = number->_cos * vector->x2 - number->_sin * vector->x1;
|
||||
|
|
@ -326,7 +313,7 @@ inline void bgc_cotes_number_turn_vector_back_fp32(const BgcCotesNumberFP32* num
|
|||
result->x2 = x2;
|
||||
}
|
||||
|
||||
inline void bgc_cotes_number_turn_vector_back_fp64(const BgcCotesNumberFP64* number, const BgcVector2FP64* vector, BgcVector2FP64* result)
|
||||
inline void bgc_fp64_cotes_number_turn_vector_back(const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector, BGC_FP64_Vector2* result)
|
||||
{
|
||||
const double x1 = number->_sin * vector->x2 + number->_cos * vector->x1;
|
||||
const double x2 = number->_cos * vector->x2 - number->_sin * vector->x1;
|
||||
|
|
@ -337,20 +324,20 @@ inline void bgc_cotes_number_turn_vector_back_fp64(const BgcCotesNumberFP64* num
|
|||
|
||||
// ================== Are Close ================= //
|
||||
|
||||
inline int bgc_cotes_number_are_close_fp32(const BgcCotesNumberFP32* number1, const BgcCotesNumberFP32* number2)
|
||||
inline int bgc_fp32_cotes_number_are_close(const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2)
|
||||
{
|
||||
const float d_cos = number1->_cos - number2->_cos;
|
||||
const float d_sin = number1->_sin - number2->_sin;
|
||||
|
||||
return d_cos * d_cos + d_sin * d_sin <= BGC_SQUARE_EPSYLON_FP32;
|
||||
return d_cos * d_cos + d_sin * d_sin <= BGC_FP32_SQUARE_EPSYLON;
|
||||
}
|
||||
|
||||
inline int bgc_cotes_number_are_close_fp64(const BgcCotesNumberFP64* number1, const BgcCotesNumberFP64* number2)
|
||||
inline int bgc_fp64_cotes_number_are_close(const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2)
|
||||
{
|
||||
const double d_cos = number1->_cos - number2->_cos;
|
||||
const double d_sin = number1->_sin - number2->_sin;
|
||||
|
||||
return d_cos * d_cos + d_sin * d_sin <= BGC_SQUARE_EPSYLON_FP64;
|
||||
return d_cos * d_cos + d_sin * d_sin <= BGC_FP64_SQUARE_EPSYLON;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue