Переход на версию 0.3: изменение подхода к именованию сущностей, добавление, изменение и удаление ряда функций
This commit is contained in:
parent
d33daf4e2d
commit
f7e41645fe
87 changed files with 4580 additions and 4051 deletions
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
inline void bgc_matrix3x2_reset_fp32(BgcMatrix3x2FP32* matrix)
|
||||
inline void bgc_fp32_matrix3x2_reset(BGC_FP32_Matrix3x2* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0f;
|
||||
matrix->r1c2 = 0.0f;
|
||||
|
|
@ -18,7 +18,7 @@ inline void bgc_matrix3x2_reset_fp32(BgcMatrix3x2FP32* matrix)
|
|||
matrix->r2c3 = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_reset_fp64(BgcMatrix3x2FP64* matrix)
|
||||
inline void bgc_fp64_matrix3x2_reset(BGC_FP64_Matrix3x2* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0;
|
||||
matrix->r1c2 = 0.0;
|
||||
|
|
@ -31,7 +31,7 @@ inline void bgc_matrix3x2_reset_fp64(BgcMatrix3x2FP64* matrix)
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_matrix3x2_copy_fp32(const BgcMatrix3x2FP32* source, BgcMatrix3x2FP32* destination)
|
||||
inline void bgc_fp32_matrix3x2_copy(const BGC_FP32_Matrix3x2* source, BGC_FP32_Matrix3x2* destination)
|
||||
{
|
||||
destination->r1c1 = source->r1c1;
|
||||
destination->r1c2 = source->r1c2;
|
||||
|
|
@ -42,7 +42,7 @@ inline void bgc_matrix3x2_copy_fp32(const BgcMatrix3x2FP32* source, BgcMatrix3x2
|
|||
destination->r2c3 = source->r2c3;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_copy_fp64(const BgcMatrix3x2FP64* source, BgcMatrix3x2FP64* destination)
|
||||
inline void bgc_fp64_matrix3x2_copy(const BGC_FP64_Matrix3x2* source, BGC_FP64_Matrix3x2* destination)
|
||||
{
|
||||
destination->r1c1 = source->r1c1;
|
||||
destination->r1c2 = source->r1c2;
|
||||
|
|
@ -55,7 +55,7 @@ inline void bgc_matrix3x2_copy_fp64(const BgcMatrix3x2FP64* source, BgcMatrix3x2
|
|||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void bgc_matrix3x2_swap_fp32(BgcMatrix3x2FP32* matrix1, BgcMatrix3x2FP32* matrix2)
|
||||
inline void bgc_fp32_matrix3x2_swap(BGC_FP32_Matrix3x2* matrix1, BGC_FP32_Matrix3x2* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix2->r1c1;
|
||||
const float r1c2 = matrix2->r1c2;
|
||||
|
|
@ -82,7 +82,7 @@ inline void bgc_matrix3x2_swap_fp32(BgcMatrix3x2FP32* matrix1, BgcMatrix3x2FP32*
|
|||
matrix1->r2c3 = r2c3;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_swap_fp64(BgcMatrix3x2FP64* matrix1, BgcMatrix3x2FP64* matrix2)
|
||||
inline void bgc_fp64_matrix3x2_swap(BGC_FP64_Matrix3x2* matrix1, BGC_FP64_Matrix3x2* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix2->r1c1;
|
||||
const double r1c2 = matrix2->r1c2;
|
||||
|
|
@ -111,7 +111,7 @@ inline void bgc_matrix3x2_swap_fp64(BgcMatrix3x2FP64* matrix1, BgcMatrix3x2FP64*
|
|||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_matrix3x2_convert_fp64_to_fp32(const BgcMatrix3x2FP64* source, BgcMatrix3x2FP32* destination)
|
||||
inline void bgc_fp64_matrix3x2_convert_to_fp32(const BGC_FP64_Matrix3x2* source, BGC_FP32_Matrix3x2* destination)
|
||||
{
|
||||
destination->r1c1 = (float)source->r1c1;
|
||||
destination->r1c2 = (float)source->r1c2;
|
||||
|
|
@ -122,7 +122,7 @@ inline void bgc_matrix3x2_convert_fp64_to_fp32(const BgcMatrix3x2FP64* source, B
|
|||
destination->r2c3 = (float)source->r2c3;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_convert_fp32_to_fp64(const BgcMatrix3x2FP32* source, BgcMatrix3x2FP64* destination)
|
||||
inline void bgc_fp32_matrix3x2_convert_to_fp64(const BGC_FP32_Matrix3x2* source, BGC_FP64_Matrix3x2* destination)
|
||||
{
|
||||
destination->r1c1 = source->r1c1;
|
||||
destination->r1c2 = source->r1c2;
|
||||
|
|
@ -135,7 +135,7 @@ inline void bgc_matrix3x2_convert_fp32_to_fp64(const BgcMatrix3x2FP32* source, B
|
|||
|
||||
// ================= Transpose ================== //
|
||||
|
||||
inline void bgc_matrix3x2_transpose_fp32(const BgcMatrix2x3FP32* matrix, BgcMatrix3x2FP32* transposed)
|
||||
inline void bgc_fp32_matrix3x2_get_transposed(const BGC_FP32_Matrix2x3* matrix, BGC_FP32_Matrix3x2* transposed)
|
||||
{
|
||||
transposed->r1c1 = matrix->r1c1;
|
||||
transposed->r1c2 = matrix->r2c1;
|
||||
|
|
@ -146,7 +146,7 @@ inline void bgc_matrix3x2_transpose_fp32(const BgcMatrix2x3FP32* matrix, BgcMatr
|
|||
transposed->r2c3 = matrix->r3c2;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_transpose_fp64(const BgcMatrix2x3FP64* matrix, BgcMatrix3x2FP64* transposed)
|
||||
inline void bgc_fp64_matrix3x2_get_transposed(const BGC_FP64_Matrix2x3* matrix, BGC_FP64_Matrix3x2* transposed)
|
||||
{
|
||||
transposed->r1c1 = matrix->r1c1;
|
||||
transposed->r1c2 = matrix->r2c1;
|
||||
|
|
@ -157,83 +157,199 @@ inline void bgc_matrix3x2_transpose_fp64(const BgcMatrix2x3FP64* matrix, BgcMatr
|
|||
transposed->r2c3 = matrix->r3c2;
|
||||
}
|
||||
|
||||
// ================= Set Row 1 ================== //
|
||||
// ================== Get Row =================== //
|
||||
|
||||
inline void bgc_matrix3x2_set_row1_fp32(const float c1, const float c2, const float c3, BgcMatrix3x2FP32* matrix)
|
||||
inline void bgc_fp32_matrix3x2_get_row(const int number, const BGC_FP32_Matrix3x2* matrix, BGC_FP32_Vector3* row)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
matrix->r1c3 = c3;
|
||||
if (number == 1)
|
||||
{
|
||||
row->x1 = matrix->r1c1;
|
||||
row->x2 = matrix->r1c2;
|
||||
row->x3 = matrix->r1c3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 2)
|
||||
{
|
||||
row->x1 = matrix->r2c1;
|
||||
row->x2 = matrix->r2c2;
|
||||
row->x3 = matrix->r2c3;
|
||||
return;
|
||||
}
|
||||
|
||||
row->x1 = 0.0f;
|
||||
row->x2 = 0.0f;
|
||||
row->x3 = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_set_row1_fp64(const double c1, const double c2, const double c3, BgcMatrix3x2FP64* matrix)
|
||||
inline void bgc_fp64_matrix3x2_get_row(const int number, const BGC_FP64_Matrix3x2* matrix, BGC_FP64_Vector3* row)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
matrix->r1c3 = c3;
|
||||
if (number == 1)
|
||||
{
|
||||
row->x1 = matrix->r1c1;
|
||||
row->x2 = matrix->r1c2;
|
||||
row->x3 = matrix->r1c3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 2)
|
||||
{
|
||||
row->x1 = matrix->r2c1;
|
||||
row->x2 = matrix->r2c2;
|
||||
row->x3 = matrix->r2c3;
|
||||
return;
|
||||
}
|
||||
|
||||
row->x1 = 0.0f;
|
||||
row->x2 = 0.0f;
|
||||
row->x3 = 0.0f;
|
||||
}
|
||||
|
||||
// ================= Set Row 2 ================== //
|
||||
// ================== Set Row =================== //
|
||||
|
||||
inline void bgc_matrix3x2_set_row2_fp32(const float c1, const float c2, const float c3, BgcMatrix3x2FP32* matrix)
|
||||
inline void bgc_fp32_matrix3x2_set_row(const int number, const BGC_FP32_Vector3* row, BGC_FP32_Matrix3x2* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
matrix->r2c3 = c3;
|
||||
if (number == 1)
|
||||
{
|
||||
matrix->r1c1 = row->x1;
|
||||
matrix->r1c2 = row->x2;
|
||||
matrix->r1c3 = row->x3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 2)
|
||||
{
|
||||
matrix->r2c1 = row->x1;
|
||||
matrix->r2c2 = row->x2;
|
||||
matrix->r2c3 = row->x3;
|
||||
}
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_set_row2_fp64(const double c1, const double c2, const double c3, BgcMatrix3x2FP64* matrix)
|
||||
inline void bgc_fp64_matrix3x2_set_row(const int number, const BGC_FP64_Vector3* row, BGC_FP64_Matrix3x2* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
matrix->r2c3 = c3;
|
||||
if (number == 1)
|
||||
{
|
||||
matrix->r1c1 = row->x1;
|
||||
matrix->r1c2 = row->x2;
|
||||
matrix->r1c3 = row->x3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 2)
|
||||
{
|
||||
matrix->r2c1 = row->x1;
|
||||
matrix->r2c2 = row->x2;
|
||||
matrix->r2c3 = row->x3;
|
||||
}
|
||||
}
|
||||
|
||||
// ================ Set Column 1 ================ //
|
||||
// ================= Get Column ================= //
|
||||
|
||||
inline void bgc_matrix3x2_set_column1_fp32(const float r1, const float r2, BgcMatrix3x2FP32* matrix)
|
||||
inline void bgc_fp32_matrix3x2_get_column(const int number, const BGC_FP32_Matrix3x2* matrix, BGC_FP32_Vector2* column)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
if (number == 1)
|
||||
{
|
||||
column->x1 = matrix->r1c1;
|
||||
column->x2 = matrix->r2c1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 2)
|
||||
{
|
||||
column->x1 = matrix->r1c2;
|
||||
column->x2 = matrix->r2c2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 3)
|
||||
{
|
||||
column->x1 = matrix->r1c3;
|
||||
column->x2 = matrix->r2c3;
|
||||
return;
|
||||
}
|
||||
|
||||
column->x1 = 0.0f;
|
||||
column->x2 = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_set_column1_fp64(const double r1, const double r2, BgcMatrix3x2FP64* matrix)
|
||||
inline void bgc_fp64_matrix3x2_get_column(const int number, const BGC_FP64_Matrix3x2* matrix, BGC_FP64_Vector2* column)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
if (number == 1)
|
||||
{
|
||||
column->x1 = matrix->r1c1;
|
||||
column->x2 = matrix->r2c1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 2)
|
||||
{
|
||||
column->x1 = matrix->r1c2;
|
||||
column->x2 = matrix->r2c2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 3)
|
||||
{
|
||||
column->x1 = matrix->r1c3;
|
||||
column->x2 = matrix->r2c3;
|
||||
return;
|
||||
}
|
||||
|
||||
column->x1 = 0.0;
|
||||
column->x2 = 0.0;
|
||||
}
|
||||
|
||||
// ================ Set Column 2 ================ //
|
||||
// ================= Set Column ================= //
|
||||
|
||||
inline void bgc_matrix3x2_set_column2_fp32(const float r1, const float r2, BgcMatrix3x2FP32* matrix)
|
||||
inline void bgc_fp32_matrix3x2_set_column(const int number, const BGC_FP32_Vector2* column, BGC_FP32_Matrix3x2* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
if (number == 1)
|
||||
{
|
||||
matrix->r1c1 = column->x1;
|
||||
matrix->r2c1 = column->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 2)
|
||||
{
|
||||
matrix->r1c2 = column->x1;
|
||||
matrix->r2c2 = column->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (number == 3)
|
||||
{
|
||||
matrix->r1c3 = column->x1;
|
||||
matrix->r2c3 = column->x2;
|
||||
}
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_set_column2_fp64(const double r1, const double r2, BgcMatrix3x2FP64* matrix)
|
||||
inline void bgc_fp64_matrix3x2_set_column(const int number, const BGC_FP64_Vector2* column, BGC_FP64_Matrix3x2* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
}
|
||||
if (number == 1)
|
||||
{
|
||||
matrix->r1c1 = column->x1;
|
||||
matrix->r2c1 = column->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
// ================ Set Column 3 ================ //
|
||||
if (number == 2)
|
||||
{
|
||||
matrix->r1c2 = column->x1;
|
||||
matrix->r2c2 = column->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_set_column3_fp32(const float r1, const float r2, BgcMatrix3x2FP32* matrix)
|
||||
{
|
||||
matrix->r1c3 = r1;
|
||||
matrix->r2c3 = r2;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_set_column3_fp64(const double r1, const double r2, BgcMatrix3x2FP64* matrix)
|
||||
{
|
||||
matrix->r1c3 = r1;
|
||||
matrix->r2c3 = r2;
|
||||
if (number == 3)
|
||||
{
|
||||
matrix->r1c3 = column->x1;
|
||||
matrix->r2c3 = column->x2;
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== Add ===================== //
|
||||
|
||||
inline void bgc_matrix3x2_add_fp32(const BgcMatrix3x2FP32* matrix1, const BgcMatrix3x2FP32* matrix2, BgcMatrix3x2FP32* sum)
|
||||
inline void bgc_fp32_matrix3x2_add(const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix3x2* matrix2, BGC_FP32_Matrix3x2* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
|
@ -244,7 +360,7 @@ inline void bgc_matrix3x2_add_fp32(const BgcMatrix3x2FP32* matrix1, const BgcMat
|
|||
sum->r2c3 = matrix1->r2c3 + matrix2->r2c3;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_add_fp64(const BgcMatrix3x2FP64* matrix1, const BgcMatrix3x2FP64* matrix2, BgcMatrix3x2FP64* sum)
|
||||
inline void bgc_fp64_matrix3x2_add(const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix3x2* matrix2, BGC_FP64_Matrix3x2* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
|
@ -257,7 +373,7 @@ inline void bgc_matrix3x2_add_fp64(const BgcMatrix3x2FP64* matrix1, const BgcMat
|
|||
|
||||
// ================= Add scaled ================= //
|
||||
|
||||
inline void bgc_matrix3x2_add_scaled_fp32(const BgcMatrix3x2FP32* basic_matrix, const BgcMatrix3x2FP32* scalable_matrix, const float scale, BgcMatrix3x2FP32* sum)
|
||||
inline void bgc_fp32_matrix3x2_add_scaled(const BGC_FP32_Matrix3x2* basic_matrix, const BGC_FP32_Matrix3x2* scalable_matrix, const float scale, BGC_FP32_Matrix3x2* sum)
|
||||
{
|
||||
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
|
||||
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
|
||||
|
|
@ -268,7 +384,7 @@ inline void bgc_matrix3x2_add_scaled_fp32(const BgcMatrix3x2FP32* basic_matrix,
|
|||
sum->r2c3 = basic_matrix->r2c3 + scalable_matrix->r2c3 * scale;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_add_scaled_fp64(const BgcMatrix3x2FP64* basic_matrix, const BgcMatrix3x2FP64* scalable_matrix, const double scale, BgcMatrix3x2FP64* sum)
|
||||
inline void bgc_fp64_matrix3x2_add_scaled(const BGC_FP64_Matrix3x2* basic_matrix, const BGC_FP64_Matrix3x2* scalable_matrix, const double scale, BGC_FP64_Matrix3x2* sum)
|
||||
{
|
||||
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
|
||||
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
|
||||
|
|
@ -281,7 +397,7 @@ inline void bgc_matrix3x2_add_scaled_fp64(const BgcMatrix3x2FP64* basic_matrix,
|
|||
|
||||
// ================== Subtract ================== //
|
||||
|
||||
inline void bgc_matrix3x2_subtract_fp32(const BgcMatrix3x2FP32* minuend, const BgcMatrix3x2FP32* subtrahend, BgcMatrix3x2FP32* difference)
|
||||
inline void bgc_fp32_matrix3x2_subtract(const BGC_FP32_Matrix3x2* minuend, const BGC_FP32_Matrix3x2* subtrahend, BGC_FP32_Matrix3x2* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
|
@ -292,7 +408,7 @@ inline void bgc_matrix3x2_subtract_fp32(const BgcMatrix3x2FP32* minuend, const B
|
|||
difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_subtract_fp64(const BgcMatrix3x2FP64* minuend, const BgcMatrix3x2FP64* subtrahend, BgcMatrix3x2FP64* difference)
|
||||
inline void bgc_fp64_matrix3x2_subtract(const BGC_FP64_Matrix3x2* minuend, const BGC_FP64_Matrix3x2* subtrahend, BGC_FP64_Matrix3x2* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
|
@ -303,33 +419,9 @@ inline void bgc_matrix3x2_subtract_fp64(const BgcMatrix3x2FP64* minuend, const B
|
|||
difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
|
||||
}
|
||||
|
||||
// ============== Subtract scaled =============== //
|
||||
|
||||
inline void bgc_matrix3x2_subtract_scaled_fp32(const BgcMatrix3x2FP32* basic_matrix, const BgcMatrix3x2FP32* scalable_matrix, const float scale, BgcMatrix3x2FP32* difference)
|
||||
{
|
||||
difference->r1c1 = basic_matrix->r1c1 - scalable_matrix->r1c1 * scale;
|
||||
difference->r1c2 = basic_matrix->r1c2 - scalable_matrix->r1c2 * scale;
|
||||
difference->r1c3 = basic_matrix->r1c3 - scalable_matrix->r1c3 * scale;
|
||||
|
||||
difference->r2c1 = basic_matrix->r2c1 - scalable_matrix->r2c1 * scale;
|
||||
difference->r2c2 = basic_matrix->r2c2 - scalable_matrix->r2c2 * scale;
|
||||
difference->r2c3 = basic_matrix->r2c3 - scalable_matrix->r2c3 * scale;
|
||||
}
|
||||
|
||||
inline void bgc_matrix3x2_subtract_scaled_fp64(const BgcMatrix3x2FP64* basic_matrix, const BgcMatrix3x2FP64* scalable_matrix, const double scale, BgcMatrix3x2FP64* difference)
|
||||
{
|
||||
difference->r1c1 = basic_matrix->r1c1 - scalable_matrix->r1c1 * scale;
|
||||
difference->r1c2 = basic_matrix->r1c2 - scalable_matrix->r1c2 * scale;
|
||||
difference->r1c3 = basic_matrix->r1c3 - scalable_matrix->r1c3 * scale;
|
||||
|
||||
difference->r2c1 = basic_matrix->r2c1 - scalable_matrix->r2c1 * scale;
|
||||
difference->r2c2 = basic_matrix->r2c2 - scalable_matrix->r2c2 * scale;
|
||||
difference->r2c3 = basic_matrix->r2c3 - scalable_matrix->r2c3 * scale;
|
||||
}
|
||||
|
||||
// ================== Multiply ================== //
|
||||
|
||||