Небольшие исправления, а также добавление гомогенного трёхмерного вектора
This commit is contained in:
parent
03627f4401
commit
043cc72c81
25 changed files with 1686 additions and 1644 deletions
|
|
@ -9,166 +9,166 @@
|
|||
|
||||
inline void bgc_fp32_matrix2x3_reset(BGC_FP32_Matrix2x3* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0f;
|
||||
matrix->r1c2 = 0.0f;
|
||||
matrix->row1_col1 = 0.0f;
|
||||
matrix->row1_col2 = 0.0f;
|
||||
|
||||
matrix->r2c1 = 0.0f;
|
||||
matrix->r2c2 = 0.0f;
|
||||
matrix->row2_col1 = 0.0f;
|
||||
matrix->row2_col2 = 0.0f;
|
||||
|
||||
matrix->r3c1 = 0.0f;
|
||||
matrix->r3c2 = 0.0f;
|
||||
matrix->row3_col1 = 0.0f;
|
||||
matrix->row3_col2 = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix2x3_reset(BGC_FP64_Matrix2x3* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0;
|
||||
matrix->r1c2 = 0.0;
|
||||
matrix->row1_col1 = 0.0;
|
||||
matrix->row1_col2 = 0.0;
|
||||
|
||||
matrix->r2c1 = 0.0;
|
||||
matrix->r2c2 = 0.0;
|
||||
matrix->row2_col1 = 0.0;
|
||||
matrix->row2_col2 = 0.0;
|
||||
|
||||
matrix->r3c1 = 0.0;
|
||||
matrix->r3c2 = 0.0;
|
||||
matrix->row3_col1 = 0.0;
|
||||
matrix->row3_col2 = 0.0;
|
||||
}
|
||||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_matrix2x3_copy(BGC_FP32_Matrix2x3* destination, const BGC_FP32_Matrix2x3* source)
|
||||
{
|
||||
destination->r1c1 = source->r1c1;
|
||||
destination->r1c2 = source->r1c2;
|
||||
destination->row1_col1 = source->row1_col1;
|
||||
destination->row1_col2 = source->row1_col2;
|
||||
|
||||
destination->r2c1 = source->r2c1;
|
||||
destination->r2c2 = source->r2c2;
|
||||
destination->row2_col1 = source->row2_col1;
|
||||
destination->row2_col2 = source->row2_col2;
|
||||
|
||||
destination->r3c1 = source->r3c1;
|
||||
destination->r3c2 = source->r3c2;
|
||||
destination->row3_col1 = source->row3_col1;
|
||||
destination->row3_col2 = source->row3_col2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix2x3_copy(BGC_FP64_Matrix2x3* destination, const BGC_FP64_Matrix2x3* source)
|
||||
{
|
||||
destination->r1c1 = source->r1c1;
|
||||
destination->r1c2 = source->r1c2;
|
||||
destination->row1_col1 = source->row1_col1;
|
||||
destination->row1_col2 = source->row1_col2;
|
||||
|
||||
destination->r2c1 = source->r2c1;
|
||||
destination->r2c2 = source->r2c2;
|
||||
destination->row2_col1 = source->row2_col1;
|
||||
destination->row2_col2 = source->row2_col2;
|
||||
|
||||
destination->r3c1 = source->r3c1;
|
||||
destination->r3c2 = source->r3c2;
|
||||
destination->row3_col1 = source->row3_col1;
|
||||
destination->row3_col2 = source->row3_col2;
|
||||
}
|
||||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void bgc_fp32_matrix2x3_swap(BGC_FP32_Matrix2x3* matrix1, BGC_FP32_Matrix2x3* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix2->r1c1;
|
||||
const float r1c2 = matrix2->r1c2;
|
||||
const float row1_col1 = matrix2->row1_col1;
|
||||
const float row1_col2 = matrix2->row1_col2;
|
||||
|
||||
const float r2c1 = matrix2->r2c1;
|
||||
const float r2c2 = matrix2->r2c2;
|
||||
const float row2_col1 = matrix2->row2_col1;
|
||||
const float row2_col2 = matrix2->row2_col2;
|
||||
|
||||
const float r3c1 = matrix2->r3c1;
|
||||
const float r3c2 = matrix2->r3c2;
|
||||
const float row3_col1 = matrix2->row3_col1;
|
||||
const float row3_col2 = matrix2->row3_col2;
|
||||
|
||||
matrix2->r1c1 = matrix1->r1c1;
|
||||
matrix2->r1c2 = matrix1->r1c2;
|
||||
matrix2->row1_col1 = matrix1->row1_col1;
|
||||
matrix2->row1_col2 = matrix1->row1_col2;
|
||||
|
||||
matrix2->r2c1 = matrix1->r2c1;
|
||||
matrix2->r2c2 = matrix1->r2c2;
|
||||
matrix2->row2_col1 = matrix1->row2_col1;
|
||||
matrix2->row2_col2 = matrix1->row2_col2;
|
||||
|
||||
matrix2->r3c1 = matrix1->r3c1;
|
||||
matrix2->r3c2 = matrix1->r3c2;
|
||||
matrix2->row3_col1 = matrix1->row3_col1;
|
||||
matrix2->row3_col2 = matrix1->row3_col2;
|
||||
|
||||
matrix1->r1c1 = r1c1;
|
||||
matrix1->r1c2 = r1c2;
|
||||
matrix1->row1_col1 = row1_col1;
|
||||
matrix1->row1_col2 = row1_col2;
|
||||
|
||||
matrix1->r2c1 = r2c1;
|
||||
matrix1->r2c2 = r2c2;
|
||||
matrix1->row2_col1 = row2_col1;
|
||||
matrix1->row2_col2 = row2_col2;
|
||||
|
||||
matrix1->r3c1 = r3c1;
|
||||
matrix1->r3c2 = r3c2;
|
||||
matrix1->row3_col1 = row3_col1;
|
||||
matrix1->row3_col2 = row3_col2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix2x3_swap(BGC_FP64_Matrix2x3* matrix1, BGC_FP64_Matrix2x3* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix2->r1c1;
|
||||
const double r1c2 = matrix2->r1c2;
|
||||
const double row1_col1 = matrix2->row1_col1;
|
||||
const double row1_col2 = matrix2->row1_col2;
|
||||
|
||||
const double r2c1 = matrix2->r2c1;
|
||||
const double r2c2 = matrix2->r2c2;
|
||||
const double row2_col1 = matrix2->row2_col1;
|
||||
const double row2_col2 = matrix2->row2_col2;
|
||||
|
||||
const double r3c1 = matrix2->r3c1;
|
||||
const double r3c2 = matrix2->r3c2;
|
||||
const double row3_col1 = matrix2->row3_col1;
|
||||
const double row3_col2 = matrix2->row3_col2;
|
||||
|
||||
matrix2->r1c1 = matrix1->r1c1;
|
||||
matrix2->r1c2 = matrix1->r1c2;
|
||||
matrix2->row1_col1 = matrix1->row1_col1;
|
||||
matrix2->row1_col2 = matrix1->row1_col2;
|
||||
|
||||
matrix2->r2c1 = matrix1->r2c1;
|
||||
matrix2->r2c2 = matrix1->r2c2;
|
||||
matrix2->row2_col1 = matrix1->row2_col1;
|
||||
matrix2->row2_col2 = matrix1->row2_col2;
|
||||
|
||||
matrix2->r3c1 = matrix1->r3c1;
|
||||
matrix2->r3c2 = matrix1->r3c2;
|
||||
matrix2->row3_col1 = matrix1->row3_col1;
|
||||
matrix2->row3_col2 = matrix1->row3_col2;
|
||||
|
||||
matrix1->r1c1 = r1c1;
|
||||
matrix1->r1c2 = r1c2;
|
||||
matrix1->row1_col1 = row1_col1;
|
||||
matrix1->row1_col2 = row1_col2;
|
||||
|
||||
matrix1->r2c1 = r2c1;
|
||||
matrix1->r2c2 = r2c2;
|
||||
matrix1->row2_col1 = row2_col1;
|
||||
matrix1->row2_col2 = row2_col2;
|
||||
|
||||
matrix1->r3c1 = r3c1;
|
||||
matrix1->r3c2 = r3c2;
|
||||
matrix1->row3_col1 = row3_col1;
|
||||
matrix1->row3_col2 = row3_col2;
|
||||
}
|
||||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_matrix2x3_convert_to_fp32(BGC_FP32_Matrix2x3* destination, const BGC_FP64_Matrix2x3* source)
|
||||
{
|
||||
destination->r1c1 = (float)source->r1c1;
|
||||
destination->r1c2 = (float)source->r1c2;
|
||||
destination->row1_col1 = (float)source->row1_col1;
|
||||
destination->row1_col2 = (float)source->row1_col2;
|
||||
|
||||
destination->r2c1 = (float)source->r2c1;
|
||||
destination->r2c2 = (float)source->r2c2;
|
||||
destination->row2_col1 = (float)source->row2_col1;
|
||||
destination->row2_col2 = (float)source->row2_col2;
|
||||
|
||||
destination->r3c1 = (float)source->r3c1;
|
||||
destination->r3c2 = (float)source->r3c2;
|
||||
destination->row3_col1 = (float)source->row3_col1;
|
||||
destination->row3_col2 = (float)source->row3_col2;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_matrix2x3_convert_to_fp64(BGC_FP64_Matrix2x3* destination, const BGC_FP32_Matrix2x3* source)
|
||||
{
|
||||
destination->r1c1 = source->r1c1;
|
||||
destination->r1c2 = source->r1c2;
|
||||
destination->row1_col1 = source->row1_col1;
|
||||
destination->row1_col2 = source->row1_col2;
|
||||
|
||||
destination->r2c1 = source->r2c1;
|
||||
destination->r2c2 = source->r2c2;
|
||||
destination->row2_col1 = source->row2_col1;
|
||||
destination->row2_col2 = source->row2_col2;
|
||||
|
||||
destination->r3c1 = source->r3c1;
|
||||
destination->r3c2 = source->r3c2;
|
||||
destination->row3_col1 = source->row3_col1;
|
||||
destination->row3_col2 = source->row3_col2;
|
||||
}
|
||||
|
||||
// ================= Transpose ================== //
|
||||
|
||||
inline void bgc_fp32_matrix2x3_get_transposed(BGC_FP32_Matrix2x3* transposed, const BGC_FP32_Matrix3x2* matrix)
|
||||
{
|
||||
transposed->r1c1 = matrix->r1c1;
|
||||
transposed->r1c2 = matrix->r2c1;
|
||||
transposed->row1_col1 = matrix->row1_col1;
|
||||
transposed->row1_col2 = matrix->row2_col1;
|
||||
|
||||
transposed->r2c1 = matrix->r1c2;
|
||||
transposed->r2c2 = matrix->r2c2;
|
||||
transposed->row2_col1 = matrix->row1_col2;
|
||||
transposed->row2_col2 = matrix->row2_col2;
|
||||
|
||||
transposed->r3c1 = matrix->r1c3;
|
||||
transposed->r3c2 = matrix->r2c3;
|
||||
transposed->row3_col1 = matrix->row1_col3;
|
||||
transposed->row3_col2 = matrix->row2_col3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix2x3_get_transposed(BGC_FP64_Matrix2x3* transposed, const BGC_FP64_Matrix3x2* matrix)
|
||||
{
|
||||
transposed->r1c1 = matrix->r1c1;
|
||||
transposed->r1c2 = matrix->r2c1;
|
||||
transposed->row1_col1 = matrix->row1_col1;
|
||||
transposed->row1_col2 = matrix->row2_col1;
|
||||
|
||||
transposed->r2c1 = matrix->r1c2;
|
||||
transposed->r2c2 = matrix->r2c2;
|
||||
transposed->row2_col1 = matrix->row1_col2;
|
||||
transposed->row2_col2 = matrix->row2_col2;
|
||||
|
||||
transposed->r3c1 = matrix->r1c3;
|
||||
transposed->r3c2 = matrix->r2c3;
|
||||
transposed->row3_col1 = matrix->row1_col3;
|
||||
transposed->row3_col2 = matrix->row2_col3;
|
||||
}
|
||||
|
||||
// ================== Get Row =================== //
|
||||
|
|
@ -176,20 +176,20 @@ inline void bgc_fp64_matrix2x3_get_transposed(BGC_FP64_Matrix2x3* transposed, co
|
|||
inline void bgc_fp32_matrix2x3_get_row(BGC_FP32_Vector2* row, const BGC_FP32_Matrix2x3* matrix, const int row_number)
|
||||
{
|
||||
if (row_number == 1) {
|
||||
row->x1 = matrix->r1c1;
|
||||
row->x2 = matrix->r1c2;
|
||||
row->x1 = matrix->row1_col1;
|
||||
row->x2 = matrix->row1_col2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 2) {
|
||||
row->x1 = matrix->r2c1;
|
||||
row->x2 = matrix->r2c2;
|
||||
row->x1 = matrix->row2_col1;
|
||||
row->x2 = matrix->row2_col2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 3) {
|
||||
row->x1 = matrix->r3c1;
|
||||
row->x2 = matrix->r3c2;
|
||||
row->x1 = matrix->row3_col1;
|
||||
row->x2 = matrix->row3_col2;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -200,20 +200,20 @@ inline void bgc_fp32_matrix2x3_get_row(BGC_FP32_Vector2* row, const BGC_FP32_Mat
|
|||
inline void bgc_fp64_matrix2x3_get_row(BGC_FP64_Vector2* row, const BGC_FP64_Matrix2x3* matrix, const int row_number)
|
||||
{
|
||||
if (row_number == 1) {
|
||||
row->x1 = matrix->r1c1;
|
||||
row->x2 = matrix->r1c2;
|
||||
row->x1 = matrix->row1_col1;
|
||||
row->x2 = matrix->row1_col2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 2) {
|
||||
row->x1 = matrix->r2c1;
|
||||
row->x2 = matrix->r2c2;
|
||||
row->x1 = matrix->row2_col1;
|
||||
row->x2 = matrix->row2_col2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 3) {
|
||||
row->x1 = matrix->r3c1;
|
||||
row->x2 = matrix->r3c2;
|
||||
row->x1 = matrix->row3_col1;
|
||||
row->x2 = matrix->row3_col2;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -226,40 +226,40 @@ inline void bgc_fp64_matrix2x3_get_row(BGC_FP64_Vector2* row, const BGC_FP64_Mat
|
|||
inline void bgc_fp32_matrix2x3_set_row(BGC_FP32_Matrix2x3* matrix, const int row_number, const BGC_FP32_Vector2* row)
|
||||
{
|
||||
if (row_number == 1) {
|
||||
matrix->r1c1 = row->x1;
|
||||
matrix->r1c2 = row->x2;
|
||||
matrix->row1_col1 = row->x1;
|
||||
matrix->row1_col2 = row->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 2) {
|
||||
matrix->r2c1 = row->x1;
|
||||
matrix->r2c2 = row->x2;
|
||||
matrix->row2_col1 = row->x1;
|
||||
matrix->row2_col2 = row->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 3) {
|
||||
matrix->r3c1 = row->x1;
|
||||
matrix->r3c2 = row->x2;
|
||||
matrix->row3_col1 = row->x1;
|
||||
matrix->row3_col2 = row->x2;
|
||||
}
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix2x3_set_row(BGC_FP64_Matrix2x3* matrix, const int row_number, const BGC_FP64_Vector2* row)
|
||||
{
|
||||
if (row_number == 1) {
|
||||
matrix->r1c1 = row->x1;
|
||||
matrix->r1c2 = row->x2;
|
||||
matrix->row1_col1 = row->x1;
|
||||
matrix->row1_col2 = row->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 2) {
|
||||
matrix->r2c1 = row->x1;
|
||||
matrix->r2c2 = row->x2;
|
||||
matrix->row2_col1 = row->x1;
|
||||
matrix->row2_col2 = row->x2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (row_number == 3) {
|
||||
matrix->r3c1 = row->x1;
|
||||
matrix->r3c2 = row->x2;
|
||||
matrix->row3_col1 = row->x1;
|
||||
matrix->row3_col2 = row->x2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -268,32 +268,32 @@ inline void bgc_fp64_matrix2x3_set_row(BGC_FP64_Matrix2x3* matrix, const int row
|
|||
inline void bgc_fp32_matrix2x3_get_column(BGC_FP32_Vector3* column, const BGC_FP32_Matrix2x3* matrix, const int column_number)
|
||||
{
|
||||
if (column_number == 1) {
|
||||
column->x1 = matrix->r1c1;
|
||||
column->x2 = matrix->r2c1;
|
||||
column->x3 = matrix->r3c1;
|
||||
column->x1 = matrix->row1_col1;
|
||||
column->x2 = matrix->row2_col1;
|
||||
column->x3 = matrix->row3_col1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (column_number == 2) {
|
||||
column->x1 = matrix->r1c2;
|
||||
column->x2 = matrix->r2c2;
|
||||
column->x3 = matrix->r3c2;
|
||||
column->x1 = matrix->row1_col2;
|
||||
column->x2 = matrix->row2_col2;
|
||||
column->x3 = matrix->row3_col2;
|
||||
}
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix2x3_get_column(BGC_FP64_Vector3* column, const BGC_FP64_Matrix2x3* matrix, const int column_number)
|
||||
{
|
||||
if (column_number == 1) {
|
||||
column->x1 = matrix->r1c1;
|
||||
column->x2 = matrix->r2c1;
|
||||
column->x3 = matrix->r3c1;
|
||||
column->x1 = matrix->row1_col1;
|
||||
column->x2 = matrix->row2_col1;
|
||||
column->x3 = matrix->row3_col1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (column_number == 2) {
|
||||
column->x1 = matrix->r1c2;
|
||||
column->x2 = matrix->r2c2;
|
||||
column->x3 = matrix->r3c2;
|
||||
column->x1 = matrix->row1_col2;
|
||||
column->x2 = matrix->row2_col2;
|
||||
column->x3 = matrix->row3_col2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -302,32 +302,32 @@ inline void bgc_fp64_matrix2x3_get_column(BGC_FP64_Vector3* column, const BGC_FP
|
|||
inline void bgc_fp32_matrix2x3_set_column(BGC_FP32_Matrix2x3* matrix, const int column_number, const BGC_FP32_Vector3* column)
|
||||
{
|
||||
if (column_number == 1) {
|
||||
matrix->r1c1 = column->x1;
|
||||
matrix->r2c1 = column->x2;
|
||||
matrix->r3c1 = column->x3;
|
||||
matrix->row1_col1 = column->x1;
|
||||
matrix->row2_col1 = column->x2;
|
||||
matrix->row3_col1 = column->x3;
|
||||
return;
|
||||
}
|
||||
|
||||
if (column_number == 2) {
|
||||
matrix->r1c2 = column->x1;
|
||||
matrix->r2c2 = column->x2;
|
||||
matrix->r3c2 = column->x3;
|
||||
matrix->row1_col2 = column->x1;
|
||||
matrix->row2_col2 = column->x2;
|
||||
matrix->row3_col2 = column->x3;
|
||||
}
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix2x3_set_column(BGC_FP64_Matrix2x3* matrix, const int column_number, const BGC_FP64_Vector3* column)
|
||||
{
|
||||
if (column_number == 1) {
|
||||
matrix->r1c1 = column->x1;
|
||||
matrix->r2c1 = column->x2;
|
||||
matrix->r3c1 = column->x3;
|
||||
matrix->row1_col1 = column->x1;
|
||||
matrix->row2_col1 = column->x2;
|
||||
matrix->row3_col1 = column->x3;
|
||||