Переход на парадигму Destination first в порядке параметров функий
This commit is contained in:
parent
f7e41645fe
commit
03627f4401
41 changed files with 1570 additions and 1978 deletions
|
|
@ -41,7 +41,7 @@ inline void bgc_fp64_cotes_number_reset(BGC_FP64_CotesNumber* number)
|
|||
|
||||
// ================== Set Turn ================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_make_for_angle(const float angle, const int angle_unit, BGC_FP32_CotesNumber* number)
|
||||
inline void bgc_fp32_cotes_number_make_for_angle(BGC_FP32_CotesNumber* number, const float angle, const int angle_unit)
|
||||
{
|
||||
const float radians = bgc_fp32_angle_to_radians(angle, angle_unit);
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ inline void bgc_fp32_cotes_number_make_for_angle(const float angle, const int an
|
|||
number->_sin = sinf(radians);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_make_for_angle(const double angle, const int angle_unit, BGC_FP64_CotesNumber* number)
|
||||
inline void bgc_fp64_cotes_number_make_for_angle(BGC_FP64_CotesNumber* number, const double angle, const int angle_unit)
|
||||
{
|
||||
const double radians = bgc_fp64_angle_to_radians(angle, angle_unit);
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ void _bgc_fp32_cotes_number_normalize(BGC_FP32_CotesNumber* twin);
|
|||
|
||||
void _bgc_fp64_cotes_number_normalize(BGC_FP64_CotesNumber* twin);
|
||||
|
||||
inline void bgc_fp32_cotes_number_make(const float x1, const float x2, BGC_FP32_CotesNumber* number)
|
||||
inline void bgc_fp32_cotes_number_make(BGC_FP32_CotesNumber* number, const float x1, const float x2)
|
||||
{
|
||||
const float square_modulus = x1 * x1 + x2 * x2;
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ inline void bgc_fp32_cotes_number_make(const float x1, const float x2, BGC_FP32_
|
|||
}
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_make(const double x1, const double x2, BGC_FP64_CotesNumber* number)
|
||||
inline void bgc_fp64_cotes_number_make(BGC_FP64_CotesNumber* number, const double x1, const double x2)
|
||||
{
|
||||
const double square_modulus = x1 * x1 + x2 * x2;
|
||||
|
||||
|
|
@ -114,13 +114,13 @@ inline double bgc_fp64_cotes_number_get_angle(const BGC_FP64_CotesNumber* number
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_copy(const BGC_FP32_CotesNumber* source, BGC_FP32_CotesNumber* destination)
|
||||
inline void bgc_fp32_cotes_number_copy(BGC_FP32_CotesNumber* destination, const BGC_FP32_CotesNumber* source)
|
||||
{
|
||||
destination->_cos = source->_cos;
|
||||
destination->_sin = source->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_copy(const BGC_FP64_CotesNumber* source, BGC_FP64_CotesNumber* destination)
|
||||
inline void bgc_fp64_cotes_number_copy(BGC_FP64_CotesNumber* destination, const BGC_FP64_CotesNumber* source)
|
||||
{
|
||||
destination->_cos = source->_cos;
|
||||
destination->_sin = source->_sin;
|
||||
|
|
@ -154,14 +154,14 @@ inline void bgc_fp64_cotes_number_swap(BGC_FP64_CotesNumber* number1, BGC_FP64_C
|
|||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_cotes_number_convert_to_fp32(const BGC_FP64_CotesNumber* source, BGC_FP32_CotesNumber* destination)
|
||||
inline void bgc_fp64_cotes_number_convert_to_fp32(BGC_FP32_CotesNumber* destination, const BGC_FP64_CotesNumber* source)
|
||||
{
|
||||
bgc_fp32_cotes_number_make((float)source->_cos, (float)source->_sin, destination);
|
||||
bgc_fp32_cotes_number_make(destination, (float)source->_cos, (float)source->_sin);
|
||||
}
|
||||
|
||||
inline void bgc_fp32_cotes_number_convert_to_fp64(const BGC_FP32_CotesNumber* source, BGC_FP64_CotesNumber* destination)
|
||||
inline void bgc_fp32_cotes_number_convert_to_fp64(BGC_FP64_CotesNumber* destination, const BGC_FP32_CotesNumber* source)
|
||||
{
|
||||
bgc_fp64_cotes_number_make((double)source->_cos, (double)source->_sin, destination);
|
||||
bgc_fp64_cotes_number_make(destination, (double)source->_cos, (double)source->_sin);
|
||||
}
|
||||
|
||||
// =================== Revert =================== //
|
||||
|
|
@ -176,21 +176,21 @@ inline void bgc_fp64_cotes_number_revert(BGC_FP64_CotesNumber* number)
|
|||
number->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_reverse(const BGC_FP32_CotesNumber* number, BGC_FP32_CotesNumber* inverse)
|
||||
inline void bgc_fp32_cotes_number_get_reverse(BGC_FP32_CotesNumber* reverse, const BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
inverse->_cos = number->_cos;
|
||||
inverse->_sin = -number->_sin;
|
||||
reverse->_cos = number->_cos;
|
||||
reverse->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_inverse(const BGC_FP64_CotesNumber* number, BGC_FP64_CotesNumber* inverse)
|
||||
inline void bgc_fp64_cotes_number_get_reverse(BGC_FP64_CotesNumber* reverse, const BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
inverse->_cos = number->_cos;
|
||||
inverse->_sin = -number->_sin;
|
||||
reverse->_cos = number->_cos;
|
||||
reverse->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
// ================= Exponation ================= //
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_exponation(const BGC_FP32_CotesNumber* base, const float exponent, BGC_FP32_CotesNumber* power)
|
||||
inline void bgc_fp32_cotes_number_get_exponation(BGC_FP32_CotesNumber* power, const BGC_FP32_CotesNumber* base, const float exponent)
|
||||
{
|
||||
const float power_angle = exponent * atan2f(base->_sin, base->_cos);
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ inline void bgc_fp32_cotes_number_get_exponation(const BGC_FP32_CotesNumber* bas
|
|||
power->_sin = sinf(power_angle);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_exponation(const BGC_FP64_CotesNumber* base, const double exponent, BGC_FP64_CotesNumber* power)
|
||||
inline void bgc_fp64_cotes_number_get_exponation(BGC_FP64_CotesNumber* power, const BGC_FP64_CotesNumber* base, const double exponent)
|
||||
{
|
||||
const double power_angle = exponent * atan2(base->_sin, base->_cos);
|
||||
|
||||
|
|
@ -208,47 +208,47 @@ inline void bgc_fp64_cotes_number_get_exponation(const BGC_FP64_CotesNumber* bas
|
|||
|
||||
// ================ Combination ================= //
|
||||
|
||||
inline void bgc_fp32_cotes_number_combine(const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2, BGC_FP32_CotesNumber* result)
|
||||
inline void bgc_fp32_cotes_number_combine(BGC_FP32_CotesNumber* combination, const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2)
|
||||
{
|
||||
bgc_fp32_cotes_number_make(
|
||||
combination,
|
||||
number1->_cos * number2->_cos - number1->_sin * number2->_sin,
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos,
|
||||
result
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_combine(const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2, BGC_FP64_CotesNumber* result)
|
||||
inline void bgc_fp64_cotes_number_combine(BGC_FP64_CotesNumber* combination, const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2)
|
||||
{
|
||||
bgc_fp64_cotes_number_make(
|
||||
combination,
|
||||
number1->_cos * number2->_cos - number1->_sin * number2->_sin,
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos,
|
||||
result
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos
|
||||
);
|
||||
}
|
||||
|
||||
// ================= Exclusion ================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_exclude(const BGC_FP32_CotesNumber* base, const BGC_FP32_CotesNumber* excludant, BGC_FP32_CotesNumber* difference)
|
||||
inline void bgc_fp32_cotes_number_exclude(BGC_FP32_CotesNumber* difference, const BGC_FP32_CotesNumber* base, const BGC_FP32_CotesNumber* excludant)
|
||||
{
|
||||
bgc_fp32_cotes_number_make(
|
||||
difference,
|
||||
base->_cos * excludant->_cos + base->_sin * excludant->_sin,
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin,
|
||||
difference
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_exclude(const BGC_FP64_CotesNumber* base, const BGC_FP64_CotesNumber* excludant, BGC_FP64_CotesNumber* difference)
|
||||
inline void bgc_fp64_cotes_number_exclude(BGC_FP64_CotesNumber* difference, const BGC_FP64_CotesNumber* base, const BGC_FP64_CotesNumber* excludant)
|
||||
{
|
||||
bgc_fp64_cotes_number_make(
|
||||
difference,
|
||||
base->_cos * excludant->_cos + base->_sin * excludant->_sin,
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin,
|
||||
difference
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin
|
||||
);
|
||||
}
|
||||
|
||||
// ============== Rotation Matrix =============== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_rotation_matrix(const BGC_FP32_CotesNumber* number, BGC_FP32_Matrix2x2* matrix)
|
||||
inline void bgc_fp32_cotes_number_get_rotation_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = -number->_sin;
|
||||
|
|
@ -256,7 +256,7 @@ inline void bgc_fp32_cotes_number_get_rotation_matrix(const BGC_FP32_CotesNumber
|
|||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_rotation_matrix(const BGC_FP64_CotesNumber* number, BGC_FP64_Matrix2x2* matrix)
|
||||
inline void bgc_fp64_cotes_number_get_rotation_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = -number->_sin;
|
||||
|
|
@ -266,7 +266,7 @@ inline void bgc_fp64_cotes_number_get_rotation_matrix(const BGC_FP64_CotesNumber
|
|||
|
||||
// ============== Reverse Matrix ================ //
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_reverse_matrix(const BGC_FP32_CotesNumber* number, BGC_FP32_Matrix2x2* matrix)
|
||||
inline void bgc_fp32_cotes_number_get_reverse_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = number->_sin;
|
||||
|
|
@ -274,7 +274,7 @@ inline void bgc_fp32_cotes_number_get_reverse_matrix(const BGC_FP32_CotesNumber*
|
|||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_reverse_matrix(const BGC_FP64_CotesNumber* number, BGC_FP64_Matrix2x2* matrix)
|
||||
inline void bgc_fp64_cotes_number_get_reverse_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = number->_sin;
|
||||
|
|
@ -284,42 +284,42 @@ inline void bgc_fp64_cotes_number_get_reverse_matrix(const BGC_FP64_CotesNumber*
|
|||
|
||||
// ================ Turn Vector ================= //
|
||||
|
||||
inline void bgc_fp32_cotes_number_turn_vector(const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector, BGC_FP32_Vector2* result)
|
||||
inline void bgc_fp32_cotes_number_turn_vector(BGC_FP32_Vector2* turned_vector, const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector)
|
||||
{
|
||||
const float x1 = number->_cos * vector->x1 - number->_sin * vector->x2;
|
||||
const float x2 = number->_sin * vector->x1 + number->_cos * vector->x2;
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_turn_vector(const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector, BGC_FP64_Vector2* result)
|
||||
inline void bgc_fp64_cotes_number_turn_vector(BGC_FP64_Vector2* turned_vector, const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector)
|
||||
{
|
||||
const double x1 = number->_cos * vector->x1 - number->_sin * vector->x2;
|
||||
const double x2 = number->_sin * vector->x1 + number->_cos * vector->x2;
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
// ============ Turn Vector Backward ============ //
|
||||
|
||||
inline void bgc_fp32_cotes_number_turn_vector_back(const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector, BGC_FP32_Vector2* result)
|
||||
inline void bgc_fp32_cotes_number_turn_vector_back(BGC_FP32_Vector2* turned_vector, const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector)
|
||||
{
|
||||
const float x1 = number->_sin * vector->x2 + number->_cos * vector->x1;
|
||||
const float x2 = number->_cos * vector->x2 - number->_sin * vector->x1;
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_turn_vector_back(const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector, BGC_FP64_Vector2* result)
|
||||
inline void bgc_fp64_cotes_number_turn_vector_back(BGC_FP64_Vector2* turned_vector, const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector)
|
||||
{
|
||||
const double x1 = number->_sin * vector->x2 + number->_cos * vector->x1;
|
||||
const double x2 = number->_cos * vector->x2 - number->_sin * vector->x1;
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
// ================== Are Close ================= //
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue