Переименование типов в соответствии со стилем POSIX, отказ от префикса bg_
This commit is contained in:
parent
d2a25823a5
commit
605afabd94
25 changed files with 1109 additions and 1035 deletions
|
@ -1,12 +1,12 @@
|
|||
#ifndef _GEOMETRY_MATRIX3X3_H_
|
||||
#define _GEOMETRY_MATRIX3X3_H_
|
||||
#ifndef _BASIC_GEOMETRY_MATRIX3X3_H_
|
||||
#define _BASIC_GEOMETRY_MATRIX3X3_H_
|
||||
|
||||
#include "vector3.h"
|
||||
#include "matrixes.h"
|
||||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_reset(BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_reset(fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0f;
|
||||
matrix->r1c2 = 0.0f;
|
||||
|
@ -21,7 +21,7 @@ static inline void bg_fp32_matrix3x3_reset(BgFP32Matrix3x3* matrix)
|
|||
matrix->r3c3 = 0.0f;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_reset(BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_reset(fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0;
|
||||
matrix->r1c2 = 0.0;
|
||||
|
@ -38,7 +38,7 @@ static inline void bg_fp64_matrix3x3_reset(BgFP64Matrix3x3* matrix)
|
|||
|
||||
// ================== Identity ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_to_identity(BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_set_to_identity(fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 1.0f;
|
||||
matrix->r1c2 = 0.0f;
|
||||
|
@ -53,7 +53,7 @@ static inline void bg_fp32_matrix3x3_set_to_identity(BgFP32Matrix3x3* matrix)
|
|||
matrix->r3c3 = 1.0f;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_to_identity(BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_set_to_identity(fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 1.0;
|
||||
matrix->r1c2 = 0.0;
|
||||
|
@ -70,7 +70,7 @@ static inline void bg_fp64_matrix3x3_set_to_identity(BgFP64Matrix3x3* matrix)
|
|||
|
||||
// ================ Make Diagonal =============== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_to_diagonal(const float d1, const float d2, const float d3, BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_set_to_diagonal(const float d1, const float d2, const float d3, fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = d1;
|
||||
matrix->r1c2 = 0.0f;
|
||||
|
@ -85,7 +85,7 @@ static inline void bg_fp32_matrix3x3_set_to_diagonal(const float d1, const float
|
|||
matrix->r3c3 = d2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_to_diagonal(const double d1, const double d2, const double d3, BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_set_to_diagonal(const double d1, const double d2, const double d3, fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = d1;
|
||||
matrix->r1c2 = 0.0;
|
||||
|
@ -102,7 +102,7 @@ static inline void bg_fp64_matrix3x3_set_to_diagonal(const double d1, const doub
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_copy(const BgFP32Matrix3x3* from, BgFP32Matrix3x3* to)
|
||||
static inline void fp32_matrix3x3_copy(const fp32_matrix3x3_t* from, fp32_matrix3x3_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
@ -117,7 +117,7 @@ static inline void bg_fp32_matrix3x3_copy(const BgFP32Matrix3x3* from, BgFP32Mat
|
|||
to->r3c3 = from->r3c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_copy(const BgFP64Matrix3x3* from, BgFP64Matrix3x3* to)
|
||||
static inline void fp64_matrix3x3_copy(const fp64_matrix3x3_t* from, fp64_matrix3x3_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
@ -134,7 +134,7 @@ static inline void bg_fp64_matrix3x3_copy(const BgFP64Matrix3x3* from, BgFP64Mat
|
|||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_swap(BgFP32Matrix3x3* matrix1, BgFP32Matrix3x3* matrix2)
|
||||
static inline void fp32_matrix3x3_swap(fp32_matrix3x3_t* matrix1, fp32_matrix3x3_t* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix2->r1c1;
|
||||
const float r1c2 = matrix2->r1c2;
|
||||
|
@ -173,7 +173,7 @@ static inline void bg_fp32_matrix3x3_swap(BgFP32Matrix3x3* matrix1, BgFP32Matrix
|
|||
matrix1->r3c3 = r3c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_swap(BgFP64Matrix3x3* matrix1, BgFP64Matrix3x3* matrix2)
|
||||
static inline void fp64_matrix3x3_swap(fp64_matrix3x3_t* matrix1, fp64_matrix3x3_t* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix2->r1c1;
|
||||
const double r1c2 = matrix2->r1c2;
|
||||
|
@ -214,7 +214,7 @@ static inline void bg_fp64_matrix3x3_swap(BgFP64Matrix3x3* matrix1, BgFP64Matrix
|
|||
|
||||
// ============= Set from twin type ============= //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_from_fp64(const BgFP64Matrix3x3* from, BgFP32Matrix3x3* to)
|
||||
static inline void fp32_matrix3x3_set_from_fp64(const fp64_matrix3x3_t* from, fp32_matrix3x3_t* to)
|
||||
{
|
||||
to->r1c1 = (float) from->r1c1;
|
||||
to->r1c2 = (float) from->r1c2;
|
||||
|
@ -229,7 +229,7 @@ static inline void bg_fp32_matrix3x3_set_from_fp64(const BgFP64Matrix3x3* from,
|
|||
to->r3c3 = (float) from->r3c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_from_fp32(const BgFP32Matrix3x3* from, BgFP64Matrix3x3* to)
|
||||
static inline void fp64_matrix3x3_set_from_fp32(const fp32_matrix3x3_t* from, fp64_matrix3x3_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
@ -246,14 +246,14 @@ static inline void bg_fp64_matrix3x3_set_from_fp32(const BgFP32Matrix3x3* from,
|
|||
|
||||
// ================ Determinant ================= //
|
||||
|
||||
static inline float bg_fp32_matrix3x3_get_determinant(const BgFP32Matrix3x3* matrix)
|
||||
static inline float fp32_matrix3x3_get_determinant(const fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
return matrix->r1c1 * (matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2)
|
||||
+ matrix->r1c2 * (matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3)
|
||||
+ matrix->r1c3 * (matrix->r2c1 * matrix->r3c2 - matrix->r2c2 * matrix->r3c1);
|
||||
}
|
||||
|
||||
static inline double bg_fp64_matrix3x3_get_determinant(const BgFP64Matrix3x3* matrix)
|
||||
static inline double fp64_matrix3x3_get_determinant(const fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
return matrix->r1c1 * (matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2)
|
||||
+ matrix->r1c2 * (matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3)
|
||||
|
@ -262,29 +262,29 @@ static inline double bg_fp64_matrix3x3_get_determinant(const BgFP64Matrix3x3* ma
|
|||
|
||||
// ================== Singular ================== //
|
||||
|
||||
static inline int bg_fp32_matrix3x3_is_singular(const BgFP32Matrix3x3* matrix)
|
||||
static inline int fp32_matrix3x3_is_singular(const fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
const float determinant = bg_fp32_matrix3x3_get_determinant(matrix);
|
||||
const float determinant = fp32_matrix3x3_get_determinant(matrix);
|
||||
|
||||
return -BG_FP32_EPSYLON <= determinant && determinant <= BG_FP32_EPSYLON;
|
||||
return -FP32_EPSYLON <= determinant && determinant <= FP32_EPSYLON;
|
||||
}
|
||||
|
||||
static inline int bg_fp64_matrix3x3_is_singular(const BgFP64Matrix3x3* matrix)
|
||||
static inline int fp64_matrix3x3_is_singular(const fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
const double determinant = bg_fp64_matrix3x3_get_determinant(matrix);
|
||||
const double determinant = fp64_matrix3x3_get_determinant(matrix);
|
||||
|
||||
return -BG_FP64_EPSYLON <= determinant && determinant <= BG_FP64_EPSYLON;
|
||||
return -FP64_EPSYLON <= determinant && determinant <= FP64_EPSYLON;
|
||||
}
|
||||
|
||||
// ================= Inversion ================== //
|
||||
|
||||
int bg_fp32_matrix3x3_invert(BgFP32Matrix3x3* matrix);
|
||||
int fp32_matrix3x3_invert(fp32_matrix3x3_t* matrix);
|
||||
|
||||
int bg_fp64_matrix3x3_invert(BgFP64Matrix3x3* matrix);
|
||||
int fp64_matrix3x3_invert(fp64_matrix3x3_t* matrix);
|
||||
|
||||
// =============== Transposition ================ //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_transpose(BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_transpose(fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
float tmp = matrix->r1c2;
|
||||
matrix->r1c2 = matrix->r2c1;
|
||||
|
@ -299,7 +299,7 @@ static inline void bg_fp32_matrix3x3_transpose(BgFP32Matrix3x3* matrix)
|
|||
matrix->r3c2 = tmp;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_transpose(BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_transpose(fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
double tmp = matrix->r1c2;
|
||||
matrix->r1c2 = matrix->r2c1;
|
||||
|
@ -316,16 +316,16 @@ static inline void bg_fp64_matrix3x3_transpose(BgFP64Matrix3x3* matrix)
|
|||
|
||||
// ================ Make Inverted =============== //
|
||||
|
||||
int bg_fp32_matrix3x3_set_inverted(const BgFP32Matrix3x3* matrix, BgFP32Matrix3x3* result);
|
||||
int fp32_matrix3x3_set_inverted(const fp32_matrix3x3_t* matrix, fp32_matrix3x3_t* result);
|
||||
|
||||
int bg_fp64_matrix3x3_set_inverted(const BgFP64Matrix3x3* matrix, BgFP64Matrix3x3* result);
|
||||
int fp64_matrix3x3_set_inverted(const fp64_matrix3x3_t* matrix, fp64_matrix3x3_t* result);
|
||||
|
||||
// =============== Make Transposed ============== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_transposed(const BgFP32Matrix3x3* matrix, BgFP32Matrix3x3* result)
|
||||
static inline void fp32_matrix3x3_set_transposed(const fp32_matrix3x3_t* matrix, fp32_matrix3x3_t* result)
|
||||
{
|
||||
if (matrix == result) {
|
||||
bg_fp32_matrix3x3_transpose(result);
|
||||
fp32_matrix3x3_transpose(result);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -342,10 +342,10 @@ static inline void bg_fp32_matrix3x3_set_transposed(const BgFP32Matrix3x3* matri
|
|||
result->r3c3 = matrix->r3c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_transposed(const BgFP64Matrix3x3* matrix, BgFP64Matrix3x3* result)
|
||||
static inline void fp64_matrix3x3_set_transposed(const fp64_matrix3x3_t* matrix, fp64_matrix3x3_t* result)
|
||||
{
|
||||
if (matrix == result) {
|
||||
bg_fp64_matrix3x3_transpose(result);
|
||||
fp64_matrix3x3_transpose(result);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -364,14 +364,14 @@ static inline void bg_fp64_matrix3x3_set_transposed(const BgFP64Matrix3x3* matri
|
|||
|
||||
// ================= Set Row 1 ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_row1(const float c1, const float c2, const float c3, BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_set_row1(const float c1, const float c2, const float c3, fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
matrix->r1c3 = c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_row1(const double c1, const double c2, const double c3, BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_set_row1(const double c1, const double c2, const double c3, fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
|
@ -380,14 +380,14 @@ static inline void bg_fp64_matrix3x3_set_row1(const double c1, const double c2,
|
|||
|
||||
// ================= Set Row 2 ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_row2(const float c1, const float c2, const float c3, BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_set_row2(const float c1, const float c2, const float c3, fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
matrix->r2c3 = c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_row2(const double c1, const double c2, const double c3, BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_set_row2(const double c1, const double c2, const double c3, fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
|
@ -396,14 +396,14 @@ static inline void bg_fp64_matrix3x3_set_row2(const double c1, const double c2,
|
|||
|
||||
// ================= Set Row 3 ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_row3(const float c1, const float c2, const float c3, BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_set_row3(const float c1, const float c2, const float c3, fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r3c1 = c1;
|
||||
matrix->r3c2 = c2;
|
||||
matrix->r3c3 = c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_row3(const double c1, const double c2, const double c3, BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_set_row3(const double c1, const double c2, const double c3, fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r3c1 = c1;
|
||||
matrix->r3c2 = c2;
|
||||
|
@ -412,14 +412,14 @@ static inline void bg_fp64_matrix3x3_set_row3(const double c1, const double c2,
|
|||
|
||||
// ================ Set Column 1 ================ //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_column1(const float r1, const float r2, const float r3, BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_set_column1(const float r1, const float r2, const float r3, fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
matrix->r3c1 = r3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_column1(const double r1, const double r2, const double r3, BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_set_column1(const double r1, const double r2, const double r3, fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
|
@ -428,14 +428,14 @@ static inline void bg_fp64_matrix3x3_set_column1(const double r1, const double r
|
|||
|
||||
// ================ Set Column 2 ================ //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_column2(const float r1, const float r2, const float r3, BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_set_column2(const float r1, const float r2, const float r3, fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
matrix->r3c2 = r3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_column2(const double r1, const double r2, const double r3, BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_set_column2(const double r1, const double r2, const double r3, fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
|
@ -444,14 +444,14 @@ static inline void bg_fp64_matrix3x3_set_column2(const double r1, const double r
|
|||
|
||||
// ================ Set Column 3 ================ //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_set_column3(const float r1, const float r2, const float r3, BgFP32Matrix3x3* matrix)
|
||||
static inline void fp32_matrix3x3_set_column3(const float r1, const float r2, const float r3, fp32_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c3 = r1;
|
||||
matrix->r2c3 = r2;
|
||||
matrix->r3c3 = r3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_set_column3(const double r1, const double r2, const double r3, BgFP64Matrix3x3* matrix)
|
||||
static inline void fp64_matrix3x3_set_column3(const double r1, const double r2, const double r3, fp64_matrix3x3_t* matrix)
|
||||
{
|
||||
matrix->r1c3 = r1;
|
||||
matrix->r2c3 = r2;
|
||||
|
@ -460,7 +460,7 @@ static inline void bg_fp64_matrix3x3_set_column3(const double r1, const double r
|
|||
|
||||
// ================ Append scaled =============== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_append_scaled(BgFP32Matrix3x3* basic_vector, const BgFP32Matrix3x3* scalable_vector, const float scale)
|
||||
static inline void fp32_matrix3x3_append_scaled(fp32_matrix3x3_t* basic_vector, const fp32_matrix3x3_t* scalable_vector, const float scale)
|
||||
{
|
||||
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||
|
@ -475,7 +475,7 @@ static inline void bg_fp32_matrix3x3_append_scaled(BgFP32Matrix3x3* basic_vector
|
|||
basic_vector->r3c3 += scalable_vector->r3c3 * scale;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_append_scaled(BgFP64Matrix3x3* basic_vector, const BgFP64Matrix3x3* scalable_vector, const double scale)
|
||||
static inline void fp64_matrix3x3_append_scaled(fp64_matrix3x3_t* basic_vector, const fp64_matrix3x3_t* scalable_vector, const double scale)
|
||||
{
|
||||
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||
|
@ -492,7 +492,7 @@ static inline void bg_fp64_matrix3x3_append_scaled(BgFP64Matrix3x3* basic_vector
|
|||
|
||||
// ================== Addition ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_add(const BgFP32Matrix3x3* matrix1, const BgFP32Matrix3x3* matrix2, BgFP32Matrix3x3* sum)
|
||||
static inline void fp32_matrix3x3_add(const fp32_matrix3x3_t* matrix1, const fp32_matrix3x3_t* matrix2, fp32_matrix3x3_t* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
@ -507,7 +507,7 @@ static inline void bg_fp32_matrix3x3_add(const BgFP32Matrix3x3* matrix1, const B
|
|||
sum->r3c3 = matrix1->r3c3 + matrix2->r3c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_add(const BgFP64Matrix3x3* matrix1, const BgFP64Matrix3x3* matrix2, BgFP64Matrix3x3* sum)
|
||||
static inline void fp64_matrix3x3_add(const fp64_matrix3x3_t* matrix1, const fp64_matrix3x3_t* matrix2, fp64_matrix3x3_t* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
@ -524,7 +524,7 @@ static inline void bg_fp64_matrix3x3_add(const BgFP64Matrix3x3* matrix1, const B
|
|||
|
||||
// ================ Subtraction ================= //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_subtract(const BgFP32Matrix3x3* minuend, const BgFP32Matrix3x3* subtrahend, BgFP32Matrix3x3* difference)
|
||||
static inline void fp32_matrix3x3_subtract(const fp32_matrix3x3_t* minuend, const fp32_matrix3x3_t* subtrahend, fp32_matrix3x3_t* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -539,7 +539,7 @@ static inline void bg_fp32_matrix3x3_subtract(const BgFP32Matrix3x3* minuend, co
|
|||
difference->r3c3 = minuend->r3c3 - subtrahend->r3c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_subtract(const BgFP64Matrix3x3* minuend, const BgFP64Matrix3x3* subtrahend, BgFP64Matrix3x3* difference)
|
||||
static inline void fp64_matrix3x3_subtract(const fp64_matrix3x3_t* minuend, const fp64_matrix3x3_t* subtrahend, fp64_matrix3x3_t* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -556,7 +556,7 @@ static inline void bg_fp64_matrix3x3_subtract(const BgFP64Matrix3x3* minuend, co
|
|||
|
||||
// =============== Multiplication =============== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_multiply(const BgFP32Matrix3x3* multiplicand, const float multiplier, BgFP32Matrix3x3* product)
|
||||
static inline void fp32_matrix3x3_multiply(const fp32_matrix3x3_t* multiplicand, const float multiplier, fp32_matrix3x3_t* product)
|
||||
{
|
||||
product->r1c1 = multiplicand->r1c1 * multiplier;
|
||||
product->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -571,7 +571,7 @@ static inline void bg_fp32_matrix3x3_multiply(const BgFP32Matrix3x3* multiplican
|
|||
product->r3c3 = multiplicand->r3c3 * multiplier;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_multiply(const BgFP64Matrix3x3* multiplicand, const double multiplier, BgFP64Matrix3x3* product)
|
||||
static inline void fp64_matrix3x3_multiply(const fp64_matrix3x3_t* multiplicand, const double multiplier, fp64_matrix3x3_t* product)
|
||||
{
|
||||
product->r1c1 = multiplicand->r1c1 * multiplier;
|
||||
product->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -588,19 +588,19 @@ static inline void bg_fp64_matrix3x3_multiply(const BgFP64Matrix3x3* multiplican
|
|||
|
||||
// ================== Division ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_divide(const BgFP32Matrix3x3* dividend, const float divisor, BgFP32Matrix3x3* quotient)
|
||||
static inline void fp32_matrix3x3_divide(const fp32_matrix3x3_t* dividend, const float divisor, fp32_matrix3x3_t* quotient)
|
||||
{
|
||||
bg_fp32_matrix3x3_multiply(dividend, 1.0f / divisor, quotient);
|
||||
fp32_matrix3x3_multiply(dividend, 1.0f / divisor, quotient);
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_divide(const BgFP64Matrix3x3* dividend, const double divisor, BgFP64Matrix3x3* quotient)
|
||||
static inline void fp64_matrix3x3_divide(const fp64_matrix3x3_t* dividend, const double divisor, fp64_matrix3x3_t* quotient)
|
||||
{
|
||||
bg_fp64_matrix3x3_multiply(dividend, 1.0 / divisor, quotient);
|
||||
fp64_matrix3x3_multiply(dividend, 1.0 / divisor, quotient);
|
||||
}
|
||||
|
||||
// ============ Left Vector Product ============= //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_left_product(const BgFP32Vector3* vector, const BgFP32Matrix3x3* matrix, BgFP32Vector3* result)
|
||||
static inline void fp32_matrix3x3_left_product(const fp32_vector3_t* vector, const fp32_matrix3x3_t* matrix, fp32_vector3_t* result)
|
||||
{
|
||||
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;
|
||||
|
@ -611,7 +611,7 @@ static inline void bg_fp32_matrix3x3_left_product(const BgFP32Vector3* vector, c
|
|||
result->x3 = x3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_left_product(const BgFP64Vector3* vector, const BgFP64Matrix3x3* matrix, BgFP64Vector3* result)
|
||||
static inline void fp64_matrix3x3_left_product(const fp64_vector3_t* vector, const fp64_matrix3x3_t* matrix, fp64_vector3_t* result)
|
||||
{
|
||||
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;
|
||||
|
@ -624,7 +624,7 @@ static inline void bg_fp64_matrix3x3_left_product(const BgFP64Vector3* vector, c
|
|||
|
||||
// ============ Right Vector Product ============ //
|
||||
|
||||
static inline void bg_fp32_matrix3x3_right_product(const BgFP32Matrix3x3* matrix, const BgFP32Vector3* vector, BgFP32Vector3* result)
|
||||
static inline void fp32_matrix3x3_right_product(const fp32_matrix3x3_t* matrix, const fp32_vector3_t* vector, fp32_vector3_t* result)
|
||||
{
|
||||
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;
|
||||
|
@ -635,7 +635,7 @@ static inline void bg_fp32_matrix3x3_right_product(const BgFP32Matrix3x3* matrix
|
|||
result->x3 = x3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x3_right_product(const BgFP64Matrix3x3* matrix, const BgFP64Vector3* vector, BgFP64Vector3* result)
|
||||
static inline void fp64_matrix3x3_right_product(const fp64_matrix3x3_t* matrix, const fp64_vector3_t* vector, fp64_vector3_t* result)
|
||||
{
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue