Переход на версию 0.3: изменение подхода к именованию сущностей, добавление, изменение и удаление ряда функций
This commit is contained in:
parent
d33daf4e2d
commit
f7e41645fe
87 changed files with 4580 additions and 4051 deletions
|
|
@ -1,84 +1,87 @@
|
|||
#include "matrix3x3.h"
|
||||
|
||||
extern inline void bgc_matrix3x3_reset_fp32(BgcMatrix3x3FP32* matrix);
|
||||
extern inline void bgc_matrix3x3_reset_fp64(BgcMatrix3x3FP64* matrix);
|
||||
extern inline void bgc_fp32_matrix3x3_reset(BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline void bgc_fp64_matrix3x3_reset(BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline void bgc_matrix3x3_set_to_identity_fp32(BgcMatrix3x3FP32* matrix);
|
||||
extern inline void bgc_matrix3x3_set_to_identity_fp64(BgcMatrix3x3FP64* matrix);
|
||||
extern inline void bgc_fp32_matrix3x3_make_identity(BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline void bgc_fp64_matrix3x3_make_identity(BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline void bgc_matrix3x3_set_to_diagonal_fp32(const float d1, const float d2, const float d3, BgcMatrix3x3FP32* matrix);
|
||||
extern inline void bgc_matrix3x3_set_to_diagonal_fp64(const double d1, const double d2, const double d3, BgcMatrix3x3FP64* matrix);
|
||||
extern inline void bgc_fp32_matrix3x3_make_diagonal(const float d1, const float d2, const float d3, BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline void bgc_fp64_matrix3x3_make_diagonal(const double d1, const double d2, const double d3, BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline void bgc_matrix3x3_copy_fp32(const BgcMatrix3x3FP32* source, BgcMatrix3x3FP32* destination);
|
||||
extern inline void bgc_matrix3x3_copy_fp64(const BgcMatrix3x3FP64* source, BgcMatrix3x3FP64* destination);
|
||||
extern inline void bgc_fp32_matrix3x3_copy(const BGC_FP32_Matrix3x3* source, BGC_FP32_Matrix3x3* destination);
|
||||
extern inline void bgc_fp64_matrix3x3_copy(const BGC_FP64_Matrix3x3* source, BGC_FP64_Matrix3x3* destination);
|
||||
|
||||
extern inline void bgc_matrix3x3_swap_fp32(BgcMatrix3x3FP32* matrix1, BgcMatrix3x3FP32* matrix2);
|
||||
extern inline void bgc_matrix3x3_swap_fp64(BgcMatrix3x3FP64* matrix1, BgcMatrix3x3FP64* matrix2);
|
||||
extern inline void bgc_fp32_matrix3x3_swap(BGC_FP32_Matrix3x3* matrix1, BGC_FP32_Matrix3x3* matrix2);
|
||||
extern inline void bgc_fp64_matrix3x3_swap(BGC_FP64_Matrix3x3* matrix1, BGC_FP64_Matrix3x3* matrix2);
|
||||
|
||||
extern inline void bgc_matrix3x3_convert_fp64_to_fp32(const BgcMatrix3x3FP64* source, BgcMatrix3x3FP32* destination);
|
||||
extern inline void bgc_matrix3x3_convert_fp32_to_fp64(const BgcMatrix3x3FP32* source, BgcMatrix3x3FP64* destination);
|
||||
extern inline void bgc_fp64_matrix3x3_convert_to_fp32(const BGC_FP64_Matrix3x3* source, BGC_FP32_Matrix3x3* destination);
|
||||
extern inline void bgc_fp32_matrix3x3_convert_to_fp64(const BGC_FP32_Matrix3x3* source, BGC_FP64_Matrix3x3* destination);
|
||||
|
||||
extern inline float bgc_matrix3x3_get_determinant_fp32(const BgcMatrix3x3FP32* matrix);
|
||||
extern inline double bgc_matrix3x3_get_determinant_fp64(const BgcMatrix3x3FP64* matrix);
|
||||
extern inline float bgc_fp32_matrix3x3_get_determinant(const BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline double bgc_fp64_matrix3x3_get_determinant(const BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline int bgc_matrix3x3_is_singular_fp32(const BgcMatrix3x3FP32* matrix);
|
||||
extern inline int bgc_matrix3x3_is_singular_fp64(const BgcMatrix3x3FP64* matrix);
|
||||
extern inline int bgc_fp32_matrix3x3_is_identity(const BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline int bgc_fp64_matrix3x3_is_identity(const BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline int bgc_matrix3x3_is_rotation_fp32(const BgcMatrix3x3FP32* matrix);
|
||||
extern inline int bgc_matrix3x3_is_rotation_fp64(const BgcMatrix3x3FP64* matrix);
|
||||
extern inline int bgc_fp32_matrix3x3_is_singular(const BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline int bgc_fp64_matrix3x3_is_singular(const BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline void bgc_matrix3x3_transpose_fp32(const BgcMatrix3x3FP32* matrix, BgcMatrix3x3FP32* transposed);
|
||||
extern inline void bgc_matrix3x3_transpose_fp64(const BgcMatrix3x3FP64* matrix, BgcMatrix3x3FP64* transposed);
|
||||
extern inline int bgc_fp32_matrix3x3_is_rotation(const BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline int bgc_fp64_matrix3x3_is_rotation(const BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline void bgc_matrix3x3_set_row1_fp32(const float c1, const float c2, const float c3, BgcMatrix3x3FP32* matrix);
|
||||
extern inline void bgc_matrix3x3_set_row1_fp64(const double c1, const double c2, const double c3, BgcMatrix3x3FP64* matrix);
|
||||
extern inline int bgc_fp32_matrix3x3_invert(BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline int bgc_fp64_matrix3x3_invert(BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline void bgc_matrix3x3_set_row2_fp32(const float c1, const float c2, const float c3, BgcMatrix3x3FP32* matrix);
|
||||
extern inline void bgc_matrix3x3_set_row2_fp64(const double c1, const double c2, const double c3, BgcMatrix3x3FP64* matrix);
|
||||
extern inline void bgc_fp32_matrix3x3_transpose(BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline void bgc_fp64_matrix3x3_transpose(BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline void bgc_matrix3x3_set_row3_fp32(const float c1, const float c2, const float c3, BgcMatrix3x3FP32* matrix);
|
||||
extern inline void bgc_matrix3x3_set_row3_fp64(const double c1, const double c2, const double c3, BgcMatrix3x3FP64* matrix);
|
||||
extern inline void bgc_fp32_matrix3x3_get_transposed(const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Matrix3x3* transposed);
|
||||
extern inline void bgc_fp64_matrix3x3_get_transposed(const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Matrix3x3* transposed);
|
||||
|
||||
extern inline void bgc_matrix3x3_set_column1_fp32(const float r1, const float r2, const float r3, BgcMatrix3x3FP32* matrix);
|
||||
extern inline void bgc_matrix3x3_set_column1_fp64(const double r1, const double r2, const double r3, BgcMatrix3x3FP64* matrix);
|
||||
extern inline void bgc_fp32_matrix3x3_get_row(const int number, const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Vector3* row);
|
||||
extern inline void bgc_fp64_matrix3x3_get_row(const int number, const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Vector3* row);
|
||||
|
||||
extern inline void bgc_matrix3x3_set_column2_fp32(const float r1, const float r2, const float r3, BgcMatrix3x3FP32* matrix);
|
||||
extern inline void bgc_matrix3x3_set_column2_fp64(const double r1, const double r2, const double r3, BgcMatrix3x3FP64* matrix);
|
||||
extern inline void bgc_fp32_matrix3x3_set_row(const int number, const BGC_FP32_Vector3* row, BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline void bgc_fp64_matrix3x3_set_row(const int number, const BGC_FP64_Vector3* row, BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline void bgc_matrix3x3_set_column3_fp32(const float r1, const float r2, const float r3, BgcMatrix3x3FP32* matrix);
|
||||
extern inline void bgc_matrix3x3_set_column3_fp64(const double r1, const double r2, const double r3, BgcMatrix3x3FP64* matrix);
|
||||
extern inline void bgc_fp32_matrix3x3_get_column(const int number, const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Vector3* column);
|
||||
extern inline void bgc_fp64_matrix3x3_get_column(const int number, const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Vector3* column);
|
||||
|
||||
extern inline void bgc_matrix3x3_add_fp32(const BgcMatrix3x3FP32* matrix1, const BgcMatrix3x3FP32* matrix2, BgcMatrix3x3FP32* sum);
|
||||
extern inline void bgc_matrix3x3_add_fp64(const BgcMatrix3x3FP64* matrix1, const BgcMatrix3x3FP64* matrix2, BgcMatrix3x3FP64* sum);
|
||||
extern inline void bgc_fp32_matrix3x3_set_column(const int number, const BGC_FP32_Vector3* column, BGC_FP32_Matrix3x3* matrix);
|
||||
extern inline void bgc_fp64_matrix3x3_set_column(const int number, const BGC_FP64_Vector3* column, BGC_FP64_Matrix3x3* matrix);
|
||||
|
||||
extern inline void bgc_matrix3x3_add_scaled_fp32(const BgcMatrix3x3FP32* basic_matrix, const BgcMatrix3x3FP32* scalable_matrix, const float scale, BgcMatrix3x3FP32* sum);
|
||||
extern inline void bgc_matrix3x3_add_scaled_fp64(const BgcMatrix3x3FP64* basic_matrix, const BgcMatrix3x3FP64* scalable_matrix, const double scale, BgcMatrix3x3FP64* sum);
|
||||
extern inline void bgc_fp32_matrix3x3_add(const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix3x3* matrix2, BGC_FP32_Matrix3x3* sum);
|
||||
extern inline void bgc_fp64_matrix3x3_add(const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix3x3* matrix2, BGC_FP64_Matrix3x3* sum);
|
||||
|
||||
extern inline void bgc_matrix3x3_subtract_fp32(const BgcMatrix3x3FP32* minuend, const BgcMatrix3x3FP32* subtrahend, BgcMatrix3x3FP32* difference);
|
||||
extern inline void bgc_matrix3x3_subtract_fp64(const BgcMatrix3x3FP64* minuend, const BgcMatrix3x3FP64* subtrahend, BgcMatrix3x3FP64* difference);
|
||||
extern inline void bgc_fp32_matrix3x3_add_scaled(const BGC_FP32_Matrix3x3* basic_matrix, const BGC_FP32_Matrix3x3* scalable_matrix, const float scale, BGC_FP32_Matrix3x3* sum);
|
||||
extern inline void bgc_fp64_matrix3x3_add_scaled(const BGC_FP64_Matrix3x3* basic_matrix, const BGC_FP64_Matrix3x3* scalable_matrix, const double scale, BGC_FP64_Matrix3x3* sum);
|
||||
|
||||
extern inline void bgc_matrix3x3_subtract_scaled_fp32(const BgcMatrix3x3FP32* basic_matrix, const BgcMatrix3x3FP32* scalable_matrix, const float scale, BgcMatrix3x3FP32* difference);
|
||||
extern inline void bgc_matrix3x3_subtract_scaled_fp64(const BgcMatrix3x3FP64* basic_matrix, const BgcMatrix3x3FP64* scalable_matrix, const double scale, BgcMatrix3x3FP64* difference);
|
||||
extern inline void bgc_fp32_matrix3x3_subtract(const BGC_FP32_Matrix3x3* minuend, const BGC_FP32_Matrix3x3* subtrahend, BGC_FP32_Matrix3x3* difference);
|
||||
extern inline void bgc_fp64_matrix3x3_subtract(const BGC_FP64_Matrix3x3* minuend, const BGC_FP64_Matrix3x3* subtrahend, BGC_FP64_Matrix3x3* difference);
|
||||
|
||||
extern inline void bgc_matrix3x3_multiply_fp32(const BgcMatrix3x3FP32* multiplicand, const float multiplier, BgcMatrix3x3FP32* product);
|
||||
extern inline void bgc_matrix3x3_multiply_fp64(const BgcMatrix3x3FP64* multiplicand, const double multiplier, BgcMatrix3x3FP64* product);
|
||||
extern inline void bgc_fp32_matrix3x3_multiply(const BGC_FP32_Matrix3x3* multiplicand, const float multiplier, BGC_FP32_Matrix3x3* product);
|
||||
extern inline void bgc_fp64_matrix3x3_multiply(const BGC_FP64_Matrix3x3* multiplicand, const double multiplier, BGC_FP64_Matrix3x3* product);
|
||||
|
||||
extern inline void bgc_matrix3x3_divide_fp32(const BgcMatrix3x3FP32* dividend, const float divisor, BgcMatrix3x3FP32* quotient);
|
||||
extern inline void bgc_matrix3x3_divide_fp64(const BgcMatrix3x3FP64* dividend, const double divisor, BgcMatrix3x3FP64* quotient);
|
||||
extern inline void bgc_fp32_matrix3x3_divide(const BGC_FP32_Matrix3x3* dividend, const float divisor, BGC_FP32_Matrix3x3* quotient);
|
||||
extern inline void bgc_fp64_matrix3x3_divide(const BGC_FP64_Matrix3x3* dividend, const double divisor, BGC_FP64_Matrix3x3* quotient);
|
||||
|
||||
extern inline void bgc_matrix3x3_get_left_product_fp32(const BgcVector3FP32* vector, const BgcMatrix3x3FP32* matrix, BgcVector3FP32* result);
|
||||
extern inline void bgc_matrix3x3_get_left_product_fp64(const BgcVector3FP64* vector, const BgcMatrix3x3FP64* matrix, BgcVector3FP64* result);
|
||||
extern inline void bgc_fp32_matrix3x3_interpolate(const BGC_FP32_Matrix3x3* first, const BGC_FP32_Matrix3x3* second, const float phase, BGC_FP32_Matrix3x3* interpolation);
|
||||
extern inline void bgc_fp64_matrix3x3_interpolate(const BGC_FP64_Matrix3x3* first, const BGC_FP64_Matrix3x3* second, const double phase, BGC_FP64_Matrix3x3* interpolation);
|
||||
|
||||
extern inline void bgc_matrix3x3_get_right_product_fp32(const BgcMatrix3x3FP32* matrix, const BgcVector3FP32* vector, BgcVector3FP32* result);
|
||||
extern inline void bgc_matrix3x3_get_right_product_fp64(const BgcMatrix3x3FP64* matrix, const BgcVector3FP64* vector, BgcVector3FP64* result);
|
||||
extern inline void bgc_fp32_multiply_vector3_by_matrix3x3(const BGC_FP32_Vector3* vector, const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Vector3* result);
|
||||
extern inline void bgc_fp64_multiply_vector3_by_matrix3x3(const BGC_FP64_Vector3* vector, const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Vector3* result);
|
||||
|
||||
// =================== Invert =================== //
|
||||
extern inline void bgc_fp32_multiply_matrix3x3_by_vector3(const BGC_FP32_Matrix3x3* matrix, const BGC_FP32_Vector3* vector, BGC_FP32_Vector3* result);
|
||||
extern inline void bgc_fp64_multiply_matrix3x3_by_vector3(const BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Vector3* vector, BGC_FP64_Vector3* result);
|
||||
|
||||
int bgc_matrix3x3_invert_fp32(const BgcMatrix3x3FP32* matrix, BgcMatrix3x3FP32* inverted)
|
||||
// ================ Get Inverse ================= //
|
||||
|
||||
int bgc_fp32_matrix3x3_get_inverse(const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Matrix3x3* inverse)
|
||||
{
|
||||
const float determinant = bgc_matrix3x3_get_determinant_fp32(matrix);
|
||||
const float determinant = bgc_fp32_matrix3x3_get_determinant(matrix);
|
||||
|
||||
if (bgc_is_zero_fp32(determinant)) {
|
||||
if (bgc_fp32_is_zero(determinant)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -96,26 +99,26 @@ int bgc_matrix3x3_invert_fp32(const BgcMatrix3x3FP32* matrix, BgcMatrix3x3FP32*
|
|||
|
||||
const float multiplier = 1.0f / determinant;
|
||||
|
||||
inverted->r1c1 = r1c1 * multiplier;
|
||||
inverted->r1c2 = r1c2 * multiplier;
|
||||
inverted->r1c3 = r1c3 * multiplier;
|
||||
inverse->r1c1 = r1c1 * multiplier;
|
||||
inverse->r1c2 = r1c2 * multiplier;
|
||||
inverse->r1c3 = r1c3 * multiplier;
|
||||
|
||||
inverted->r2c1 = r2c1 * multiplier;
|
||||
inverted->r2c2 = r2c2 * multiplier;
|
||||
inverted->r2c3 = r2c3 * multiplier;
|
||||
inverse->r2c1 = r2c1 * multiplier;
|
||||
inverse->r2c2 = r2c2 * multiplier;
|
||||
inverse->r2c3 = r2c3 * multiplier;
|
||||
|
||||
inverted->r3c1 = r3c1 * multiplier;
|
||||
inverted->r3c2 = r3c2 * multiplier;
|
||||
inverted->r3c3 = r3c3 * multiplier;
|
||||
inverse->r3c1 = r3c1 * multiplier;
|
||||
inverse->r3c2 = r3c2 * multiplier;
|
||||
inverse->r3c3 = r3c3 * multiplier;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bgc_matrix3x3_invert_fp64(const BgcMatrix3x3FP64* matrix, BgcMatrix3x3FP64* inverted)
|
||||
int bgc_fp64_matrix3x3_get_inverse(const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Matrix3x3* inverse)
|
||||
{
|
||||
const double determinant = bgc_matrix3x3_get_determinant_fp64(matrix);
|
||||
const double determinant = bgc_fp64_matrix3x3_get_determinant(matrix);
|
||||
|
||||
if (bgc_is_zero_fp64(determinant)) {
|
||||
if (bgc_fp64_is_zero(determinant)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -133,17 +136,17 @@ int bgc_matrix3x3_invert_fp64(const BgcMatrix3x3FP64* matrix, BgcMatrix3x3FP64*
|
|||
|
||||
const double multiplier = 1.0 / determinant;
|
||||
|
||||
inverted->r1c1 = r1c1 * multiplier;
|
||||
inverted->r1c2 = r1c2 * multiplier;
|
||||
inverted->r1c3 = r1c3 * multiplier;
|
||||
inverse->r1c1 = r1c1 * multiplier;
|
||||
inverse->r1c2 = r1c2 * multiplier;
|
||||
inverse->r1c3 = r1c3 * multiplier;
|
||||
|
||||
inverted->r2c1 = r2c1 * multiplier;
|
||||
inverted->r2c2 = r2c2 * multiplier;
|
||||
inverted->r2c3 = r2c3 * multiplier;
|
||||
inverse->r2c1 = r2c1 * multiplier;
|
||||
inverse->r2c2 = r2c2 * multiplier;
|
||||
inverse->r2c3 = r2c3 * multiplier;
|
||||
|
||||
inverted->r3c1 = r3c1 * multiplier;
|
||||
inverted->r3c2 = r3c2 * multiplier;
|
||||
inverted->r3c3 = r3c3 * multiplier;
|
||||
inverse->r3c1 = r3c1 * multiplier;
|
||||
inverse->r3c2 = r3c2 * multiplier;
|
||||
inverse->r3c3 = r3c3 * multiplier;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue