Переименование методов на распространённые названия

This commit is contained in:
Andrey Pokidov 2026-02-16 20:41:45 +07:00
parent 039b26305a
commit b621191698
14 changed files with 192 additions and 192 deletions

View file

@ -37,46 +37,46 @@ inline void bgc_fp64_vector2_make(BGC_FP64_Vector2* destination, const double x1
// ================== Modulus =================== //
inline float bgc_fp32_vector2_get_square_modulus(const BGC_FP32_Vector2* vector)
inline float bgc_fp32_vector2_get_squared_length(const BGC_FP32_Vector2* vector)
{
return vector->x1 * vector->x1 + vector->x2 * vector->x2;
}
inline double bgc_fp64_vector2_get_square_modulus(const BGC_FP64_Vector2* vector)
inline double bgc_fp64_vector2_get_squared_length(const BGC_FP64_Vector2* vector)
{
return vector->x1 * vector->x1 + vector->x2 * vector->x2;
}
inline float bgc_fp32_vector2_get_modulus(const BGC_FP32_Vector2* vector)
inline float bgc_fp32_vector2_get_length(const BGC_FP32_Vector2* vector)
{
return sqrtf(bgc_fp32_vector2_get_square_modulus(vector));
return sqrtf(bgc_fp32_vector2_get_squared_length(vector));
}
inline double bgc_fp64_vector2_get_modulus(const BGC_FP64_Vector2* vector)
inline double bgc_fp64_vector2_get_length(const BGC_FP64_Vector2* vector)
{
return sqrt(bgc_fp64_vector2_get_square_modulus(vector));
return sqrt(bgc_fp64_vector2_get_squared_length(vector));
}
// ================= Comparison ================= //
inline int bgc_fp32_vector2_is_zero(const BGC_FP32_Vector2* vector)
{
return bgc_fp32_vector2_get_square_modulus(vector) <= BGC_FP32_SQUARE_EPSILON;
return bgc_fp32_vector2_get_squared_length(vector) <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_vector2_is_zero(const BGC_FP64_Vector2* vector)
{
return bgc_fp64_vector2_get_square_modulus(vector) <= BGC_FP64_SQUARE_EPSILON;
return bgc_fp64_vector2_get_squared_length(vector) <= BGC_FP64_SQUARE_EPSILON;
}
inline int bgc_fp32_vector2_is_unit(const BGC_FP32_Vector2* vector)
{
return bgc_fp32_is_square_unit(bgc_fp32_vector2_get_square_modulus(vector));
return bgc_fp32_is_square_unit(bgc_fp32_vector2_get_squared_length(vector));
}
inline int bgc_fp64_vector2_is_unit(const BGC_FP64_Vector2* vector)
{
return bgc_fp64_is_square_unit(bgc_fp64_vector2_get_square_modulus(vector));
return bgc_fp64_is_square_unit(bgc_fp64_vector2_get_squared_length(vector));
}
// ==================== Copy ==================== //
@ -339,7 +339,7 @@ inline void bgc_fp64_vector2_get_reverse(BGC_FP64_Vector2* reverse, const BGC_FP
inline int bgc_fp32_vector2_normalize(BGC_FP32_Vector2* vector)
{
const float square_modulus = bgc_fp32_vector2_get_square_modulus(vector);
const float square_modulus = bgc_fp32_vector2_get_squared_length(vector);
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return BGC_FAILURE;
@ -359,7 +359,7 @@ inline int bgc_fp32_vector2_normalize(BGC_FP32_Vector2* vector)
inline int bgc_fp64_vector2_normalize(BGC_FP64_Vector2* vector)
{
const double square_modulus = bgc_fp64_vector2_get_square_modulus(vector);
const double square_modulus = bgc_fp64_vector2_get_squared_length(vector);
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return BGC_FAILURE;
@ -379,7 +379,7 @@ inline int bgc_fp64_vector2_normalize(BGC_FP64_Vector2* vector)
inline int bgc_fp32_vector2_get_normalized(BGC_FP32_Vector2* normalized, const BGC_FP32_Vector2* vector)
{
const float square_modulus = bgc_fp32_vector2_get_square_modulus(vector);
const float square_modulus = bgc_fp32_vector2_get_squared_length(vector);
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
bgc_fp32_vector2_reset(normalized);
@ -397,7 +397,7 @@ inline int bgc_fp32_vector2_get_normalized(BGC_FP32_Vector2* normalized, const B
inline int bgc_fp64_vector2_get_normalized(BGC_FP64_Vector2* normalized, const BGC_FP64_Vector2* vector)
{
const double square_modulus = bgc_fp64_vector2_get_square_modulus(vector);
const double square_modulus = bgc_fp64_vector2_get_squared_length(vector);
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
bgc_fp64_vector2_reset(normalized);
@ -489,8 +489,8 @@ inline int bgc_fp64_vector2_are_close_enough(const BGC_FP64_Vector2* vector1, co
inline int bgc_fp32_vector2_are_close(const BGC_FP32_Vector2* vector1, const BGC_FP32_Vector2* vector2)
{
const float square_modulus1 = bgc_fp32_vector2_get_square_modulus(vector1);
const float square_modulus2 = bgc_fp32_vector2_get_square_modulus(vector2);
const float square_modulus1 = bgc_fp32_vector2_get_squared_length(vector1);
const float square_modulus2 = bgc_fp32_vector2_get_squared_length(vector2);
const float square_distance = bgc_fp32_vector2_get_square_distance(vector1, vector2);
if (square_modulus1 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT) {
@ -502,8 +502,8 @@ inline int bgc_fp32_vector2_are_close(const BGC_FP32_Vector2* vector1, const BGC
inline int bgc_fp64_vector2_are_close(const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2)
{
const double square_modulus1 = bgc_fp64_vector2_get_square_modulus(vector1);
const double square_modulus2 = bgc_fp64_vector2_get_square_modulus(vector2);
const double square_modulus1 = bgc_fp64_vector2_get_squared_length(vector1);
const double square_modulus2 = bgc_fp64_vector2_get_squared_length(vector2);
const double square_distance = bgc_fp64_vector2_get_square_distance(vector1, vector2);
if (square_modulus1 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT) {
@ -518,13 +518,13 @@ inline int bgc_fp64_vector2_are_close(const BGC_FP64_Vector2* vector1, const BGC
inline int bgc_fp32_vector2_are_parallel(const BGC_FP32_Vector2* vector1, const BGC_FP32_Vector2* vector2)
{
const float square_modulus1 = bgc_fp32_vector2_get_square_modulus(vector1);
const float square_modulus1 = bgc_fp32_vector2_get_squared_length(vector1);
if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
}
const float square_modulus2 = bgc_fp32_vector2_get_square_modulus(vector2);
const float square_modulus2 = bgc_fp32_vector2_get_squared_length(vector2);
if (square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
@ -537,13 +537,13 @@ inline int bgc_fp32_vector2_are_parallel(const BGC_FP32_Vector2* vector1, const
inline int bgc_fp64_vector2_are_parallel(const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2)
{
const double square_modulus1 = bgc_fp64_vector2_get_square_modulus(vector1);
const double square_modulus1 = bgc_fp64_vector2_get_squared_length(vector1);
if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
}
const double square_modulus2 = bgc_fp64_vector2_get_square_modulus(vector2);
const double square_modulus2 = bgc_fp64_vector2_get_squared_length(vector2);
if (square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
@ -558,13 +558,13 @@ inline int bgc_fp64_vector2_are_parallel(const BGC_FP64_Vector2* vector1, const
inline int bgc_fp32_vector2_are_orthogonal(const BGC_FP32_Vector2* vector1, const BGC_FP32_Vector2* vector2)
{
const float square_modulus1 = bgc_fp32_vector2_get_square_modulus(vector1);
const float square_modulus1 = bgc_fp32_vector2_get_squared_length(vector1);
if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
}
const float square_modulus2 = bgc_fp32_vector2_get_square_modulus(vector2);
const float square_modulus2 = bgc_fp32_vector2_get_squared_length(vector2);
if (square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
@ -577,13 +577,13 @@ inline int bgc_fp32_vector2_are_orthogonal(const BGC_FP32_Vector2* vector1, cons
inline int bgc_fp64_vector2_are_orthogonal(const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2)
{
const double square_modulus1 = bgc_fp64_vector2_get_square_modulus(vector1);
const double square_modulus1 = bgc_fp64_vector2_get_squared_length(vector1);
if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
}
const double square_modulus2 = bgc_fp64_vector2_get_square_modulus(vector2);
const double square_modulus2 = bgc_fp64_vector2_get_squared_length(vector2);
if (square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
@ -599,8 +599,8 @@ inline int bgc_fp64_vector2_are_orthogonal(const BGC_FP64_Vector2* vector1, cons
inline int bgc_fp32_vector2_get_attitude(const BGC_FP32_Vector2* vector1, const BGC_FP32_Vector2* vector2)
{
const float square_modulus1 = bgc_fp32_vector2_get_square_modulus(vector1);
const float square_modulus2 = bgc_fp32_vector2_get_square_modulus(vector2);
const float square_modulus1 = bgc_fp32_vector2_get_squared_length(vector1);
const float square_modulus2 = bgc_fp32_vector2_get_squared_length(vector2);
if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
return BGC_ATTITUDE_ZERO;
@ -625,8 +625,8 @@ inline int bgc_fp32_vector2_get_attitude(const BGC_FP32_Vector2* vector1, const
inline int bgc_fp64_vector2_get_attitude(const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2)
{
const double square_modulus1 = bgc_fp64_vector2_get_square_modulus(vector1);
const double square_modulus2 = bgc_fp64_vector2_get_square_modulus(vector2);
const double square_modulus1 = bgc_fp64_vector2_get_squared_length(vector1);
const double square_modulus2 = bgc_fp64_vector2_get_squared_length(vector2);
if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
return BGC_ATTITUDE_ZERO;