Переход на версию 0.3: изменение подхода к именованию сущностей, добавление, изменение и удаление ряда функций

This commit is contained in:
Andrey Pokidov 2026-01-30 19:37:49 +07:00
parent d33daf4e2d
commit f7e41645fe
87 changed files with 4580 additions and 4051 deletions

View file

@ -1,153 +1,153 @@
#include "vector3.h"
extern inline void bgc_vector3_reset_fp32(BgcVector3FP32* vector);
extern inline void bgc_vector3_reset_fp64(BgcVector3FP64* vector);
extern inline void bgc_fp32_vector3_reset(BGC_FP32_Vector3* vector);
extern inline void bgc_fp64_vector3_reset(BGC_FP64_Vector3* vector);
extern inline void bgc_vector3_set_values_fp32(const float x1, const float x2, const float x3, BgcVector3FP32* destination);
extern inline void bgc_vector3_set_values_fp64(const double x1, const double x2, const double x3, BgcVector3FP64* destination);
extern inline void bgc_fp32_vector3_make(const float x1, const float x2, const float x3, BGC_FP32_Vector3* destination);
extern inline void bgc_fp64_vector3_make(const double x1, const double x2, const double x3, BGC_FP64_Vector3* destination);
extern inline float bgc_vector3_get_square_modulus_fp32(const BgcVector3FP32* vector);
extern inline double bgc_vector3_get_square_modulus_fp64(const BgcVector3FP64* vector);
extern inline float bgc_fp32_vector3_get_square_modulus(const BGC_FP32_Vector3* vector);
extern inline double bgc_fp64_vector3_get_square_modulus(const BGC_FP64_Vector3* vector);
extern inline float bgc_vector3_get_modulus_fp32(const BgcVector3FP32* vector);
extern inline double bgc_vector3_get_modulus_fp64(const BgcVector3FP64* vector);
extern inline float bgc_fp32_vector3_get_modulus(const BGC_FP32_Vector3* vector);
extern inline double bgc_fp64_vector3_get_modulus(const BGC_FP64_Vector3* vector);
extern inline int bgc_vector3_is_zero_fp32(const BgcVector3FP32* vector);
extern inline int bgc_vector3_is_zero_fp64(const BgcVector3FP64* vector);
extern inline int bgc_fp32_vector3_is_zero(const BGC_FP32_Vector3* vector);
extern inline int bgc_fp64_vector3_is_zero(const BGC_FP64_Vector3* vector);
extern inline int bgc_vector3_is_unit_fp32(const BgcVector3FP32* vector);
extern inline int bgc_vector3_is_unit_fp64(const BgcVector3FP64* vector);
extern inline int bgc_fp32_vector3_is_unit(const BGC_FP32_Vector3* vector);
extern inline int bgc_fp64_vector3_is_unit(const BGC_FP64_Vector3* vector);
extern inline void bgc_vector3_copy_fp32(const BgcVector3FP32* source, BgcVector3FP32* destination);
extern inline void bgc_vector3_copy_fp64(const BgcVector3FP64* source, BgcVector3FP64* destination);
extern inline void bgc_fp32_vector3_copy(const BGC_FP32_Vector3* source, BGC_FP32_Vector3* destination);
extern inline void bgc_fp64_vector3_copy(const BGC_FP64_Vector3* source, BGC_FP64_Vector3* destination);
extern inline void bgc_vector3_convert_fp64_to_fp32(const BgcVector3FP64* source, BgcVector3FP32* destination);
extern inline void bgc_vector3_convert_fp32_to_fp64(const BgcVector3FP32* source, BgcVector3FP64* destination);
extern inline void bgc_fp32_vector3_convert_to_fp64(const BGC_FP32_Vector3* source, BGC_FP64_Vector3* destination);
extern inline void bgc_fp64_vector3_convert_to_fp32(const BGC_FP64_Vector3* source, BGC_FP32_Vector3* destination);
extern inline void bgc_vector3_swap_fp32(BgcVector3FP32* vector1, BgcVector3FP32* vector2);
extern inline void bgc_vector3_swap_fp64(BgcVector3FP64* vector1, BgcVector3FP64* vector2);
extern inline void bgc_fp32_vector3_swap(BGC_FP32_Vector3* vector1, BGC_FP32_Vector3* vector2);
extern inline void bgc_fp64_vector3_swap(BGC_FP64_Vector3* vector1, BGC_FP64_Vector3* vector2);
extern inline void bgc_vector3_add_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, BgcVector3FP32* sum);
extern inline void bgc_vector3_add_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, BgcVector3FP64* sum);
extern inline void bgc_fp32_vector3_add(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, BGC_FP32_Vector3* sum);
extern inline void bgc_fp64_vector3_add(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, BGC_FP64_Vector3* sum);
extern inline void bgc_vector3_add_scaled_fp32(const BgcVector3FP32* basic_vector, const BgcVector3FP32* scalable_vector, const float scale, BgcVector3FP32* sum);
extern inline void bgc_vector3_add_scaled_fp64(const BgcVector3FP64* basic_vector, const BgcVector3FP64* scalable_vector, const double scale, BgcVector3FP64* sum);
extern inline void bgc_fp32_vector3_add_scaled(const BGC_FP32_Vector3* basic_vector, const BGC_FP32_Vector3* scalable_vector, const float scale, BGC_FP32_Vector3* sum);
extern inline void bgc_fp64_vector3_add_scaled(const BGC_FP64_Vector3* basic_vector, const BGC_FP64_Vector3* scalable_vector, const double scale, BGC_FP64_Vector3* sum);
extern inline void bgc_vector3_subtract_fp32(const BgcVector3FP32* minuend, const BgcVector3FP32* subtrahend, BgcVector3FP32* difference);
extern inline void bgc_vector3_subtract_fp64(const BgcVector3FP64* minuend, const BgcVector3FP64* subtrahend, BgcVector3FP64* difference);
extern inline void bgc_fp32_vector3_subtract(const BGC_FP32_Vector3* minuend, const BGC_FP32_Vector3* subtrahend, BGC_FP32_Vector3* difference);
extern inline void bgc_fp64_vector3_subtract(const BGC_FP64_Vector3* minuend, const BGC_FP64_Vector3* subtrahend, BGC_FP64_Vector3* difference);
extern inline void bgc_vector3_multiply_fp32(const BgcVector3FP32* multiplicand, const float multiplier, BgcVector3FP32* product);
extern inline void bgc_vector3_multiply_fp64(const BgcVector3FP64* multiplicand, const double multiplier, BgcVector3FP64* product);
extern inline void bgc_fp32_vector3_multiply(const BGC_FP32_Vector3* multiplicand, const float multiplier, BGC_FP32_Vector3* product);
extern inline void bgc_fp64_vector3_multiply(const BGC_FP64_Vector3* multiplicand, const double multiplier, BGC_FP64_Vector3* product);
extern inline void bgc_vector3_divide_fp32(const BgcVector3FP32* dividend, const float divisor, BgcVector3FP32* quotient);
extern inline void bgc_vector3_divide_fp64(const BgcVector3FP64* dividend, const double divisor, BgcVector3FP64* quotient);
extern inline void bgc_fp32_vector3_divide(const BGC_FP32_Vector3* dividend, const float divisor, BGC_FP32_Vector3* quotient);
extern inline void bgc_fp64_vector3_divide(const BGC_FP64_Vector3* dividend, const double divisor, BGC_FP64_Vector3* quotient);
extern inline void bgc_vector3_get_mean_of_two_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, BgcVector3FP32* result);
extern inline void bgc_vector3_get_mean_of_two_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, BgcVector3FP64* result);
extern inline void bgc_fp32_vector3_get_middle2(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, BGC_FP32_Vector3* middle);
extern inline void bgc_fp64_vector3_get_middle2(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, BGC_FP64_Vector3* middle);
extern inline void bgc_vector3_get_mean_of_three_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, const BgcVector3FP32* vector3, BgcVector3FP32* result);
extern inline void bgc_vector3_get_mean_of_three_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, const BgcVector3FP64* vector3, BgcVector3FP64* result);
extern inline void bgc_fp32_vector3_get_middle3(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, const BGC_FP32_Vector3* vector3, BGC_FP32_Vector3* middle);
extern inline void bgc_fp64_vector3_get_middle3(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, const BGC_FP64_Vector3* vector3, BGC_FP64_Vector3* middle);
extern inline void bgc_vector3_interpolate_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, const float phase, BgcVector3FP32* interpolation);
extern inline void bgc_vector3_interpolate_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, const double phase, BgcVector3FP64* interpolation);
extern inline void bgc_fp32_vector3_interpolate(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, const float phase, BGC_FP32_Vector3* interpolation);
extern inline void bgc_fp64_vector3_interpolate(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, const double phase, BGC_FP64_Vector3* interpolation);
extern inline void bgc_vector3_make_opposite_fp32(BgcVector3FP32* vector);
extern inline void bgc_vector3_make_opposite_fp64(BgcVector3FP64* vector);
extern inline void bgc_fp32_vector3_revert(BGC_FP32_Vector3* vector);
extern inline void bgc_fp64_vector3_revert(BGC_FP64_Vector3* vector);
extern inline void bgc_vector3_get_opposite_fp32(const BgcVector3FP32* vector, BgcVector3FP32* opposite);
extern inline void bgc_vector3_get_opposite_fp64(const BgcVector3FP64* vector, BgcVector3FP64* opposite);
extern inline void bgc_fp32_vector3_get_reverse(const BGC_FP32_Vector3* vector, BGC_FP32_Vector3* reverse);
extern inline void bgc_fp64_vector3_get_reverse(const BGC_FP64_Vector3* vector, BGC_FP64_Vector3* reverse);
extern inline int bgc_vector3_normalize_fp32(BgcVector3FP32* vector);
extern inline int bgc_vector3_normalize_fp64(BgcVector3FP64* vector);
extern inline int bgc_fp32_vector3_normalize(BGC_FP32_Vector3* vector);
extern inline int bgc_fp64_vector3_normalize(BGC_FP64_Vector3* vector);
extern inline int bgc_vector3_get_normalized_fp32(const BgcVector3FP32* vector, BgcVector3FP32* normalized);
extern inline int bgc_vector3_get_normalized_fp64(const BgcVector3FP64* vector, BgcVector3FP64* normalized);
extern inline int bgc_fp32_vector3_get_normalized(const BGC_FP32_Vector3* vector, BGC_FP32_Vector3* normalized);
extern inline int bgc_fp64_vector3_get_normalized(const BGC_FP64_Vector3* vector, BGC_FP64_Vector3* normalized);
extern inline float bgc_vector3_get_scalar_product_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2);
extern inline double bgc_vector3_get_scalar_product_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2);
extern inline float bgc_fp32_vector3_get_dot_product(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2);
extern inline double bgc_fp64_vector3_get_dot_product(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2);
extern inline float bgc_vector3_get_triple_product_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, const BgcVector3FP32* vector3);
extern inline double bgc_vector3_get_triple_product_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, const BgcVector3FP64* vector3);
extern inline float bgc_fp32_vector3_get_triple_product(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, const BGC_FP32_Vector3* vector3);
extern inline double bgc_fp64_vector3_get_triple_product(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, const BGC_FP64_Vector3* vector3);
extern inline void bgc_vector3_get_cross_product_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, BgcVector3FP32* result);
extern inline void bgc_vector3_get_cross_product_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, BgcVector3FP64* result);
extern inline void bgc_fp32_vector3_get_cross_product(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, BGC_FP32_Vector3* result);
extern inline void bgc_fp64_vector3_get_cross_product(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, BGC_FP64_Vector3* result);
extern inline void bgc_vector3_get_double_cross_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, const BgcVector3FP32* vector3, BgcVector3FP32* result);
extern inline void bgc_vector3_get_double_cross_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, const BgcVector3FP64* vector3, BgcVector3FP64* result);
extern inline void bgc_fp32_vector3_get_double_cross(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, const BGC_FP32_Vector3* vector3, BGC_FP32_Vector3* result);
extern inline void bgc_fp64_vector3_get_double_cross(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, const BGC_FP64_Vector3* vector3, BGC_FP64_Vector3* result);
extern inline float bgc_vector3_get_square_distance_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2);
extern inline double bgc_vector3_get_square_distance_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2);
extern inline float bgc_fp32_vector3_get_square_distance(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2);
extern inline double bgc_fp64_vector3_get_square_distance(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2);
extern inline float bgc_vector3_get_distance_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2);
extern inline double bgc_vector3_get_distance_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2);
extern inline float bgc_fp32_vector3_get_distance(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2);
extern inline double bgc_fp64_vector3_get_distance(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2);
extern inline int bgc_vector3_are_close_enough_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, const float distance);
extern inline int bgc_vector3_are_close_enough_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, const double distance);
extern inline int bgc_fp32_vector3_are_close_enough(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, const float distance);
extern inline int bgc_fp64_vector3_are_close_enough(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, const double distance);
extern inline int bgc_vector3_are_close_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2);
extern inline int bgc_vector3_are_close_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2);
extern inline int bgc_fp32_vector3_are_close(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2);
extern inline int bgc_fp64_vector3_are_close(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2);
extern inline int bgc_vector3_are_parallel_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2);
extern inline int bgc_vector3_are_parallel_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2);
extern inline int bgc_fp32_vector3_are_parallel(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2);
extern inline int bgc_fp64_vector3_are_parallel(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2);
extern inline int bgc_vector3_are_orthogonal_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2);
extern inline int bgc_vector3_are_orthogonal_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2);
extern inline int bgc_fp32_vector3_are_orthogonal(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2);
extern inline int bgc_fp64_vector3_are_orthogonal(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2);
extern inline int bgc_vector3_get_attitude_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2);
extern inline int bgc_vector3_get_attitude_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2);
extern inline int bgc_fp32_vector3_get_attitude(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2);
extern inline int bgc_fp64_vector3_get_attitude(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2);
// =================== Angle ==================== //
float bgc_vector3_get_angle_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, const BgcAngleUnitEnum angle_unit)
float bgc_fp32_vector3_get_angle(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, const int angle_unit)
{
const float square_modulus1 = bgc_vector3_get_square_modulus_fp32(vector1);
const float square_modulus1 = bgc_fp32_vector3_get_square_modulus(vector1);
// square_modulus1 != square_modulus1 is check for NaN value at square_modulus1
if (square_modulus1 <= BGC_SQUARE_EPSYLON_FP32 || square_modulus1 != square_modulus1) {
if (square_modulus1 <= BGC_FP32_SQUARE_EPSYLON || square_modulus1 != square_modulus1) {
return 0.0f;
}
const float square_modulus2 = bgc_vector3_get_square_modulus_fp32(vector2);
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
// square_modulus2 != square_modulus2 is check for NaN value at square_modulus2
if (square_modulus2 <= BGC_SQUARE_EPSYLON_FP32 || square_modulus2 != square_modulus2) {
if (square_modulus2 <= BGC_FP32_SQUARE_EPSYLON || square_modulus2 != square_modulus2) {
return 0.0f;
}
BgcVector3FP32 cross_product;
BGC_FP32_Vector3 cross_product;
bgc_vector3_get_cross_product_fp32(vector1, vector2, &cross_product);
bgc_fp32_vector3_get_cross_product(vector1, vector2, &cross_product);
const float scalar = bgc_vector3_get_scalar_product_fp32(vector1, vector2);
const float scalar = bgc_fp32_vector3_get_dot_product(vector1, vector2);
const float cross = bgc_vector3_get_modulus_fp32(&cross_product);
const float cross = bgc_fp32_vector3_get_modulus(&cross_product);
return bgc_radians_to_units_fp32(atan2f(cross, scalar), angle_unit);
return bgc_fp32_radians_to_units(atan2f(cross, scalar), angle_unit);
}
double bgc_vector3_get_angle_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, const BgcAngleUnitEnum angle_unit)
double bgc_fp64_vector3_get_angle(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, const int angle_unit)
{
const double square_modulus1 = bgc_vector3_get_square_modulus_fp64(vector1);
const double square_modulus1 = bgc_fp64_vector3_get_square_modulus(vector1);
// square_modulus1 != square_modulus1 is check for NaN value at square_modulus1
if (square_modulus1 <= BGC_SQUARE_EPSYLON_FP64 || square_modulus1 != square_modulus1) {
if (square_modulus1 <= BGC_FP64_SQUARE_EPSYLON || square_modulus1 != square_modulus1) {
return 0.0;
}
const double square_modulus2 = bgc_vector3_get_square_modulus_fp64(vector2);
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
// square_modulus2 != square_modulus2 is check for NaN value at square_modulus2
if (square_modulus2 <= BGC_SQUARE_EPSYLON_FP64 || square_modulus2 != square_modulus2) {
if (square_modulus2 <= BGC_FP64_SQUARE_EPSYLON || square_modulus2 != square_modulus2) {
return 0.0;
}
BgcVector3FP64 cross_product;
BGC_FP64_Vector3 cross_product;
bgc_vector3_get_cross_product_fp64(vector1, vector2, &cross_product);
bgc_fp64_vector3_get_cross_product(vector1, vector2, &cross_product);
const double scalar = bgc_vector3_get_scalar_product_fp64(vector1, vector2);
const double scalar = bgc_fp64_vector3_get_dot_product(vector1, vector2);
const double cross = bgc_vector3_get_modulus_fp64(&cross_product);
const double cross = bgc_fp64_vector3_get_modulus(&cross_product);
return bgc_radians_to_units_fp64(atan2(cross, scalar), angle_unit);
return bgc_fp64_radians_to_units(atan2(cross, scalar), angle_unit);
}