Переход на парадигму Destination first в порядке параметров функий

This commit is contained in:
Andrey Pokidov 2026-02-01 23:42:51 +07:00
parent f7e41645fe
commit 03627f4401
41 changed files with 1570 additions and 1978 deletions

View file

@ -2,7 +2,7 @@
#define _BGC_MATRIX3X3_H_
#include "vector3.h"
#include "matrixes.h"
#include "matrices.h"
// =================== Reset ==================== //
@ -70,7 +70,7 @@ inline void bgc_fp64_matrix3x3_make_identity(BGC_FP64_Matrix3x3* matrix)
// ================ Set Diagonal ================ //
inline void bgc_fp32_matrix3x3_make_diagonal(const float d1, const float d2, const float d3, BGC_FP32_Matrix3x3* matrix)
inline void bgc_fp32_matrix3x3_make_diagonal(BGC_FP32_Matrix3x3* matrix, const float d1, const float d2, const float d3)
{
matrix->r1c1 = d1;
matrix->r1c2 = 0.0f;
@ -85,7 +85,7 @@ inline void bgc_fp32_matrix3x3_make_diagonal(const float d1, const float d2, con
matrix->r3c3 = d2;
}
inline void bgc_fp64_matrix3x3_make_diagonal(const double d1, const double d2, const double d3, BGC_FP64_Matrix3x3* matrix)
inline void bgc_fp64_matrix3x3_make_diagonal(BGC_FP64_Matrix3x3* matrix, const double d1, const double d2, const double d3)
{
matrix->r1c1 = d1;
matrix->r1c2 = 0.0;
@ -102,7 +102,7 @@ inline void bgc_fp64_matrix3x3_make_diagonal(const double d1, const double d2, c
// ==================== Copy ==================== //
inline void bgc_fp32_matrix3x3_copy(const BGC_FP32_Matrix3x3* source, BGC_FP32_Matrix3x3* destination)
inline void bgc_fp32_matrix3x3_copy(BGC_FP32_Matrix3x3* destination, const BGC_FP32_Matrix3x3* source)
{
destination->r1c1 = source->r1c1;
destination->r1c2 = source->r1c2;
@ -117,7 +117,7 @@ inline void bgc_fp32_matrix3x3_copy(const BGC_FP32_Matrix3x3* source, BGC_FP32_M
destination->r3c3 = source->r3c3;
}
inline void bgc_fp64_matrix3x3_copy(const BGC_FP64_Matrix3x3* source, BGC_FP64_Matrix3x3* destination)
inline void bgc_fp64_matrix3x3_copy(BGC_FP64_Matrix3x3* destination, const BGC_FP64_Matrix3x3* source)
{
destination->r1c1 = source->r1c1;
destination->r1c2 = source->r1c2;
@ -214,7 +214,7 @@ inline void bgc_fp64_matrix3x3_swap(BGC_FP64_Matrix3x3* matrix1, BGC_FP64_Matrix
// ================== Convert =================== //
inline void bgc_fp64_matrix3x3_convert_to_fp32(const BGC_FP64_Matrix3x3* source, BGC_FP32_Matrix3x3* destination)
inline void bgc_fp64_matrix3x3_convert_to_fp32(BGC_FP32_Matrix3x3* destination, const BGC_FP64_Matrix3x3* source)
{
destination->r1c1 = (float)source->r1c1;
destination->r1c2 = (float)source->r1c2;
@ -229,7 +229,7 @@ inline void bgc_fp64_matrix3x3_convert_to_fp32(const BGC_FP64_Matrix3x3* source,
destination->r3c3 = (float)source->r3c3;
}
inline void bgc_fp32_matrix3x3_convert_to_fp64(const BGC_FP32_Matrix3x3* source, BGC_FP64_Matrix3x3* destination)
inline void bgc_fp32_matrix3x3_convert_to_fp64(BGC_FP64_Matrix3x3* destination, const BGC_FP32_Matrix3x3* source)
{
destination->r1c1 = source->r1c1;
destination->r1c2 = source->r1c2;
@ -330,9 +330,9 @@ inline int bgc_fp64_matrix3x3_is_rotation(const BGC_FP64_Matrix3x3* matrix)
// ================ Get Inverse ================= //
int bgc_fp32_matrix3x3_get_inverse(const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Matrix3x3* inverse);
int bgc_fp32_matrix3x3_get_inverse(BGC_FP32_Matrix3x3* inverse, const BGC_FP32_Matrix3x3* matrix);
int bgc_fp64_matrix3x3_get_inverse(const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Matrix3x3* inverse);
int bgc_fp64_matrix3x3_get_inverse(BGC_FP64_Matrix3x3* inverse, const BGC_FP64_Matrix3x3* matrix);
// =================== Invert =================== //
@ -380,7 +380,7 @@ inline void bgc_fp64_matrix3x3_transpose(BGC_FP64_Matrix3x3* matrix)
// =============== Get Transpose ================ //
inline void bgc_fp32_matrix3x3_get_transposed(const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Matrix3x3* transposed)
inline void bgc_fp32_matrix3x3_get_transposed(BGC_FP32_Matrix3x3* transposed, const BGC_FP32_Matrix3x3* matrix)
{
transposed->r1c1 = matrix->r1c1;
transposed->r2c2 = matrix->r2c2;
@ -399,7 +399,7 @@ inline void bgc_fp32_matrix3x3_get_transposed(const BGC_FP32_Matrix3x3* matrix,
transposed->r3c2 = r2c3;
}
inline void bgc_fp64_matrix3x3_get_transposed(const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Matrix3x3* transposed)
inline void bgc_fp64_matrix3x3_get_transposed(BGC_FP64_Matrix3x3* transposed, const BGC_FP64_Matrix3x3* matrix)
{
transposed->r1c1 = matrix->r1c1;
transposed->r2c2 = matrix->r2c2;
@ -420,9 +420,9 @@ inline void bgc_fp64_matrix3x3_get_transposed(const BGC_FP64_Matrix3x3* matrix,
// ================== Get Row -================== //
inline void bgc_fp32_matrix3x3_get_row(const int number, const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Vector3* row)
inline void bgc_fp32_matrix3x3_get_row(BGC_FP32_Vector3* row, const BGC_FP32_Matrix3x3* matrix, const int row_number)
{
if (number == 1)
if (row_number == 1)
{
row->x1 = matrix->r1c1;
row->x2 = matrix->r1c2;
@ -430,7 +430,7 @@ inline void bgc_fp32_matrix3x3_get_row(const int number, const BGC_FP32_Matrix3x
return;
}
if (number == 2)
if (row_number == 2)
{
row->x1 = matrix->r2c1;
row->x2 = matrix->r2c2;
@ -438,7 +438,7 @@ inline void bgc_fp32_matrix3x3_get_row(const int number, const BGC_FP32_Matrix3x
return;
}
if (number == 3)
if (row_number == 3)
{
row->x1 = matrix->r3c1;
row->x2 = matrix->r3c2;
@ -451,9 +451,9 @@ inline void bgc_fp32_matrix3x3_get_row(const int number, const BGC_FP32_Matrix3x
row->x3 = 0.0f;
}
inline void bgc_fp64_matrix3x3_get_row(const int number, const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Vector3* row)
inline void bgc_fp64_matrix3x3_get_row(BGC_FP64_Vector3* row, const BGC_FP64_Matrix3x3* matrix, const int row_number)
{
if (number == 1)
if (row_number == 1)
{
row->x1 = matrix->r1c1;
row->x2 = matrix->r1c2;
@ -461,7 +461,7 @@ inline void bgc_fp64_matrix3x3_get_row(const int number, const BGC_FP64_Matrix3x
return;
}
if (number == 2)
if (row_number == 2)
{
row->x1 = matrix->r2c1;
row->x2 = matrix->r2c2;
@ -469,7 +469,7 @@ inline void bgc_fp64_matrix3x3_get_row(const int number, const BGC_FP64_Matrix3x
return;
}
if (number == 3)
if (row_number == 3)
{
row->x1 = matrix->r3c1;
row->x2 = matrix->r3c2;
@ -484,9 +484,9 @@ inline void bgc_fp64_matrix3x3_get_row(const int number, const BGC_FP64_Matrix3x
// ================== Set Row =================== //
inline void bgc_fp32_matrix3x3_set_row(const int number, const BGC_FP32_Vector3* row, BGC_FP32_Matrix3x3* matrix)
inline void bgc_fp32_matrix3x3_set_row(BGC_FP32_Matrix3x3* matrix, const int row_number, const BGC_FP32_Vector3* row)
{
if (number == 1)
if (row_number == 1)
{
matrix->r1c1 = row->x1;
matrix->r1c2 = row->x2;
@ -494,7 +494,7 @@ inline void bgc_fp32_matrix3x3_set_row(const int number, const BGC_FP32_Vector3*
return;
}
if (number == 2)
if (row_number == 2)
{
matrix->r2c1 = row->x1;
matrix->r2c2 = row->x2;
@ -502,7 +502,7 @@ inline void bgc_fp32_matrix3x3_set_row(const int number, const BGC_FP32_Vector3*
return;
}
if (number == 3)
if (row_number == 3)
{
matrix->r3c1 = row->x1;
matrix->r3c2 = row->x2;
@ -510,9 +510,9 @@ inline void bgc_fp32_matrix3x3_set_row(const int number, const BGC_FP32_Vector3*
}
}
inline void bgc_fp64_matrix3x3_set_row(const int number, const BGC_FP64_Vector3* row, BGC_FP64_Matrix3x3* matrix)
inline void bgc_fp64_matrix3x3_set_row(BGC_FP64_Matrix3x3* matrix, const int row_number, const BGC_FP64_Vector3* row)
{
if (number == 1)
if (row_number == 1)
{
matrix->r1c1 = row->x1;
matrix->r1c2 = row->x2;
@ -520,7 +520,7 @@ inline void bgc_fp64_matrix3x3_set_row(const int number, const BGC_FP64_Vector3*
return;
}
if (number == 2)
if (row_number == 2)
{
matrix->r2c1 = row->x1;
matrix->r2c2 = row->x2;
@ -528,7 +528,7 @@ inline void bgc_fp64_matrix3x3_set_row(const int number, const BGC_FP64_Vector3*
return;
}
if (number == 3)
if (row_number == 3)
{
matrix->r3c1 = row->x1;
matrix->r3c2 = row->x2;
@ -538,9 +538,9 @@ inline void bgc_fp64_matrix3x3_set_row(const int number, const BGC_FP64_Vector3*
// ================= Get Column ================= //
inline void bgc_fp32_matrix3x3_get_column(const int number, const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Vector3* column)
inline void bgc_fp32_matrix3x3_get_column(BGC_FP32_Vector3* column, const BGC_FP32_Matrix3x3* matrix, const int column_number)
{
if (number == 1)
if (column_number == 1)
{
column->x1 = matrix->r1c1;
column->x2 = matrix->r2c1;
@ -548,7 +548,7 @@ inline void bgc_fp32_matrix3x3_get_column(const int number, const BGC_FP32_Matri
return;
}
if (number == 2)
if (column_number == 2)
{
column->x1 = matrix->r1c2;
column->x2 = matrix->r2c2;
@ -556,7 +556,7 @@ inline void bgc_fp32_matrix3x3_get_column(const int number, const BGC_FP32_Matri
return;
}
if (number == 3)
if (column_number == 3)
{
column->x1 = matrix->r1c3;
column->x2 = matrix->r2c3;
@ -569,9 +569,9 @@ inline void bgc_fp32_matrix3x3_get_column(const int number, const BGC_FP32_Matri
column->x3 = 0.0f;
}
inline void bgc_fp64_matrix3x3_get_column(const int number, const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Vector3* column)
inline void bgc_fp64_matrix3x3_get_column(BGC_FP64_Vector3* column, const BGC_FP64_Matrix3x3* matrix, const int column_number)
{
if (number == 1)
if (column_number == 1)
{
column->x1 = matrix->r1c1;
column->x2 = matrix->r2c1;
@ -579,7 +579,7 @@ inline void bgc_fp64_matrix3x3_get_column(const int number, const BGC_FP64_Matri
return;
}
if (number == 2)
if (column_number == 2)
{
column->x1 = matrix->r1c2;
column->x2 = matrix->r2c2;
@ -587,7 +587,7 @@ inline void bgc_fp64_matrix3x3_get_column(const int number, const BGC_FP64_Matri
return;
}
if (number == 3)
if (column_number == 3)
{
column->x1 = matrix->r1c3;
column->x2 = matrix->r2c3;
@ -602,9 +602,9 @@ inline void bgc_fp64_matrix3x3_get_column(const int number, const BGC_FP64_Matri
// ================= Set Column ================= //
inline void bgc_fp32_matrix3x3_set_column(const int number, const BGC_FP32_Vector3* column, BGC_FP32_Matrix3x3* matrix)
inline void bgc_fp32_matrix3x3_set_column(BGC_FP32_Matrix3x3* matrix, const int column_number, const BGC_FP32_Vector3* column)
{
if (number == 1)
if (column_number == 1)
{
matrix->r1c1 = column->x1;
matrix->r2c1 = column->x2;
@ -612,7 +612,7 @@ inline void bgc_fp32_matrix3x3_set_column(const int number, const BGC_FP32_Vecto
return;
}
if (number == 2)
if (column_number == 2)
{
matrix->r1c2 = column->x1;
matrix->r2c2 = column->x2;
@ -620,7 +620,7 @@ inline void bgc_fp32_matrix3x3_set_column(const int number, const BGC_FP32_Vecto
return;
}
if (number == 3)
if (column_number == 3)
{
matrix->r1c3 = column->x1;
matrix->r2c3 = column->x2;
@ -628,9 +628,9 @@ inline void bgc_fp32_matrix3x3_set_column(const int number, const BGC_FP32_Vecto
}
}
inline void bgc_fp64_matrix3x3_set_column(const int number, const BGC_FP64_Vector3* column, BGC_FP64_Matrix3x3* matrix)
inline void bgc_fp64_matrix3x3_set_column(BGC_FP64_Matrix3x3* matrix, const int column_number, const BGC_FP64_Vector3* column)
{
if (number == 1)
if (column_number == 1)
{
matrix->r1c1 = column->x1;
matrix->r2c1 = column->x2;
@ -638,7 +638,7 @@ inline void bgc_fp64_matrix3x3_set_column(const int number, const BGC_FP64_Vecto
return;
}
if (number == 2)
if (column_number == 2)
{
matrix->r1c2 = column->x1;
matrix->r2c2 = column->x2;
@ -646,7 +646,7 @@ inline void bgc_fp64_matrix3x3_set_column(const int number, const BGC_FP64_Vecto
return;
}
if (number == 3)
if (column_number == 3)
{
matrix->r1c3 = column->x1;
matrix->r2c3 = column->x2;
@ -656,7 +656,7 @@ inline void bgc_fp64_matrix3x3_set_column(const int number, const BGC_FP64_Vecto
// ==================== Add ===================== //
inline void bgc_fp32_matrix3x3_add(const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix3x3* matrix2, BGC_FP32_Matrix3x3* sum)
inline void bgc_fp32_matrix3x3_add(BGC_FP32_Matrix3x3* sum, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix3x3* matrix2)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -671,7 +671,7 @@ inline void bgc_fp32_matrix3x3_add(const BGC_FP32_Matrix3x3* matrix1, const BGC_
sum->r3c3 = matrix1->r3c3 + matrix2->r3c3;
}
inline void bgc_fp64_matrix3x3_add(const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix3x3* matrix2, BGC_FP64_Matrix3x3* sum)
inline void bgc_fp64_matrix3x3_add(BGC_FP64_Matrix3x3* sum, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix3x3* matrix2)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -688,7 +688,7 @@ inline void bgc_fp64_matrix3x3_add(const BGC_FP64_Matrix3x3* matrix1, const BGC_
// ================= Add scaled ================= //
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)
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)
{
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -703,7 +703,7 @@ inline void bgc_fp32_matrix3x3_add_scaled(const BGC_FP32_Matrix3x3* basic_matrix
sum->r3c3 = basic_matrix->r3c3 + scalable_matrix->r3c3 * scale;
}
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)
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)
{
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -720,7 +720,7 @@ inline void bgc_fp64_matrix3x3_add_scaled(const BGC_FP64_Matrix3x3* basic_matrix
// ================== Subtract ================== //
inline void bgc_fp32_matrix3x3_subtract(const BGC_FP32_Matrix3x3* minuend, const BGC_FP32_Matrix3x3* subtrahend, BGC_FP32_Matrix3x3* difference)
inline void bgc_fp32_matrix3x3_subtract(BGC_FP32_Matrix3x3* difference, const BGC_FP32_Matrix3x3* minuend, const BGC_FP32_Matrix3x3* subtrahend)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -735,7 +735,7 @@ inline void bgc_fp32_matrix3x3_subtract(const BGC_FP32_Matrix3x3* minuend, const
difference->r3c3 = minuend->r3c3 - subtrahend->r3c3;
}
inline void bgc_fp64_matrix3x3_subtract(const BGC_FP64_Matrix3x3* minuend, const BGC_FP64_Matrix3x3* subtrahend, BGC_FP64_Matrix3x3* difference)
inline void bgc_fp64_matrix3x3_subtract(BGC_FP64_Matrix3x3* difference, const BGC_FP64_Matrix3x3* minuend, const BGC_FP64_Matrix3x3* subtrahend)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -752,7 +752,7 @@ inline void bgc_fp64_matrix3x3_subtract(const BGC_FP64_Matrix3x3* minuend, const
// ================== Multiply ================== //
inline void bgc_fp32_matrix3x3_multiply(const BGC_FP32_Matrix3x3* multiplicand, const float multiplier, BGC_FP32_Matrix3x3* product)
inline void bgc_fp32_matrix3x3_multiply(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix3x3* multiplicand, const float multiplier)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
@ -767,7 +767,7 @@ inline void bgc_fp32_matrix3x3_multiply(const BGC_FP32_Matrix3x3* multiplicand,
product->r3c3 = multiplicand->r3c3 * multiplier;
}
inline void bgc_fp64_matrix3x3_multiply(const BGC_FP64_Matrix3x3* multiplicand, const double multiplier, BGC_FP64_Matrix3x3* product)
inline void bgc_fp64_matrix3x3_multiply(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix3x3* multiplicand, const double multiplier)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
@ -784,19 +784,19 @@ inline void bgc_fp64_matrix3x3_multiply(const BGC_FP64_Matrix3x3* multiplicand,
// =================== Divide =================== //
inline void bgc_fp32_matrix3x3_divide(const BGC_FP32_Matrix3x3* dividend, const float divisor, BGC_FP32_Matrix3x3* quotient)
inline void bgc_fp32_matrix3x3_divide(BGC_FP32_Matrix3x3* quotient, const BGC_FP32_Matrix3x3* dividend, const float divisor)
{
bgc_fp32_matrix3x3_multiply(dividend, 1.0f / divisor, quotient);
bgc_fp32_matrix3x3_multiply(quotient, dividend, 1.0f / divisor);
}
inline void bgc_fp64_matrix3x3_divide(const BGC_FP64_Matrix3x3* dividend, const double divisor, BGC_FP64_Matrix3x3* quotient)
inline void bgc_fp64_matrix3x3_divide(BGC_FP64_Matrix3x3* quotient, const BGC_FP64_Matrix3x3* dividend, const double divisor)
{
bgc_fp64_matrix3x3_multiply(dividend, 1.0 / divisor, quotient);
bgc_fp64_matrix3x3_multiply(quotient, dividend, 1.0 / divisor);
}
// ================ Interpolate ================= //
inline void bgc_fp32_matrix3x3_interpolate(const BGC_FP32_Matrix3x3* first, const BGC_FP32_Matrix3x3* second, const float phase, BGC_FP32_Matrix3x3* interpolation)
inline void bgc_fp32_matrix3x3_interpolate(BGC_FP32_Matrix3x3* interpolation, const BGC_FP32_Matrix3x3* first, const BGC_FP32_Matrix3x3* second, const float phase)
{
const float counter_phase = 1.0f - phase;
@ -813,7 +813,7 @@ inline void bgc_fp32_matrix3x3_interpolate(const BGC_FP32_Matrix3x3* first, cons
interpolation->r3c3 = first->r3c3 * counter_phase + second->r3c3 * phase;
}
inline void bgc_fp64_matrix3x3_interpolate(const BGC_FP64_Matrix3x3* first, const BGC_FP64_Matrix3x3* second, const double phase, BGC_FP64_Matrix3x3* interpolation)
inline void bgc_fp64_matrix3x3_interpolate(BGC_FP64_Matrix3x3* interpolation, const BGC_FP64_Matrix3x3* first, const BGC_FP64_Matrix3x3* second, const double phase)
{
const double counter_phase = 1.0 - phase;
@ -832,50 +832,50 @@ inline void bgc_fp64_matrix3x3_interpolate(const BGC_FP64_Matrix3x3* first, cons
// ============ Left Vector Product ============= //
inline void bgc_fp32_multiply_vector3_by_matrix3x3(const BGC_FP32_Vector3* vector, const BGC_FP32_Matrix3x3* matrix, BGC_FP32_Vector3* result)
inline void bgc_fp32_multiply_vector3_by_matrix3x3(BGC_FP32_Vector3* product, const BGC_FP32_Vector3* vector, const BGC_FP32_Matrix3x3* matrix)
{
const float x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1;
const float x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
const float x3 = vector->x1 * matrix->r1c3 + vector->x2 * matrix->r2c3 + vector->x3 * matrix->r3c3;
result->x1 = x1;
result->x2 = x2;
result->x3 = x3;
product->x1 = x1;
product->x2 = x2;
product->x3 = x3;
}
inline void bgc_fp64_multiply_vector3_by_matrix3x3(const BGC_FP64_Vector3* vector, const BGC_FP64_Matrix3x3* matrix, BGC_FP64_Vector3* result)
inline void bgc_fp64_multiply_vector3_by_matrix3x3(BGC_FP64_Vector3* product, const BGC_FP64_Vector3* vector, const BGC_FP64_Matrix3x3* matrix)
{
const double x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1;
const double x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
const double x3 = vector->x1 * matrix->r1c3 + vector->x2 * matrix->r2c3 + vector->x3 * matrix->r3c3;
result->x1 = x1;
result->x2 = x2;
result->x3 = x3;
product->x1 = x1;
product->x2 = x2;
product->x3 = x3;
}
// ============ Right Vector Product ============ //
inline void bgc_fp32_multiply_matrix3x3_by_vector3(const BGC_FP32_Matrix3x3* matrix, const BGC_FP32_Vector3* vector, BGC_FP32_Vector3* result)
inline void bgc_fp32_multiply_matrix3x3_by_vector3(BGC_FP32_Vector3* product, const BGC_FP32_Matrix3x3* matrix, const BGC_FP32_Vector3* 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;
const float x3 = matrix->r3c1 * vector->x1 + matrix->r3c2 * vector->x2 + matrix->r3c3 * vector->x3;
result->x1 = x1;
result->x2 = x2;
result->x3 = x3;
product->x1 = x1;
product->x2 = x2;
product->x3 = x3;
}
inline void bgc_fp64_multiply_matrix3x3_by_vector3(const BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Vector3* vector, BGC_FP64_Vector3* result)
inline void bgc_fp64_multiply_matrix3x3_by_vector3(BGC_FP64_Vector3* product, const BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Vector3* 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;
const double x3 = matrix->r3c1 * vector->x1 + matrix->r3c2 * vector->x2 + matrix->r3c3 * vector->x3;
result->x1 = x1;
result->x2 = x2;
result->x3 = x3;
product->x1 = x1;
product->x2 = x2;
product->x3 = x3;
}
#endif