Добавление квалификатора const для запрета изменения указаелей внутри функций

This commit is contained in:
Andrey Pokidov 2026-03-24 00:33:17 +07:00
parent 610756ffed
commit e6ac9023ec
24 changed files with 951 additions and 951 deletions

View file

@ -8,7 +8,7 @@
// =================== Reset ==================== //
inline void bgc_fp32_matrix3x3_reset(BGC_FP32_Matrix3x3* matrix)
inline void bgc_fp32_matrix3x3_reset(BGC_FP32_Matrix3x3* const matrix)
{
matrix->r1c1 = 0.0f;
matrix->r1c2 = 0.0f;
@ -23,7 +23,7 @@ inline void bgc_fp32_matrix3x3_reset(BGC_FP32_Matrix3x3* matrix)
matrix->r3c3 = 0.0f;
}
inline void bgc_fp64_matrix3x3_reset(BGC_FP64_Matrix3x3* matrix)
inline void bgc_fp64_matrix3x3_reset(BGC_FP64_Matrix3x3* const matrix)
{
matrix->r1c1 = 0.0;
matrix->r1c2 = 0.0;
@ -40,7 +40,7 @@ inline void bgc_fp64_matrix3x3_reset(BGC_FP64_Matrix3x3* matrix)
// ================== Identity ================== //
inline void bgc_fp32_matrix3x3_make_identity(BGC_FP32_Matrix3x3* matrix)
inline void bgc_fp32_matrix3x3_make_identity(BGC_FP32_Matrix3x3* const matrix)
{
matrix->r1c1 = 1.0f;
matrix->r1c2 = 0.0f;
@ -55,7 +55,7 @@ inline void bgc_fp32_matrix3x3_make_identity(BGC_FP32_Matrix3x3* matrix)
matrix->r3c3 = 1.0f;
}
inline void bgc_fp64_matrix3x3_make_identity(BGC_FP64_Matrix3x3* matrix)
inline void bgc_fp64_matrix3x3_make_identity(BGC_FP64_Matrix3x3* const matrix)
{
matrix->r1c1 = 1.0;
matrix->r1c2 = 0.0;
@ -72,7 +72,7 @@ inline void bgc_fp64_matrix3x3_make_identity(BGC_FP64_Matrix3x3* matrix)
// ================ Set Diagonal ================ //
inline void bgc_fp32_matrix3x3_make_diagonal(BGC_FP32_Matrix3x3* matrix, const float d1, const float d2, const float d3)
inline void bgc_fp32_matrix3x3_make_diagonal(BGC_FP32_Matrix3x3* const matrix, const float d1, const float d2, const float d3)
{
matrix->r1c1 = d1;
matrix->r1c2 = 0.0f;
@ -87,7 +87,7 @@ inline void bgc_fp32_matrix3x3_make_diagonal(BGC_FP32_Matrix3x3* matrix, const f
matrix->r3c3 = d2;
}
inline void bgc_fp64_matrix3x3_make_diagonal(BGC_FP64_Matrix3x3* matrix, const double d1, const double d2, const double d3)
inline void bgc_fp64_matrix3x3_make_diagonal(BGC_FP64_Matrix3x3* const matrix, const double d1, const double d2, const double d3)
{
matrix->r1c1 = d1;
matrix->r1c2 = 0.0;
@ -104,7 +104,7 @@ inline void bgc_fp64_matrix3x3_make_diagonal(BGC_FP64_Matrix3x3* matrix, const d
// ==================== Copy ==================== //
inline void bgc_fp32_matrix3x3_copy(BGC_FP32_Matrix3x3* destination, const BGC_FP32_Matrix3x3* source)
inline void bgc_fp32_matrix3x3_copy(BGC_FP32_Matrix3x3* const destination, const BGC_FP32_Matrix3x3* const source)
{
destination->r1c1 = source->r1c1;
destination->r1c2 = source->r1c2;
@ -119,7 +119,7 @@ inline void bgc_fp32_matrix3x3_copy(BGC_FP32_Matrix3x3* destination, const BGC_F
destination->r3c3 = source->r3c3;
}
inline void bgc_fp64_matrix3x3_copy(BGC_FP64_Matrix3x3* destination, const BGC_FP64_Matrix3x3* source)
inline void bgc_fp64_matrix3x3_copy(BGC_FP64_Matrix3x3* const destination, const BGC_FP64_Matrix3x3* const source)
{
destination->r1c1 = source->r1c1;
destination->r1c2 = source->r1c2;
@ -136,7 +136,7 @@ inline void bgc_fp64_matrix3x3_copy(BGC_FP64_Matrix3x3* destination, const BGC_F
// ==================== Swap ==================== //
inline void bgc_fp32_matrix3x3_swap(BGC_FP32_Matrix3x3* matrix1, BGC_FP32_Matrix3x3* matrix2)
inline void bgc_fp32_matrix3x3_swap(BGC_FP32_Matrix3x3* const matrix1, BGC_FP32_Matrix3x3* const matrix2)
{
const float r1c1 = matrix2->r1c1;
const float r1c2 = matrix2->r1c2;
@ -175,7 +175,7 @@ inline void bgc_fp32_matrix3x3_swap(BGC_FP32_Matrix3x3* matrix1, BGC_FP32_Matrix
matrix1->r3c3 = r3c3;
}
inline void bgc_fp64_matrix3x3_swap(BGC_FP64_Matrix3x3* matrix1, BGC_FP64_Matrix3x3* matrix2)
inline void bgc_fp64_matrix3x3_swap(BGC_FP64_Matrix3x3* const matrix1, BGC_FP64_Matrix3x3* const matrix2)
{
const double r1c1 = matrix2->r1c1;
const double r1c2 = matrix2->r1c2;
@ -216,7 +216,7 @@ inline void bgc_fp64_matrix3x3_swap(BGC_FP64_Matrix3x3* matrix1, BGC_FP64_Matrix
// ================== Convert =================== //
inline void bgc_fp64_matrix3x3_convert_to_fp32(BGC_FP32_Matrix3x3* destination, const BGC_FP64_Matrix3x3* source)
inline void bgc_fp64_matrix3x3_convert_to_fp32(BGC_FP32_Matrix3x3* const destination, const BGC_FP64_Matrix3x3* const source)
{
destination->r1c1 = (float)source->r1c1;
destination->r1c2 = (float)source->r1c2;
@ -231,7 +231,7 @@ inline void bgc_fp64_matrix3x3_convert_to_fp32(BGC_FP32_Matrix3x3* destination,
destination->r3c3 = (float)source->r3c3;
}
inline void bgc_fp32_matrix3x3_convert_to_fp64(BGC_FP64_Matrix3x3* destination, const BGC_FP32_Matrix3x3* source)
inline void bgc_fp32_matrix3x3_convert_to_fp64(BGC_FP64_Matrix3x3* const destination, const BGC_FP32_Matrix3x3* const source)
{
destination->r1c1 = source->r1c1;
destination->r1c2 = source->r1c2;
@ -248,14 +248,14 @@ inline void bgc_fp32_matrix3x3_convert_to_fp64(BGC_FP64_Matrix3x3* destination,
// ================ Determinant ================= //
inline float bgc_fp32_matrix3x3_get_determinant(const BGC_FP32_Matrix3x3* matrix)
inline float bgc_fp32_matrix3x3_get_determinant(const BGC_FP32_Matrix3x3* const matrix)
{
return matrix->r1c1 * (matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2)
+ matrix->r1c2 * (matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3)
+ matrix->r1c3 * (matrix->r2c1 * matrix->r3c2 - matrix->r2c2 * matrix->r3c1);
}
inline double bgc_fp64_matrix3x3_get_determinant(const BGC_FP64_Matrix3x3* matrix)
inline double bgc_fp64_matrix3x3_get_determinant(const BGC_FP64_Matrix3x3* const matrix)
{
return matrix->r1c1 * (matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2)
+ matrix->r1c2 * (matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3)
@ -264,14 +264,14 @@ inline double bgc_fp64_matrix3x3_get_determinant(const BGC_FP64_Matrix3x3* matri
// ================ Is Identity ================= //
inline int bgc_fp32_matrix3x3_is_identity(const BGC_FP32_Matrix3x3* matrix)
inline int bgc_fp32_matrix3x3_is_identity(const BGC_FP32_Matrix3x3* const matrix)
{
return bgc_fp32_is_unit(matrix->r1c1) && bgc_fp32_is_zero(matrix->r1c2) && bgc_fp32_is_zero(matrix->r1c3)
&& bgc_fp32_is_zero(matrix->r2c1) && bgc_fp32_is_unit(matrix->r2c2) && bgc_fp32_is_zero(matrix->r2c3)
&& bgc_fp32_is_zero(matrix->r3c1) && bgc_fp32_is_zero(matrix->r3c2) && bgc_fp32_is_unit(matrix->r3c3);
}
inline int bgc_fp64_matrix3x3_is_identity(const BGC_FP64_Matrix3x3* matrix)
inline int bgc_fp64_matrix3x3_is_identity(const BGC_FP64_Matrix3x3* const matrix)
{
return bgc_fp64_is_unit(matrix->r1c1) && bgc_fp64_is_zero(matrix->r1c2) && bgc_fp64_is_zero(matrix->r1c3)
&& bgc_fp64_is_zero(matrix->r2c1) && bgc_fp64_is_unit(matrix->r2c2) && bgc_fp64_is_zero(matrix->r2c3)
@ -280,19 +280,19 @@ inline int bgc_fp64_matrix3x3_is_identity(const BGC_FP64_Matrix3x3* matrix)
// ================ Is Singular ================= //
inline int bgc_fp32_matrix3x3_is_singular(const BGC_FP32_Matrix3x3* matrix)
inline int bgc_fp32_matrix3x3_is_singular(const BGC_FP32_Matrix3x3* const matrix)
{
return bgc_fp32_is_zero(bgc_fp32_matrix3x3_get_determinant(matrix));
}
inline int bgc_fp64_matrix3x3_is_singular(const BGC_FP64_Matrix3x3* matrix)
inline int bgc_fp64_matrix3x3_is_singular(const BGC_FP64_Matrix3x3* const matrix)
{
return bgc_fp64_is_zero(bgc_fp64_matrix3x3_get_determinant(matrix));
}
// ================ Is Rotation ================= //
inline int bgc_fp32_matrix3x3_is_rotation(const BGC_FP32_Matrix3x3* matrix)
inline int bgc_fp32_matrix3x3_is_rotation(const BGC_FP32_Matrix3x3* const matrix)
{
BGC_FP32_Matrix3x3 product;
@ -311,7 +311,7 @@ inline int bgc_fp32_matrix3x3_is_rotation(const BGC_FP32_Matrix3x3* matrix)
return bgc_fp32_matrix3x3_is_identity(&product);
}
inline int bgc_fp64_matrix3x3_is_rotation(const BGC_FP64_Matrix3x3* matrix)
inline int bgc_fp64_matrix3x3_is_rotation(const BGC_FP64_Matrix3x3* const matrix)
{
BGC_FP64_Matrix3x3 product;
@ -332,25 +332,25 @@ inline int bgc_fp64_matrix3x3_is_rotation(const BGC_FP64_Matrix3x3* matrix)
// ================ Get Inverse ================= //
int bgc_fp32_matrix3x3_get_inverse(BGC_FP32_Matrix3x3* inverse, const BGC_FP32_Matrix3x3* matrix);
int bgc_fp32_matrix3x3_get_inverse(BGC_FP32_Matrix3x3* const inverse, const BGC_FP32_Matrix3x3* const matrix);
int bgc_fp64_matrix3x3_get_inverse(BGC_FP64_Matrix3x3* inverse, const BGC_FP64_Matrix3x3* matrix);
int bgc_fp64_matrix3x3_get_inverse(BGC_FP64_Matrix3x3* const inverse, const BGC_FP64_Matrix3x3* const matrix);
// =================== Invert =================== //
inline int bgc_fp32_matrix3x3_invert(BGC_FP32_Matrix3x3* matrix)
inline int bgc_fp32_matrix3x3_invert(BGC_FP32_Matrix3x3* const matrix)
{
return bgc_fp32_matrix3x3_get_inverse(matrix, matrix);
}
inline int bgc_fp64_matrix3x3_invert(BGC_FP64_Matrix3x3* matrix)
inline int bgc_fp64_matrix3x3_invert(BGC_FP64_Matrix3x3* const matrix)
{
return bgc_fp64_matrix3x3_get_inverse(matrix, matrix);
}
// ================= Transpose ================== //
inline void bgc_fp32_matrix3x3_transpose(BGC_FP32_Matrix3x3* matrix)
inline void bgc_fp32_matrix3x3_transpose(BGC_FP32_Matrix3x3* const matrix)
{
const float r1c2 = matrix->r1c2;
const float r1c3 = matrix->r1c3;
@ -365,7 +365,7 @@ inline void bgc_fp32_matrix3x3_transpose(BGC_FP32_Matrix3x3* matrix)
matrix->r3c2 = r2c3;
}
inline void bgc_fp64_matrix3x3_transpose(BGC_FP64_Matrix3x3* matrix)
inline void bgc_fp64_matrix3x3_transpose(BGC_FP64_Matrix3x3* const matrix)
{
const double r1c2 = matrix->r1c2;
const double r1c3 = matrix->r1c3;
@ -382,7 +382,7 @@ inline void bgc_fp64_matrix3x3_transpose(BGC_FP64_Matrix3x3* matrix)
// =============== Get Transpose ================ //
inline void bgc_fp32_matrix3x3_get_transposed(BGC_FP32_Matrix3x3* transposed, const BGC_FP32_Matrix3x3* matrix)
inline void bgc_fp32_matrix3x3_get_transposed(BGC_FP32_Matrix3x3* const transposed, const BGC_FP32_Matrix3x3* const matrix)
{
transposed->r1c1 = matrix->r1c1;
transposed->r2c2 = matrix->r2c2;
@ -401,7 +401,7 @@ inline void bgc_fp32_matrix3x3_get_transposed(BGC_FP32_Matrix3x3* transposed, co
transposed->r3c2 = r2c3;
}
inline void bgc_fp64_matrix3x3_get_transposed(BGC_FP64_Matrix3x3* transposed, const BGC_FP64_Matrix3x3* matrix)
inline void bgc_fp64_matrix3x3_get_transposed(BGC_FP64_Matrix3x3* const transposed, const BGC_FP64_Matrix3x3* const matrix)
{
transposed->r1c1 = matrix->r1c1;
transposed->r2c2 = matrix->r2c2;
@ -422,7 +422,7 @@ inline void bgc_fp64_matrix3x3_get_transposed(BGC_FP64_Matrix3x3* transposed, co
// ================== Get Row -================== //
inline void bgc_fp32_matrix3x3_get_row(BGC_FP32_Vector3* row, const BGC_FP32_Matrix3x3* matrix, const int row_number)
inline void bgc_fp32_matrix3x3_get_row(BGC_FP32_Vector3* const row, const BGC_FP32_Matrix3x3* const matrix, const int row_number)
{
if (row_number == 1)
{
@ -453,7 +453,7 @@ inline void bgc_fp32_matrix3x3_get_row(BGC_FP32_Vector3* row, const BGC_FP32_Mat
row->x3 = 0.0f;
}
inline void bgc_fp64_matrix3x3_get_row(BGC_FP64_Vector3* row, const BGC_FP64_Matrix3x3* matrix, const int row_number)
inline void bgc_fp64_matrix3x3_get_row(BGC_FP64_Vector3* const row, const BGC_FP64_Matrix3x3* const matrix, const int row_number)
{
if (row_number == 1)
{
@ -486,7 +486,7 @@ inline void bgc_fp64_matrix3x3_get_row(BGC_FP64_Vector3* row, const BGC_FP64_Mat
// ================== Set Row =================== //
inline void bgc_fp32_matrix3x3_set_row(BGC_FP32_Matrix3x3* matrix, const int row_number, const BGC_FP32_Vector3* row)
inline void bgc_fp32_matrix3x3_set_row(BGC_FP32_Matrix3x3* const matrix, const int row_number, const BGC_FP32_Vector3* const row)
{
if (row_number == 1)
{
@ -512,7 +512,7 @@ inline void bgc_fp32_matrix3x3_set_row(BGC_FP32_Matrix3x3* matrix, const int row
}
}
inline void bgc_fp64_matrix3x3_set_row(BGC_FP64_Matrix3x3* matrix, const int row_number, const BGC_FP64_Vector3* row)
inline void bgc_fp64_matrix3x3_set_row(BGC_FP64_Matrix3x3* const matrix, const int row_number, const BGC_FP64_Vector3* const row)
{
if (row_number == 1)
{
@ -540,7 +540,7 @@ inline void bgc_fp64_matrix3x3_set_row(BGC_FP64_Matrix3x3* matrix, const int row
// ================= Get Column ================= //
inline void bgc_fp32_matrix3x3_get_column(BGC_FP32_Vector3* column, const BGC_FP32_Matrix3x3* matrix, const int column_number)
inline void bgc_fp32_matrix3x3_get_column(BGC_FP32_Vector3* const column, const BGC_FP32_Matrix3x3* const matrix, const int column_number)
{
if (column_number == 1)
{
@ -571,7 +571,7 @@ inline void bgc_fp32_matrix3x3_get_column(BGC_FP32_Vector3* column, const BGC_FP
column->x3 = 0.0f;
}
inline void bgc_fp64_matrix3x3_get_column(BGC_FP64_Vector3* column, const BGC_FP64_Matrix3x3* matrix, const int column_number)
inline void bgc_fp64_matrix3x3_get_column(BGC_FP64_Vector3* const column, const BGC_FP64_Matrix3x3* const matrix, const int column_number)
{
if (column_number == 1)
{
@ -604,7 +604,7 @@ inline void bgc_fp64_matrix3x3_get_column(BGC_FP64_Vector3* column, const BGC_FP
// ================= Set Column ================= //
inline void bgc_fp32_matrix3x3_set_column(BGC_FP32_Matrix3x3* matrix, const int column_number, const BGC_FP32_Vector3* column)
inline void bgc_fp32_matrix3x3_set_column(BGC_FP32_Matrix3x3* const matrix, const int column_number, const BGC_FP32_Vector3* const column)
{
if (column_number == 1)
{
@ -630,7 +630,7 @@ inline void bgc_fp32_matrix3x3_set_column(BGC_FP32_Matrix3x3* matrix, const int
}
}
inline void bgc_fp64_matrix3x3_set_column(BGC_FP64_Matrix3x3* matrix, const int column_number, const BGC_FP64_Vector3* column)
inline void bgc_fp64_matrix3x3_set_column(BGC_FP64_Matrix3x3* const matrix, const int column_number, const BGC_FP64_Vector3* const column)
{
if (column_number == 1)
{
@ -658,7 +658,7 @@ inline void bgc_fp64_matrix3x3_set_column(BGC_FP64_Matrix3x3* matrix, const int
// ==================== Add ===================== //
inline void bgc_fp32_matrix3x3_add(BGC_FP32_Matrix3x3* sum, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix3x3* matrix2)
inline void bgc_fp32_matrix3x3_add(BGC_FP32_Matrix3x3* const sum, const BGC_FP32_Matrix3x3* const matrix1, const BGC_FP32_Matrix3x3* const matrix2)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -673,7 +673,7 @@ inline void bgc_fp32_matrix3x3_add(BGC_FP32_Matrix3x3* sum, const BGC_FP32_Matri
sum->r3c3 = matrix1->r3c3 + matrix2->r3c3;
}
inline void bgc_fp64_matrix3x3_add(BGC_FP64_Matrix3x3* sum, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix3x3* matrix2)
inline void bgc_fp64_matrix3x3_add(BGC_FP64_Matrix3x3* const sum, const BGC_FP64_Matrix3x3* const matrix1, const BGC_FP64_Matrix3x3* const matrix2)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -690,7 +690,7 @@ inline void bgc_fp64_matrix3x3_add(BGC_FP64_Matrix3x3* sum, const BGC_FP64_Matri
// ================= Add Scaled ================= //
inline void bgc_fp32_matrix3x3_add_scaled(BGC_FP32_Matrix3x3* sum, const BGC_FP32_Matrix3x3* basic_matrix, const BGC_FP32_Matrix3x3* scalable_matrix, const float scale)
inline void bgc_fp32_matrix3x3_add_scaled(BGC_FP32_Matrix3x3* const sum, const BGC_FP32_Matrix3x3* const basic_matrix, const BGC_FP32_Matrix3x3* const scalable_matrix, const float scale)
{
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -705,7 +705,7 @@ inline void bgc_fp32_matrix3x3_add_scaled(BGC_FP32_Matrix3x3* sum, const BGC_FP3
sum->r3c3 = basic_matrix->r3c3 + scalable_matrix->r3c3 * scale;
}
inline void bgc_fp64_matrix3x3_add_scaled(BGC_FP64_Matrix3x3* sum, const BGC_FP64_Matrix3x3* basic_matrix, const BGC_FP64_Matrix3x3* scalable_matrix, const double scale)
inline void bgc_fp64_matrix3x3_add_scaled(BGC_FP64_Matrix3x3* const sum, const BGC_FP64_Matrix3x3* const basic_matrix, const BGC_FP64_Matrix3x3* const scalable_matrix, const double scale)
{
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -722,7 +722,7 @@ inline void bgc_fp64_matrix3x3_add_scaled(BGC_FP64_Matrix3x3* sum, const BGC_FP6
// ================== Subtract ================== //
inline void bgc_fp32_matrix3x3_subtract(BGC_FP32_Matrix3x3* difference, const BGC_FP32_Matrix3x3* minuend, const BGC_FP32_Matrix3x3* subtrahend)
inline void bgc_fp32_matrix3x3_subtract(BGC_FP32_Matrix3x3* const difference, const BGC_FP32_Matrix3x3* const minuend, const BGC_FP32_Matrix3x3* const subtrahend)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -737,7 +737,7 @@ inline void bgc_fp32_matrix3x3_subtract(BGC_FP32_Matrix3x3* difference, const BG
difference->r3c3 = minuend->r3c3 - subtrahend->r3c3;
}
inline void bgc_fp64_matrix3x3_subtract(BGC_FP64_Matrix3x3* difference, const BGC_FP64_Matrix3x3* minuend, const BGC_FP64_Matrix3x3* subtrahend)
inline void bgc_fp64_matrix3x3_subtract(BGC_FP64_Matrix3x3* const difference, const BGC_FP64_Matrix3x3* const minuend, const BGC_FP64_Matrix3x3* const subtrahend)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -754,7 +754,7 @@ inline void bgc_fp64_matrix3x3_subtract(BGC_FP64_Matrix3x3* difference, const BG
// ============== Subtract Scaled =============== //
inline void bgc_fp32_matrix3x3_subtract_scaled(BGC_FP32_Matrix3x3* difference, const BGC_FP32_Matrix3x3* basic_matrix, const BGC_FP32_Matrix3x3* scalable_matrix, const float scale)
inline void bgc_fp32_matrix3x3_subtract_scaled(BGC_FP32_Matrix3x3* const difference, const BGC_FP32_Matrix3x3* const basic_matrix, const BGC_FP32_Matrix3x3* const scalable_matrix, const float scale)
{
difference->r1c1 = basic_matrix->r1c1 - scalable_matrix->r1c1 * scale;
difference->r1c2 = basic_matrix->r1c2 - scalable_matrix->r1c2 * scale;
@ -769,7 +769,7 @@ inline void bgc_fp32_matrix3x3_subtract_scaled(BGC_FP32_Matrix3x3* difference, c
difference->r3c3 = basic_matrix->r3c3 - scalable_matrix->r3c3 * scale;
}
inline void bgc_fp64_matrix3x3_subtract_scaled(BGC_FP64_Matrix3x3* difference, const BGC_FP64_Matrix3x3* basic_matrix, const BGC_FP64_Matrix3x3* scalable_matrix, const double scale)
inline void bgc_fp64_matrix3x3_subtract_scaled(BGC_FP64_Matrix3x3* const difference, const BGC_FP64_Matrix3x3* const basic_matrix, const BGC_FP64_Matrix3x3* const scalable_matrix, const double scale)
{
difference->r1c1 = basic_matrix->r1c1 - scalable_matrix->r1c1 * scale;
difference->r1c2 = basic_matrix->r1c2 - scalable_matrix->r1c2 * scale;
@ -786,7 +786,7 @@ inline void bgc_fp64_matrix3x3_subtract_scaled(BGC_FP64_Matrix3x3* difference, c
// ================== Multiply ================== //
inline void bgc_fp32_matrix3x3_multiply_by_real(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix3x3* multiplicand, const float multiplier)
inline void bgc_fp32_matrix3x3_multiply_by_real(BGC_FP32_Matrix3x3* const product, const BGC_FP32_Matrix3x3* const multiplicand, const float multiplier)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
@ -801,7 +801,7 @@ inline void bgc_fp32_matrix3x3_multiply_by_real(BGC_FP32_Matrix3x3* product, con
product->r3c3 = multiplicand->r3c3 * multiplier;
}
inline void bgc_fp64_matrix3x3_multiply_by_real(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix3x3* multiplicand, const double multiplier)
inline void bgc_fp64_matrix3x3_multiply_by_real(BGC_FP64_Matrix3x3* const product, const BGC_FP64_Matrix3x3* const multiplicand, const double multiplier)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
@ -818,7 +818,7 @@ inline void bgc_fp64_matrix3x3_multiply_by_real(BGC_FP64_Matrix3x3* product, con
// ============ Right Vector Product ============ //
inline void bgc_fp32_matrix3x3_multiply_by_vector3(BGC_FP32_Vector3* product, const BGC_FP32_Matrix3x3* matrix, const BGC_FP32_Vector3* vector)
inline void bgc_fp32_matrix3x3_multiply_by_vector3(BGC_FP32_Vector3* const product, const BGC_FP32_Matrix3x3* const matrix, const BGC_FP32_Vector3* const vector)
{
const float x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3;
const float x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
@ -829,7 +829,7 @@ inline void bgc_fp32_matrix3x3_multiply_by_vector3(BGC_FP32_Vector3* product, co
product->x3 = x3;
}
inline void bgc_fp64_matrix3x3_multiply_by_vector3(BGC_FP64_Vector3* product, const BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Vector3* vector)
inline void bgc_fp64_matrix3x3_multiply_by_vector3(BGC_FP64_Vector3* const product, const BGC_FP64_Matrix3x3* const matrix, const BGC_FP64_Vector3* const vector)
{
const double x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3;
const double x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
@ -843,7 +843,7 @@ inline void bgc_fp64_matrix3x3_multiply_by_vector3(BGC_FP64_Vector3* product, co
// ========== Matrix Product 3x3 at 2x3 ========= //
inline void bgc_fp32_matrix3x3_multiply_by_matrix2x3(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix2x3* matrix2)
inline void bgc_fp32_matrix3x3_multiply_by_matrix2x3(BGC_FP32_Matrix2x3* const product, const BGC_FP32_Matrix3x3* const matrix1, const BGC_FP32_Matrix2x3* const matrix2)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -864,7 +864,7 @@ inline void bgc_fp32_matrix3x3_multiply_by_matrix2x3(BGC_FP32_Matrix2x3* product
product->r3c2 = r3c2;
}
inline void bgc_fp64_matrix3x3_multiply_by_matrix2x3(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix2x3* matrix2)
inline void bgc_fp64_matrix3x3_multiply_by_matrix2x3(BGC_FP64_Matrix2x3* const product, const BGC_FP64_Matrix3x3* const matrix1, const BGC_FP64_Matrix2x3* const matrix2)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -887,7 +887,7 @@ inline void bgc_fp64_matrix3x3_multiply_by_matrix2x3(BGC_FP64_Matrix2x3* product
// ========== Matrix Product 3x3 at 3x3 ========= //
inline void bgc_fp32_matrix3x3_multiply_by_matrix3x3(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix3x3* matrix2)
inline void bgc_fp32_matrix3x3_multiply_by_matrix3x3(BGC_FP32_Matrix3x3* const product, const BGC_FP32_Matrix3x3* const matrix1, const BGC_FP32_Matrix3x3* const matrix2)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -914,7 +914,7 @@ inline void bgc_fp32_matrix3x3_multiply_by_matrix3x3(BGC_FP32_Matrix3x3* product
product->r3c3 = r3c3;
}
inline void bgc_fp64_matrix3x3_multiply_by_matrix3x3(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix3x3* matrix2)
inline void bgc_fp64_matrix3x3_multiply_by_matrix3x3(BGC_FP64_Matrix3x3* const product, const BGC_FP64_Matrix3x3* const matrix1, const BGC_FP64_Matrix3x3* const matrix2)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -943,7 +943,7 @@ inline void bgc_fp64_matrix3x3_multiply_by_matrix3x3(BGC_FP64_Matrix3x3* product
// =================== Divide =================== //
inline int bgc_fp32_matrix3x3_divide_by_real(BGC_FP32_Matrix3x3* quotient, const BGC_FP32_Matrix3x3* dividend, const float divisor)
inline int bgc_fp32_matrix3x3_divide_by_real(BGC_FP32_Matrix3x3* const quotient, const BGC_FP32_Matrix3x3* const dividend, const float divisor)
{
if (bgc_fp32_is_zero(divisor) || isnan(divisor)) {
return BGC_FAILURE;
@ -953,7 +953,7 @@ inline int bgc_fp32_matrix3x3_divide_by_real(BGC_FP32_Matrix3x3* quotient, const
return BGC_SUCCESS;
}
inline int bgc_fp64_matrix3x3_divide_by_real(BGC_FP64_Matrix3x3* quotient, const BGC_FP64_Matrix3x3* dividend, const double divisor)
inline int bgc_fp64_matrix3x3_divide_by_real(BGC_FP64_Matrix3x3* const quotient, const BGC_FP64_Matrix3x3* const dividend, const double divisor)
{
if (bgc_fp64_is_zero(divisor) || isnan(divisor)) {
return BGC_FAILURE;
@ -965,7 +965,7 @@ inline int bgc_fp64_matrix3x3_divide_by_real(BGC_FP64_Matrix3x3* quotient, const
// ================== Average2 ================== //
inline void bgc_fp32_matrix3x3_get_mean2(BGC_FP32_Matrix3x3* mean, const BGC_FP32_Matrix3x3* term1, const BGC_FP32_Matrix3x3* term2)
inline void bgc_fp32_matrix3x3_get_mean2(BGC_FP32_Matrix3x3* const mean, const BGC_FP32_Matrix3x3* const term1, const BGC_FP32_Matrix3x3* const term2)
{
mean->r1c1 = (term1->r1c1 + term2->r1c1) * 0.5f;
mean->r1c2 = (term1->r1c2 + term2->r1c2) * 0.5f;
@ -980,7 +980,7 @@ inline void bgc_fp32_matrix3x3_get_mean2(BGC_FP32_Matrix3x3* mean, const BGC_FP3
mean->r3c3 = (term1->r3c3 + term2->r3c3) * 0.5f;
}
inline void bgc_fp64_matrix3x3_get_mean2(BGC_FP64_Matrix3x3* mean, const BGC_FP64_Matrix3x3* term1, const BGC_FP64_Matrix3x3* term2)
inline void bgc_fp64_matrix3x3_get_mean2(BGC_FP64_Matrix3x3* const mean, const BGC_FP64_Matrix3x3* const term1, const BGC_FP64_Matrix3x3* const term2)
{
mean->r1c1 = (term1->r1c1 + term2->r1c1) * 0.5;
mean->r1c2 = (term1->r1c2 + term2->r1c2) * 0.5;
@ -997,7 +997,7 @@ inline void bgc_fp64_matrix3x3_get_mean2(BGC_FP64_Matrix3x3* mean, const BGC_FP6
// ================== Average3 ================== //
inline void bgc_fp32_matrix3x3_get_mean3(BGC_FP32_Matrix3x3* mean, const BGC_FP32_Matrix3x3* term1, const BGC_FP32_Matrix3x3* term2, const BGC_FP32_Matrix3x3* term3)
inline void bgc_fp32_matrix3x3_get_mean3(BGC_FP32_Matrix3x3* const mean, const BGC_FP32_Matrix3x3* const term1, const BGC_FP32_Matrix3x3* const term2, const BGC_FP32_Matrix3x3* const term3)
{
mean->r1c1 = (term1->r1c1 + term2->r1c1 + term3->r1c1) * BGC_FP32_ONE_THIRD;
mean->r1c2 = (term1->r1c2 + term2->r1c2 + term3->r1c2) * BGC_FP32_ONE_THIRD;
@ -1012,7 +1012,7 @@ inline void bgc_fp32_matrix3x3_get_mean3(BGC_FP32_Matrix3x3* mean, const BGC_FP3
mean->r3c3 = (term1->r3c3 + term2->r3c3 + term3->r3c3) * BGC_FP32_ONE_THIRD;
}
inline void bgc_fp64_matrix3x3_get_mean3(BGC_FP64_Matrix3x3* mean, const BGC_FP64_Matrix3x3* term1, const BGC_FP64_Matrix3x3* term2, const BGC_FP64_Matrix3x3* term3)
inline void bgc_fp64_matrix3x3_get_mean3(BGC_FP64_Matrix3x3* const mean, const BGC_FP64_Matrix3x3* const term1, const BGC_FP64_Matrix3x3* const term2, const BGC_FP64_Matrix3x3* const term3)
{
mean->r1c1 = (term1->r1c1 + term2->r1c1 + term3->r1c1) * BGC_FP64_ONE_THIRD;
mean->r1c2 = (term1->r1c2 + term2->r1c2 + term3->r1c2) * BGC_FP64_ONE_THIRD;
@ -1029,7 +1029,7 @@ inline void bgc_fp64_matrix3x3_get_mean3(BGC_FP64_Matrix3x3* mean, const BGC_FP6
// ================ Interpolate ================= //
inline void bgc_fp32_matrix3x3_interpolate(BGC_FP32_Matrix3x3* interpolation, const BGC_FP32_Matrix3x3* first, const BGC_FP32_Matrix3x3* second, const float phase)
inline void bgc_fp32_matrix3x3_interpolate(BGC_FP32_Matrix3x3* const interpolation, const BGC_FP32_Matrix3x3* const first, const BGC_FP32_Matrix3x3* const second, const float phase)
{
const float counter_phase = 1.0f - phase;
@ -1046,7 +1046,7 @@ inline void bgc_fp32_matrix3x3_interpolate(BGC_FP32_Matrix3x3* interpolation, co
interpolation->r3c3 = first->r3c3 * counter_phase + second->r3c3 * phase;
}
inline void bgc_fp64_matrix3x3_interpolate(BGC_FP64_Matrix3x3* interpolation, const BGC_FP64_Matrix3x3* first, const BGC_FP64_Matrix3x3* second, const double phase)
inline void bgc_fp64_matrix3x3_interpolate(BGC_FP64_Matrix3x3* const interpolation, const BGC_FP64_Matrix3x3* const first, const BGC_FP64_Matrix3x3* const second, const double phase)
{
const double counter_phase = 1.0 - phase;