Добавление дополнительных операций умножения кватернионов, переименование функций для единообразия названий

This commit is contained in:
Andrey Pokidov 2026-03-29 12:19:03 +07:00
parent 078512c3d5
commit d83ab7160d
18 changed files with 379 additions and 177 deletions

View file

@ -206,6 +206,70 @@ inline void bgc_fp64_dual_vector3_multiply_by_conjugate_dual_number(BGC_FP64_Dua
bgc_fp64_vector3_copy(&product->dual_part, &dual_part);
}
// ========== Left Dual Vector Product ========== //
inline void bgc_fp32_dual_vector3_multiply_by_matrix3x3(BGC_FP32_DualVector3* const product, const BGC_FP32_DualVector3* const vector, const BGC_FP32_Matrix3x3* const matrix)
{
const float real_x1 = vector->real_part.x1 * matrix->r1c1 + vector->real_part.x2 * matrix->r2c1 + vector->real_part.x3 * matrix->r3c1;
const float real_x2 = vector->real_part.x1 * matrix->r1c2 + vector->real_part.x2 * matrix->r2c2 + vector->real_part.x3 * matrix->r3c2;
const float real_x3 = vector->real_part.x1 * matrix->r1c3 + vector->real_part.x2 * matrix->r2c3 + vector->real_part.x3 * matrix->r3c3;
const float dual_x1 = vector->real_part.x1 * matrix->r1c1 + vector->real_part.x2 * matrix->r2c1 + vector->real_part.x3 * matrix->r3c1;
const float dual_x2 = vector->real_part.x1 * matrix->r1c2 + vector->real_part.x2 * matrix->r2c2 + vector->real_part.x3 * matrix->r3c2;
const float dual_x3 = vector->real_part.x1 * matrix->r1c3 + vector->real_part.x2 * matrix->r2c3 + vector->real_part.x3 * matrix->r3c3;
product->real_part.x1 = real_x1;
product->real_part.x2 = real_x2;
product->real_part.x3 = real_x3;
product->real_part.x1 = real_x1;
product->real_part.x2 = real_x2;
product->real_part.x3 = real_x3;
}
inline void bgc_fp64_dual_vector3_multiply_by_matrix3x3(BGC_FP64_DualVector3* const product, const BGC_FP64_DualVector3* const vector, const BGC_FP64_Matrix3x3* const matrix)
{
const double real_x1 = vector->real_part.x1 * matrix->r1c1 + vector->real_part.x2 * matrix->r2c1 + vector->real_part.x3 * matrix->r3c1;
const double real_x2 = vector->real_part.x1 * matrix->r1c2 + vector->real_part.x2 * matrix->r2c2 + vector->real_part.x3 * matrix->r3c2;
const double real_x3 = vector->real_part.x1 * matrix->r1c3 + vector->real_part.x2 * matrix->r2c3 + vector->real_part.x3 * matrix->r3c3;
const double dual_x1 = vector->real_part.x1 * matrix->r1c1 + vector->real_part.x2 * matrix->r2c1 + vector->real_part.x3 * matrix->r3c1;
const double dual_x2 = vector->real_part.x1 * matrix->r1c2 + vector->real_part.x2 * matrix->r2c2 + vector->real_part.x3 * matrix->r3c2;
const double dual_x3 = vector->real_part.x1 * matrix->r1c3 + vector->real_part.x2 * matrix->r2c3 + vector->real_part.x3 * matrix->r3c3;
product->real_part.x1 = real_x1;
product->real_part.x2 = real_x2;
product->real_part.x3 = real_x3;
product->real_part.x1 = real_x1;
product->real_part.x2 = real_x2;
product->real_part.x3 = real_x3;
}
// ===== Restrict Left Dual Vector Product ====== //
inline void _bgc_fp32_restrict_dual_vector3_multiply_by_matrix3x3(BGC_FP32_DualVector3* restrict const product, const BGC_FP32_DualVector3* const vector, const BGC_FP32_Matrix3x3* const matrix)
{
product->real_part.x1 = vector->real_part.x1 * matrix->r1c1 + vector->real_part.x2 * matrix->r2c1 + vector->real_part.x3 * matrix->r3c1;
product->real_part.x2 = vector->real_part.x1 * matrix->r1c2 + vector->real_part.x2 * matrix->r2c2 + vector->real_part.x3 * matrix->r3c2;
product->real_part.x3 = vector->real_part.x1 * matrix->r1c3 + vector->real_part.x2 * matrix->r2c3 + vector->real_part.x3 * matrix->r3c3;
product->real_part.x1 = vector->real_part.x1 * matrix->r1c1 + vector->real_part.x2 * matrix->r2c1 + vector->real_part.x3 * matrix->r3c1;
product->real_part.x2 = vector->real_part.x1 * matrix->r1c2 + vector->real_part.x2 * matrix->r2c2 + vector->real_part.x3 * matrix->r3c2;
product->real_part.x3 = vector->real_part.x1 * matrix->r1c3 + vector->real_part.x2 * matrix->r2c3 + vector->real_part.x3 * matrix->r3c3;
}
inline void _bgc_fp64_restrict_dual_vector3_multiply_by_matrix3x3(BGC_FP64_DualVector3* restrict const product, const BGC_FP64_DualVector3* const vector, const BGC_FP64_Matrix3x3* const matrix)
{
product->real_part.x1 = vector->real_part.x1 * matrix->r1c1 + vector->real_part.x2 * matrix->r2c1 + vector->real_part.x3 * matrix->r3c1;
product->real_part.x2 = vector->real_part.x1 * matrix->r1c2 + vector->real_part.x2 * matrix->r2c2 + vector->real_part.x3 * matrix->r3c2;
product->real_part.x3 = vector->real_part.x1 * matrix->r1c3 + vector->real_part.x2 * matrix->r2c3 + vector->real_part.x3 * matrix->r3c3;
product->real_part.x1 = vector->real_part.x1 * matrix->r1c1 + vector->real_part.x2 * matrix->r2c1 + vector->real_part.x3 * matrix->r3c1;
product->real_part.x2 = vector->real_part.x1 * matrix->r1c2 + vector->real_part.x2 * matrix->r2c2 + vector->real_part.x3 * matrix->r3c2;
product->real_part.x3 = vector->real_part.x1 * matrix->r1c3 + vector->real_part.x2 * matrix->r2c3 + vector->real_part.x3 * matrix->r3c3;
}
// =================== Divide =================== //
inline int bgc_fp32_dual_vector3_divide_by_real_number(BGC_FP32_DualVector3* const quotient, const BGC_FP32_DualVector3* const dividend, const float divisor)