Небольшие исправления, а также добавление гомогенного трёхмерного вектора
This commit is contained in:
parent
03627f4401
commit
043cc72c81
25 changed files with 1686 additions and 1644 deletions
|
|
@ -9,152 +9,152 @@
|
|||
|
||||
inline void bgc_fp32_matrix3x2_reset(BGC_FP32_Matrix3x2* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0f;
|
||||
matrix->r1c2 = 0.0f;
|
||||
matrix->r1c3 = 0.0f;
|
||||
matrix->row1_col1 = 0.0f;
|
||||
matrix->row1_col2 = 0.0f;
|
||||
matrix->row1_col3 = 0.0f;
|
||||
|
||||
matrix->r2c1 = 0.0f;
|
||||
matrix->r2c2 = 0.0f;
|
||||
matrix->r2c3 = 0.0f;
|
||||
matrix->row2_col1 = 0.0f;
|
||||
matrix->row2_col2 = 0.0f;
|
||||
matrix->row2_col3 = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix3x2_reset(BGC_FP64_Matrix3x2* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0;
|
||||
matrix->r1c2 = 0.0;
|
||||
matrix->r1c3 = 0.0;
|
||||
matrix->row1_col1 = 0.0;
|
||||
matrix->row1_col2 = 0.0;
|
||||
matrix->row1_col3 = 0.0;
|
||||
|
||||
matrix->r2c1 = 0.0;
|
||||
matrix->r2c2 = 0.0;
|
||||
matrix->r2c3 = 0.0;
|
||||
matrix->row2_col1 = 0.0;
|
||||
matrix->row2_col2 = 0.0;
|
||||
matrix->row2_col3 = 0.0;
|
||||
}
|
||||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_matrix3x2_copy(BGC_FP32_Matrix3x2* destination, const BGC_FP32_Matrix3x2* source)
|
||||
{
|
||||
destination->r1c1 = source->r1c1;
|
||||
destination->r1c2 = source->r1c2;
|
||||
destination->r1c3 = source->r1c3;
|
||||
destination->row1_col1 = source->row1_col1;
|
||||
destination->row1_col2 = source->row1_col2;
|
||||
destination->row1_col3 = source->row1_col3;
|
||||
|
||||
destination->r2c1 = source->r2c1;
|
||||
destination->r2c2 = source->r2c2;
|
||||
destination->r2c3 = source->r2c3;
|
||||
destination->row2_col1 = source->row2_col1;
|
||||
destination->row2_col2 = source->row2_col2;
|
||||
destination->row2_col3 = source->row2_col3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix3x2_copy(BGC_FP64_Matrix3x2* destination, const BGC_FP64_Matrix3x2* source)
|
||||
{
|
||||
destination->r1c1 = source->r1c1;
|
||||
destination->r1c2 = source->r1c2;
|
||||
destination->r1c3 = source->r1c3;
|
||||
destination->row1_col1 = source->row1_col1;
|
||||
destination->row1_col2 = source->row1_col2;
|
||||
destination->row1_col3 = source->row1_col3;
|
||||
|
||||
destination->r2c1 = source->r2c1;
|
||||
destination->r2c2 = source->r2c2;
|
||||
destination->r2c3 = source->r2c3;
|
||||
destination->row2_col1 = source->row2_col1;
|
||||
destination->row2_col2 = source->row2_col2;
|
||||
destination->row2_col3 = source->row2_col3;
|
||||
}
|
||||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void bgc_fp32_matrix3x2_swap(BGC_FP32_Matrix3x2* matrix1, BGC_FP32_Matrix3x2* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix2->r1c1;
|
||||
const float r1c2 = matrix2->r1c2;
|
||||
const float r1c3 = matrix2->r1c3;
|
||||
const float row1_col1 = matrix2->row1_col1;
|
||||
const float row1_col2 = matrix2->row1_col2;
|
||||
const float row1_col3 = matrix2->row1_col3;
|
||||
|
||||
const float r2c1 = matrix2->r2c1;
|
||||
const float r2c2 = matrix2->r2c2;
|
||||
const float r2c3 = matrix2->r2c3;
|
||||
const float row2_col1 = matrix2->row2_col1;
|
||||
const float row2_col2 = matrix2->row2_col2;
|
||||
const float row2_col3 = matrix2->row2_col3;
|
||||
|
||||
matrix2->r1c1 = matrix1->r1c1;
|
||||
matrix2->r1c2 = matrix1->r1c2;
|
||||
matrix2->r1c3 = matrix1->r1c3;
|
||||
matrix2->row1_col1 = matrix1->row1_col1;
|
||||
matrix2->row1_col2 = matrix1->row1_col2;
|
||||
matrix2->row1_col3 = matrix1->row1_col3;
|
||||
|
||||
matrix2->r2c1 = matrix1->r2c1;
|
||||
matrix2->r2c2 = matrix1->r2c2;
|
||||
matrix2->r2c3 = matrix1->r2c3;
|
||||
matrix2->row2_col1 = matrix1->row2_col1;
|
||||
matrix2->row2_col2 = matrix1->row2_col2;
|
||||
matrix2->row2_col3 = matrix1->row2_col3;
|
||||
|
||||
matrix1->r1c1 = r1c1;
|
||||
matrix1->r1c2 = r1c2;
|
||||
matrix1->r1c3 = r1c3;
|
||||
matrix1->row1_col1 = row1_col1;
|
||||
matrix1->row1_col2 = row1_col2;
|
||||
matrix1->row1_col3 = row1_col3;
|
||||
|
||||
matrix1->r2c1 = r2c1;
|
||||
matrix1->r2c2 = r2c2;
|
||||
matrix1->r2c3 = r2c3;
|
||||
matrix1->row2_col1 = row2_col1;
|
||||
matrix1->row2_col2 = row2_col2;
|
||||
matrix1->row2_col3 = row2_col3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix3x2_swap(BGC_FP64_Matrix3x2* matrix1, BGC_FP64_Matrix3x2* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix2->r1c1;
|
||||
const double r1c2 = matrix2->r1c2;
|
||||
const double r1c3 = matrix2->r1c3;
|
||||
const double row1_col1 = matrix2->row1_col1;
|
||||
const double row1_col2 = matrix2->row1_col2;
|
||||
const double row1_col3 = matrix2->row1_col3;
|
||||
|
||||
const double r2c1 = matrix2->r2c1;
|
||||
const double r2c2 = matrix2->r2c2;
|
||||
const double r2c3 = matrix2->r2c3;
|
||||
const double row2_col1 = matrix2->row2_col1;
|
||||
const double row2_col2 = matrix2->row2_col2;
|
||||
const double row2_col3 = matrix2->row2_col3;
|
||||
|
||||
matrix2->r1c1 = matrix1->r1c1;
|
||||
matrix2->r1c2 = matrix1->r1c2;
|
||||
matrix2->r1c3 = matrix1->r1c3;
|
||||
matrix2->row1_col1 = matrix1->row1_col1;
|
||||
matrix2->row1_col2 = matrix1->row1_col2;
|
||||
matrix2->row1_col3 = matrix1->row1_col3;
|
||||
|
||||
matrix2->r2c1 = matrix1->r2c1;
|
||||
matrix2->r2c2 = matrix1->r2c2;
|
||||
matrix2->r2c3 = matrix1->r2c3;
|
||||
matrix2->row2_col1 = matrix1->row2_col1;
|
||||
matrix2->row2_col2 = matrix1->row2_col2;
|
||||
matrix2->row2_col3 = matrix1->row2_col3;
|
||||
|
||||
matrix1->r1c1 = r1c1;
|
||||
matrix1->r1c2 = r1c2;
|
||||
matrix1->r1c3 = r1c3;
|
||||
matrix1->row1_col1 = row1_col1;
|
||||
matrix1->row1_col2 = row1_col2;
|
||||
matrix1->row1_col3 = row1_col3;
|
||||
|
||||
matrix1->r2c1 = r2c1;
|
||||
matrix1->r2c2 = r2c2;
|
||||
matrix1->r2c3 = r2c3;
|
||||
matrix1->row2_col1 = row2_col1;
|
||||
matrix1->row2_col2 = row2_col2;
|
||||
matrix1->row2_col3 = row2_col3;
|
||||
}
|
||||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_matrix3x2_convert_to_fp32(BGC_FP32_Matrix3x2* destination, const BGC_FP64_Matrix3x2* source)
|
||||
{
|
||||
destination->r1c1 = (float)source->r1c1;
|
||||
destination->r1c2 = (float)source->r1c2;
|
||||
destination->r1c3 = (float)source->r1c3;
|
||||
destination->row1_col1 = (float)source->row1_col1;
|
||||
destination->row1_col2 = (float)source->row1_col2;
|
||||
destination->row1_col3 = (float)source->row1_col3;
|
||||
|
||||
destination->r2c1 = (float)source->r2c1;
|
||||
destination->r2c2 = (float)source->r2c2;
|
||||
destination->r2c3 = (float)source->r2c3;
|
||||
destination->row2_col1 = (float)source->row2_col1;
|
||||
destination->row2_col2 = (float)source->row2_col2;
|
||||
destination->row2_col3 = (float)source->row2_col3;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_matrix3x2_convert_to_fp64(BGC_FP64_Matrix3x2* destination, const BGC_FP32_Matrix3x2* source)
|
||||
{
|
||||
destination->r1c1 = source->r1c1;
|
||||
destination->r1c2 = source->r1c2;
|
||||
destination->r1c3 = source->r1c3;
|
||||
destination->row1_col1 = source->row1_col1;
|
||||
destination->row1_col2 = source->row1_col2;
|
||||
destination->row1_col3 = source->row1_col3;
|
||||
|
||||
destination->r2c1 = source->r2c1;
|
||||
destination->r2c2 = source->r2c2;
|
||||
destination->r2c3 = source->r2c3;
|
||||
destination->row2_col1 = source->row2_col1;
|
||||
destination->row2_col2 = source->row2_col2;
|
||||
destination->row2_col3 = source->row2_col3;
|
||||
}
|
||||
|
||||
// ================= Transpose ================== //
|
||||
|
||||
inline void bgc_fp32_matrix3x2_get_transposed(BGC_FP32_Matrix3x2* transposed, const BGC_FP32_Matrix2x3* matrix)
|
||||
{
|
||||
transposed->r1c1 = matrix->r1c1;
|
||||
transposed->r1c2 = matrix->r2c1;
|
||||
transposed->r1c3 = matrix->r3c1;
|
||||
transposed->row1_col1 = matrix->row1_col1;
|
||||
transposed->row1_col2 = matrix->row2_col1;
|
||||
transposed->row1_col3 = matrix->row3_col1;
|
||||
|
||||
transposed->r2c1 = matrix->r1c2;
|
||||
transposed->r2c2 = matrix->r2c2;
|
||||
transposed->r2c3 = matrix->r3c2;
|
||||
transposed->row2_col1 = matrix->row1_col2;
|
||||
transposed->row2_col2 = matrix->row2_col2;
|
||||
transposed->row2_col3 = matrix->row3_col2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix3x2_get_transposed(BGC_FP64_Matrix3x2* transposed, const BGC_FP64_Matrix2x3* matrix)
|
||||
{
|
||||
transposed->r1c1 = matrix->r1c1;
|
||||
transposed->r1c2 = matrix->r2c1;
|
||||
transposed->r1c3 = matrix->r3c1;
|
||||
transposed->row1_col1 = matrix->row1_col1;
|
||||
transposed->row1_col2 = matrix->row2_col1;
|
||||
transposed->row1_col3 = matrix->row3_col1;
|
||||
|
||||
transposed->r2c1 = matrix->r1c2;
|
||||
transposed->r2c2 = matrix->r2c2;
|
||||
transposed->r2c3 = matrix->r3c2;
|
||||
transposed->row2_col1 = matrix->row1_col2;
|
||||
transposed->row2_col2 = matrix->row2_col2;
|
||||
transposed->row2_col3 = matrix->row3_col2;
|
||||
}
|
||||
|
||||
// ================== Get Row =================== //
|
||||
|
|
@ -163,17 +163,17 @@ inline void bgc_fp32_matrix3x2_get_row(BGC_FP32_Vector3* row, const BGC_FP32_Mat
|
|||
{
|
||||
if (row_number == 1)
|
||||
{
|
||||
row->x1 = matrix->r1c1;
|
||||
row->x2 = matrix->r1c2;
|
||||
row->x3 = matrix->r1c3;
|
||||
row->x1 = matrix->row1_col1;
|
||||
row->x2 = matrix->row1_col2;
|
||||
row->x3 = matrix->row1_col3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 2)
|
||||
{
|
||||
row->x1 = matrix->r2c1;
|
||||
row->x2 = matrix->r2c2;
|
||||
row->x3 = matrix->r2c3;
|
||||
row->x1 = matrix->row2_col1;
|
||||
row->x2 = matrix->row2_col2;
|
||||
row->x3 = matrix->row2_col3;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -186,17 +186,17 @@ inline void bgc_fp64_matrix3x2_get_row(BGC_FP64_Vector3* row, const BGC_FP64_Mat
|
|||
{
|
||||
if (row_number == 1)
|
||||
{
|
||||
row->x1 = matrix->r1c1;
|
||||
row->x2 = matrix->r1c2;
|
||||
row->x3 = matrix->r1c3;
|
||||
row->x1 = matrix->row1_col1;
|
||||
row->x2 = matrix->row1_col2;
|
||||
row->x3 = matrix->row1_col3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 2)
|
||||
{
|
||||
row->x1 = matrix->r2c1;
|
||||
row->x2 = matrix->r2c2;
|
||||
row->x3 = matrix->r2c3;
|
||||
row->x1 = matrix->row2_col1;
|
||||
row->x2 = matrix->row2_col2;
|
||||
row->x3 = matrix->row2_col3;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -211,17 +211,17 @@ inline void bgc_fp32_matrix3x2_set_row(BGC_FP32_Matrix3x2* matrix, const int row
|
|||
{
|
||||
if (row_number == 1)
|
||||
{
|
||||
matrix->r1c1 = row->x1;
|
||||
matrix->r1c2 = row->x2;
|
||||
matrix->r1c3 = row->x3;
|
||||
matrix->row1_col1 = row->x1;
|
||||
matrix->row1_col2 = row->x2;
|
||||
matrix->row1_col3 = row->x3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 2)
|
||||
{
|
||||
matrix->r2c1 = row->x1;
|
||||
matrix->r2c2 = row->x2;
|
||||
matrix->r2c3 = row->x3;
|
||||
matrix->row2_col1 = row->x1;
|
||||
matrix->row2_col2 = row->x2;
|
||||
matrix->row2_col3 = row->x3;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -229,17 +229,17 @@ inline void bgc_fp64_matrix3x2_set_row(BGC_FP64_Matrix3x2* matrix, const int row
|
|||
{
|
||||
if (row_number == 1)
|
||||
{
|
||||
matrix->r1c1 = row->x1;
|
||||
matrix->r1c2 = row->x2;
|
||||
matrix->r1c3 = row->x3;
|
||||
matrix->row1_col1 = row->x1;
|
||||
matrix->row1_col2 = row->x2;
|
||||
matrix->row1_col3 = row->x3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 2)
|
||||
{
|
||||
matrix->r2c1 = row->x1;
|
||||
matrix->r2c2 = row->x2;
|
||||
matrix->r2c3 = row->x3;
|
||||
matrix->row2_col1 = row->x1;
|
||||
matrix->row2_col2 = row->x2;
|
||||
matrix->row2_col3 = row->x3;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -249,22 +249,22 @@ inline void bgc_fp32_matrix3x2_get_column(BGC_FP32_Vector2* column, const BGC_FP
|
|||
{
|
||||
if (column_number == 1)
|
||||
{
|
||||
column->x1 = matrix->r1c1;
|
||||
column->x2 = matrix->r2c1;
|
||||
column->x1 = matrix->row1_col1;
|
||||
column->x2 = matrix->row2_col1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (column_number == 2)
|
||||
{
|
||||
column->x1 = matrix->r1c2;
|
||||
column->x2 = matrix->r2c2;
|
||||
column->x1 = matrix->row1_col2;
|
||||
column->x2 = matrix->row2_col2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (column_number == 3)
|
||||
{
|
||||
column->x1 = matrix->r1c3;
|
||||
column->x2 = matrix->r2c3;
|
||||
column->x1 = matrix->row1_col3;
|
||||
column->x2 = matrix->row2_col3;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -276,22 +276,22 @@ inline void bgc_fp64_matrix3x2_get_column(BGC_FP64_Vector2* column, const BGC_FP
|
|||
{
|
||||
if (column_number == 1)
|
||||
{
|
||||
column->x1 = matrix->r1c1;
|
||||
column->x2 = matrix->r2c1;
|
||||
column->x1 = matrix->row1_col1;
|
||||
column->x2 = matrix->row2_col1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (column_number == 2)
|
||||
{
|
||||
column->x1 = matrix->r1c2;
|
||||
column->x2 = matrix->r2c2;
|
||||
column->x1 = matrix->row1_col2;
|
||||
column->x2 = matrix->row2_col2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (column_number == 3)
|
||||
{
|
||||
column->x1 = matrix->r1c3;
|
||||
column->x2 = matrix->r2c3;
|
||||
column->x1 = matrix->row1_col3;
|
||||
column->x2 = matrix->row2_col3;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -305,22 +305,22 @@ inline void bgc_fp32_matrix3x2_set_column(BGC_FP32_Matrix3x2* matrix, const int
|
|||
{
|
||||
if (column_number == 1)
|
||||
{
|
||||
matrix->r1c1 = column->x1;
|
||||
matrix->r2c1 = column->x2;
|
||||
matrix->row1_col1 = column->x1;
|
||||
matrix->row2_col1 = column->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (column_number == 2)
|
||||
{
|
||||
matrix->r1c2 = column->x1;
|
||||
matrix->r2c2 = column->x2;
|
||||
matrix->row1_col2 = column->x1;
|
||||
matrix->row2_col2 = column->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (column_number == 3)
|
||||
{
|
||||
matrix->r1c3 = column->x1;
|
||||
matrix->r2c3 = column->x2;
|
||||
matrix->row1_col3 = column->x1;
|
||||
matrix->row2_col3 = column->x2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -328,22 +328,22 @@ inline void bgc_fp64_matrix3x2_set_column(BGC_FP64_Matrix3x2* matrix, const int
|
|||
{
|
||||