Завершение большого переименования
This commit is contained in:
parent
120e651517
commit
3805354611
31 changed files with 1213 additions and 1255 deletions
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BASIC_GEOMETRY_MATRIX2X2_H_
|
||||
#define _BASIC_GEOMETRY_MATRIX2X2_H_
|
||||
#ifndef _BGC_MATRIX2X2_H_
|
||||
#define _BGC_MATRIX2X2_H_
|
||||
|
||||
#include "angle.h"
|
||||
#include "vector2.h"
|
||||
|
@ -7,7 +7,7 @@
|
|||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
inline void matrix2x2_reset_fp32(matrix2x2_fp32_t* matrix)
|
||||
inline void bgc_matrix2x2_reset_fp32(bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0f;
|
||||
matrix->r1c2 = 0.0f;
|
||||
|
@ -15,7 +15,7 @@ inline void matrix2x2_reset_fp32(matrix2x2_fp32_t* matrix)
|
|||
matrix->r2c2 = 0.0f;
|
||||
}
|
||||
|
||||
inline void matrix2x2_reset_fp64(matrix2x2_fp64_t* matrix)
|
||||
inline void bgc_matrix2x2_reset_fp64(bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0;
|
||||
matrix->r1c2 = 0.0;
|
||||
|
@ -25,7 +25,7 @@ inline void matrix2x2_reset_fp64(matrix2x2_fp64_t* matrix)
|
|||
|
||||
// ================== Identity ================== //
|
||||
|
||||
inline void matrix2x2_set_to_identity_fp32(matrix2x2_fp32_t* matrix)
|
||||
inline void bgc_matrix2x2_set_to_identity_fp32(bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 1.0f;
|
||||
matrix->r1c2 = 0.0f;
|
||||
|
@ -33,7 +33,7 @@ inline void matrix2x2_set_to_identity_fp32(matrix2x2_fp32_t* matrix)
|
|||
matrix->r2c2 = 1.0f;
|
||||
}
|
||||
|
||||
inline void matrix2x2_set_to_identity_fp64(matrix2x2_fp64_t* matrix)
|
||||
inline void bgc_matrix2x2_set_to_identity_fp64(bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 1.0;
|
||||
matrix->r1c2 = 0.0;
|
||||
|
@ -43,7 +43,7 @@ inline void matrix2x2_set_to_identity_fp64(matrix2x2_fp64_t* matrix)
|
|||
|
||||
// ================ Make Diagonal =============== //
|
||||
|
||||
inline void matrix2x2_set_to_diagonal_fp32(const float d1, const float d2, matrix2x2_fp32_t* matrix)
|
||||
inline void bgc_matrix2x2_set_to_diagonal_fp32(const float d1, const float d2, bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = d1;
|
||||
matrix->r1c2 = 0.0f;
|
||||
|
@ -51,7 +51,7 @@ inline void matrix2x2_set_to_diagonal_fp32(const float d1, const float d2, matri
|
|||
matrix->r2c2 = d2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_set_to_diagonal_fp64(const double d1, const double d2, matrix2x2_fp64_t* matrix)
|
||||
inline void bgc_matrix2x2_set_to_diagonal_fp64(const double d1, const double d2, bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = d1;
|
||||
matrix->r1c2 = 0.0;
|
||||
|
@ -61,9 +61,9 @@ inline void matrix2x2_set_to_diagonal_fp64(const double d1, const double d2, mat
|
|||
|
||||
// ============== Rotation Matrix =============== //
|
||||
|
||||
inline void matrix2x2_make_rotation_fp32(const float angle, const angle_unit_t unit, matrix2x2_fp32_t* matrix)
|
||||
inline void bgc_matrix2x2_make_rotation_fp32(const float angle, const bgc_angle_unit_t unit, bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
const float radians = fp32_angle_to_radians(angle, unit);
|
||||
const float radians = bgc_angle_to_radians_fp32(angle, unit);
|
||||
const float cosine = cosf(radians);
|
||||
const float sine = sinf(radians);
|
||||
|
||||
|
@ -73,9 +73,9 @@ inline void matrix2x2_make_rotation_fp32(const float angle, const angle_unit_t u
|
|||
matrix->r2c2 = cosine;
|
||||
}
|
||||
|
||||
inline void matrix2x2_make_rotation_fp64(const double angle, const angle_unit_t unit, matrix2x2_fp64_t* matrix)
|
||||
inline void bgc_matrix2x2_make_rotation_fp64(const double angle, const bgc_angle_unit_t unit, bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
const double radians = fp64_angle_to_radians(angle, unit);
|
||||
const double radians = bgc_angle_to_radians_fp64(angle, unit);
|
||||
const double cosine = cos(radians);
|
||||
const double sine = sin(radians);
|
||||
|
||||
|
@ -87,7 +87,7 @@ inline void matrix2x2_make_rotation_fp64(const double angle, const angle_unit_t
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void matrix2x2_copy_fp32(const matrix2x2_fp32_t* from, matrix2x2_fp32_t* to)
|
||||
inline void bgc_matrix2x2_copy_fp32(const bgc_matrix2x2_fp32_t* from, bgc_matrix2x2_fp32_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
@ -96,7 +96,7 @@ inline void matrix2x2_copy_fp32(const matrix2x2_fp32_t* from, matrix2x2_fp32_t*
|
|||
to->r2c2 = from->r2c2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_copy_fp64(const matrix2x2_fp64_t* from, matrix2x2_fp64_t* to)
|
||||
inline void bgc_matrix2x2_copy_fp64(const bgc_matrix2x2_fp64_t* from, bgc_matrix2x2_fp64_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
@ -107,7 +107,7 @@ inline void matrix2x2_copy_fp64(const matrix2x2_fp64_t* from, matrix2x2_fp64_t*
|
|||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void matrix2x2_swap_fp32(matrix2x2_fp32_t* matrix1, matrix2x2_fp32_t* matrix2)
|
||||
inline void bgc_matrix2x2_swap_fp32(bgc_matrix2x2_fp32_t* matrix1, bgc_matrix2x2_fp32_t* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix2->r1c1;
|
||||
const float r1c2 = matrix2->r1c2;
|
||||
|
@ -128,7 +128,7 @@ inline void matrix2x2_swap_fp32(matrix2x2_fp32_t* matrix1, matrix2x2_fp32_t* mat
|
|||
matrix1->r2c2 = r2c2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_swap_fp64(matrix2x2_fp64_t* matrix1, matrix2x2_fp64_t* matrix2)
|
||||
inline void bgc_matrix2x2_swap_fp64(bgc_matrix2x2_fp64_t* matrix1, bgc_matrix2x2_fp64_t* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix2->r1c1;
|
||||
const double r1c2 = matrix2->r1c2;
|
||||
|
@ -151,7 +151,7 @@ inline void matrix2x2_swap_fp64(matrix2x2_fp64_t* matrix1, matrix2x2_fp64_t* mat
|
|||
|
||||
// ============= Copy to twin type ============== //
|
||||
|
||||
inline void matrix2x2_convert_fp64_to_fp32(const matrix2x2_fp64_t* from, matrix2x2_fp32_t* to)
|
||||
inline void bgc_matrix2x2_convert_fp64_to_fp32(const bgc_matrix2x2_fp64_t* from, bgc_matrix2x2_fp32_t* to)
|
||||
{
|
||||
to->r1c1 = (float)from->r1c1;
|
||||
to->r1c2 = (float)from->r1c2;
|
||||
|
@ -160,7 +160,7 @@ inline void matrix2x2_convert_fp64_to_fp32(const matrix2x2_fp64_t* from, matrix2
|
|||
to->r2c2 = (float)from->r2c2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_convert_fp32_to_fp64(const matrix2x2_fp32_t* from, matrix2x2_fp64_t* to)
|
||||
inline void bgc_matrix2x2_convert_fp32_to_fp64(const bgc_matrix2x2_fp32_t* from, bgc_matrix2x2_fp64_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
@ -171,42 +171,42 @@ inline void matrix2x2_convert_fp32_to_fp64(const matrix2x2_fp32_t* from, matrix2
|
|||
|
||||
// ================ Determinant ================= //
|
||||
|
||||
inline float matrix2x2_get_determinant_fp32(const matrix2x2_fp32_t* matrix)
|
||||
inline float bgc_matrix2x2_get_determinant_fp32(const bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
|
||||
}
|
||||
|
||||
inline double matrix2x2_get_determinant_fp64(const matrix2x2_fp64_t* matrix)
|
||||
inline double bgc_matrix2x2_get_determinant_fp64(const bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
|
||||
}
|
||||
|
||||
// ================== Singular ================== //
|
||||
|
||||
inline int matrix2x2_is_singular_fp32(const matrix2x2_fp32_t* matrix)
|
||||
inline int bgc_matrix2x2_is_singular_fp32(const bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
const float determinant = matrix2x2_get_determinant_fp32(matrix);
|
||||
const float determinant = bgc_matrix2x2_get_determinant_fp32(matrix);
|
||||
|
||||
return -FP32_EPSYLON <= determinant && determinant <= FP32_EPSYLON;
|
||||
return -BGC_EPSYLON_FP32 <= determinant && determinant <= BGC_EPSYLON_FP32;
|
||||
}
|
||||
|
||||
inline int matrix2x2_is_singular_fp64(const matrix2x2_fp64_t* matrix)
|
||||
inline int bgc_matrix2x2_is_singular_fp64(const bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
const double determinant = matrix2x2_get_determinant_fp64(matrix);
|
||||
const double determinant = bgc_matrix2x2_get_determinant_fp64(matrix);
|
||||
|
||||
return -FP64_EPSYLON <= determinant && determinant <= FP64_EPSYLON;
|
||||
return -BGC_EPSYLON_FP64 <= determinant && determinant <= BGC_EPSYLON_FP64;
|
||||
}
|
||||
|
||||
// =============== Transposition ================ //
|
||||
|
||||
inline void matrix2x2_transpose_fp32(matrix2x2_fp32_t* matrix)
|
||||
inline void bgc_matrix2x2_transpose_fp32(bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
const float tmp = matrix->r1c2;
|
||||
matrix->r1c2 = matrix->r2c1;
|
||||
matrix->r2c1 = tmp;
|
||||
}
|
||||
|
||||
inline void matrix2x2_transpose_fp64(matrix2x2_fp64_t* matrix)
|
||||
inline void bgc_matrix2x2_transpose_fp64(bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
const double tmp = matrix->r1c2;
|
||||
matrix->r1c2 = matrix->r2c1;
|
||||
|
@ -215,11 +215,11 @@ inline void matrix2x2_transpose_fp64(matrix2x2_fp64_t* matrix)
|
|||
|
||||
// ================= Inversion ================== //
|
||||
|
||||
inline int matrix2x2_invert_fp32(matrix2x2_fp32_t* matrix)
|
||||
inline int bgc_matrix2x2_invert_fp32(bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
const float determinant = matrix2x2_get_determinant_fp32(matrix);
|
||||
const float determinant = bgc_matrix2x2_get_determinant_fp32(matrix);
|
||||
|
||||
if (-FP32_EPSYLON <= determinant && determinant <= FP32_EPSYLON) {
|
||||
if (-BGC_EPSYLON_FP32 <= determinant && determinant <= BGC_EPSYLON_FP32) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -240,11 +240,11 @@ inline int matrix2x2_invert_fp32(matrix2x2_fp32_t* matrix)
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int matrix2x2_invert_fp64(matrix2x2_fp64_t* matrix)
|
||||
inline int bgc_matrix2x2_invert_fp64(bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
const double determinant = matrix2x2_get_determinant_fp64(matrix);
|
||||
const double determinant = bgc_matrix2x2_get_determinant_fp64(matrix);
|
||||
|
||||
if (-FP64_EPSYLON <= determinant && determinant <= FP64_EPSYLON) {
|
||||
if (-BGC_EPSYLON_FP64 <= determinant && determinant <= BGC_EPSYLON_FP64) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ inline int matrix2x2_invert_fp64(matrix2x2_fp64_t* matrix)
|
|||
|
||||
// =============== Set Transposed =============== //
|
||||
|
||||
inline void matrix2x2_set_transposed_fp32(const matrix2x2_fp32_t* from, matrix2x2_fp32_t* to)
|
||||
inline void bgc_matrix2x2_set_transposed_fp32(const bgc_matrix2x2_fp32_t* from, bgc_matrix2x2_fp32_t* to)
|
||||
{
|
||||
float tmp = from->r1c2;
|
||||
|
||||
|
@ -278,7 +278,7 @@ inline void matrix2x2_set_transposed_fp32(const matrix2x2_fp32_t* from, matrix2x
|
|||
to->r2c2 = from->r2c2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_set_transposed_fp64(const matrix2x2_fp64_t* from, matrix2x2_fp64_t* to)
|
||||
inline void bgc_matrix2x2_set_transposed_fp64(const bgc_matrix2x2_fp64_t* from, bgc_matrix2x2_fp64_t* to)
|
||||
{
|
||||
double tmp = from->r1c2;
|
||||
|
||||
|
@ -291,11 +291,11 @@ inline void matrix2x2_set_transposed_fp64(const matrix2x2_fp64_t* from, matrix2x
|
|||
|
||||
// ================ Set Inverted ================ //
|
||||
|
||||
inline int matrix2x2_set_inverted_fp32(const matrix2x2_fp32_t* from, matrix2x2_fp32_t* to)
|
||||
inline int bgc_matrix2x2_set_inverted_fp32(const bgc_matrix2x2_fp32_t* from, bgc_matrix2x2_fp32_t* to)
|
||||
{
|
||||
const float determinant = matrix2x2_get_determinant_fp32(from);
|
||||
const float determinant = bgc_matrix2x2_get_determinant_fp32(from);
|
||||
|
||||
if (-FP32_EPSYLON <= determinant && determinant <= FP32_EPSYLON) {
|
||||
if (-BGC_EPSYLON_FP32 <= determinant && determinant <= BGC_EPSYLON_FP32) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -316,11 +316,11 @@ inline int matrix2x2_set_inverted_fp32(const matrix2x2_fp32_t* from, matrix2x2_f
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int matrix2x2_set_inverted_fp64(const matrix2x2_fp64_t* from, matrix2x2_fp64_t* to)
|
||||
inline int bgc_matrix2x2_set_inverted_fp64(const bgc_matrix2x2_fp64_t* from, bgc_matrix2x2_fp64_t* to)
|
||||
{
|
||||
const double determinant = matrix2x2_get_determinant_fp64(from);
|
||||
const double determinant = bgc_matrix2x2_get_determinant_fp64(from);
|
||||
|
||||
if (-FP64_EPSYLON <= determinant && determinant <= FP64_EPSYLON) {
|
||||
if (-BGC_EPSYLON_FP64 <= determinant && determinant <= BGC_EPSYLON_FP64) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -343,13 +343,13 @@ inline int matrix2x2_set_inverted_fp64(const matrix2x2_fp64_t* from, matrix2x2_f
|
|||
|
||||
// ================= Set Row 1 ================== //
|
||||
|
||||
inline void matrix2x2_set_row1_fp32(const float c1, const float c2, matrix2x2_fp32_t* matrix)
|
||||
inline void bgc_matrix2x2_set_row1_fp32(const float c1, const float c2, bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_set_row1_fp64(const double c1, const double c2, matrix2x2_fp64_t* matrix)
|
||||
inline void bgc_matrix2x2_set_row1_fp64(const double c1, const double c2, bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
|
@ -357,13 +357,13 @@ inline void matrix2x2_set_row1_fp64(const double c1, const double c2, matrix2x2_
|
|||
|
||||
// ================= Set Row 2 ================== //
|
||||
|
||||
inline void matrix2x2_set_row2_fp32(const float c1, const float c2, matrix2x2_fp32_t* matrix)
|
||||
inline void bgc_matrix2x2_set_row2_fp32(const float c1, const float c2, bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_set_row2_fp64(const double c1, const double c2, matrix2x2_fp64_t* matrix)
|
||||
inline void bgc_matrix2x2_set_row2_fp64(const double c1, const double c2, bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
|
@ -371,13 +371,13 @@ inline void matrix2x2_set_row2_fp64(const double c1, const double c2, matrix2x2_
|
|||
|
||||
// ================ Set Column 1 ================ //
|
||||
|
||||
inline void matrix2x2_set_column1_fp32(const float r1, const float r2, matrix2x2_fp32_t* matrix)
|
||||
inline void bgc_matrix2x2_set_column1_fp32(const float r1, const float r2, bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_set_column1_fp64(const double r1, const double r2, matrix2x2_fp64_t* matrix)
|
||||
inline void bgc_matrix2x2_set_column1_fp64(const double r1, const double r2, bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
|
@ -385,41 +385,21 @@ inline void matrix2x2_set_column1_fp64(const double r1, const double r2, matrix2
|
|||
|
||||
// ================ Set Column 2 ================ //
|
||||
|
||||
inline void matrix2x2_set_column2_fp32(const float r1, const float r2, matrix2x2_fp32_t* matrix)
|
||||
inline void bgc_matrix2x2_set_column2_fp32(const float r1, const float r2, bgc_matrix2x2_fp32_t* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_set_column2_fp64(const double r1, const double r2, matrix2x2_fp64_t* matrix)
|
||||
inline void bgc_matrix2x2_set_column2_fp64(const double r1, const double r2, bgc_matrix2x2_fp64_t* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
}
|
||||
|
||||
// ================ Append scaled =============== //
|
||||
|
||||
inline void matrix2x2_add_scaled_fp32(matrix2x2_fp32_t* basic_vector, const matrix2x2_fp32_t* scalable_vector, const float scale)
|
||||
{
|
||||
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||
|
||||
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
|
||||
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
|
||||
}
|
||||
|
||||
inline void matrix2x2_add_scaled_fp64(matrix2x2_fp64_t* basic_vector, const matrix2x2_fp64_t* scalable_vector, const double scale)
|
||||
{
|
||||
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||
|
||||
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
|
||||
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
|
||||
}
|
||||
|
||||
// ================== Addition ================== //
|
||||
|
||||
inline void matrix2x2_add_fp32(const matrix2x2_fp32_t* matrix1, const matrix2x2_fp32_t* matrix2, matrix2x2_fp32_t* sum)
|
||||
inline void bgc_matrix2x2_add_fp32(const bgc_matrix2x2_fp32_t* matrix1, const bgc_matrix2x2_fp32_t* matrix2, bgc_matrix2x2_fp32_t* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
@ -428,7 +408,7 @@ inline void matrix2x2_add_fp32(const matrix2x2_fp32_t* matrix1, const matrix2x2_
|
|||
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_add_fp64(const matrix2x2_fp64_t* matrix1, const matrix2x2_fp64_t* matrix2, matrix2x2_fp64_t* sum)
|
||||
inline void bgc_matrix2x2_add_fp64(const bgc_matrix2x2_fp64_t* matrix1, const bgc_matrix2x2_fp64_t* matrix2, bgc_matrix2x2_fp64_t* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
@ -437,9 +417,29 @@ inline void matrix2x2_add_fp64(const matrix2x2_fp64_t* matrix1, const matrix2x2_
|
|||
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
|
||||
}
|
||||
|
||||
// ================= Add scaled ================= //
|
||||
|
||||
inline void bgc_matrix2x2_add_scaled_fp32(const bgc_matrix2x2_fp32_t* basic_matrix, const bgc_matrix2x2_fp32_t* scalable_matrix, const float scale, bgc_matrix2x2_fp32_t* sum)
|
||||
{
|
||||
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
|
||||
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
|
||||
|
||||
sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
|
||||
sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
|
||||
}
|
||||
|
||||
inline void bgc_matrix2x2_add_scaled_fp64(const bgc_matrix2x2_fp64_t* basic_matrix, const bgc_matrix2x2_fp64_t* scalable_matrix, const double scale, bgc_matrix2x2_fp64_t* sum)
|
||||
{
|
||||
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
|
||||
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
|
||||
|
||||
sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
|
||||
sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
|
||||
}
|
||||
|
||||
// ================ Subtraction ================= //
|
||||
|
||||
inline void matrix2x2_subtract_fp32(const matrix2x2_fp32_t* minuend, const matrix2x2_fp32_t* subtrahend, matrix2x2_fp32_t* difference)
|
||||
inline void bgc_matrix2x2_subtract_fp32(const bgc_matrix2x2_fp32_t* minuend, const bgc_matrix2x2_fp32_t* subtrahend, bgc_matrix2x2_fp32_t* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -448,7 +448,7 @@ inline void matrix2x2_subtract_fp32(const matrix2x2_fp32_t* minuend, const matri
|
|||
difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_subtract_fp64(const matrix2x2_fp64_t* minuend, const matrix2x2_fp64_t* subtrahend, matrix2x2_fp64_t* difference)
|
||||
inline void bgc_matrix2x2_subtract_fp64(const bgc_matrix2x2_fp64_t* minuend, const bgc_matrix2x2_fp64_t* subtrahend, bgc_matrix2x2_fp64_t* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -459,7 +459,7 @@ inline void matrix2x2_subtract_fp64(const matrix2x2_fp64_t* minuend, const matri
|
|||
|
||||
// =============== Multiplication =============== //
|
||||
|
||||
inline void matrix2x2_multiply_fp32(const matrix2x2_fp32_t* multiplicand, const float multiplier, matrix2x2_fp32_t* product)
|
||||
inline void bgc_matrix2x2_multiply_fp32(const bgc_matrix2x2_fp32_t* multiplicand, const float multiplier, bgc_matrix2x2_fp32_t* product)
|
||||
{
|
||||
product->r1c1 = multiplicand->r1c1 * multiplier;
|
||||
product->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -468,7 +468,7 @@ inline void matrix2x2_multiply_fp32(const matrix2x2_fp32_t* multiplicand, const
|
|||
product->r2c2 = multiplicand->r2c2 * multiplier;
|
||||
}
|
||||
|
||||
inline void matrix2x2_multiply_fp64(const matrix2x2_fp64_t* multiplicand, const double multiplier, matrix2x2_fp64_t* product)
|
||||
inline void bgc_matrix2x2_multiply_fp64(const bgc_matrix2x2_fp64_t* multiplicand, const double multiplier, bgc_matrix2x2_fp64_t* product)
|
||||
{
|
||||
product->r1c1 = multiplicand->r1c1 * multiplier;
|
||||
product->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -479,19 +479,19 @@ inline void matrix2x2_multiply_fp64(const matrix2x2_fp64_t* multiplicand, const
|
|||
|
||||
// ================== Division ================== //
|
||||
|
||||
inline void matrix2x2_divide_fp32(const matrix2x2_fp32_t* dividend, const float divisor, matrix2x2_fp32_t* quotient)
|
||||
inline void bgc_matrix2x2_divide_fp32(const bgc_matrix2x2_fp32_t* dividend, const float divisor, bgc_matrix2x2_fp32_t* quotient)
|
||||
{
|
||||
matrix2x2_multiply_fp32(dividend, 1.0f / divisor, quotient);
|
||||
bgc_matrix2x2_multiply_fp32(dividend, 1.0f / divisor, quotient);
|
||||
}
|
||||
|
||||
inline void matrix2x2_fp64_divide(const matrix2x2_fp64_t* dividend, const double divisor, matrix2x2_fp64_t* quotient)
|
||||
inline void bgc_matrix2x2_divide_fp64(const bgc_matrix2x2_fp64_t* dividend, const double divisor, bgc_matrix2x2_fp64_t* quotient)
|
||||
{
|
||||
matrix2x2_multiply_fp64(dividend, 1.0 / divisor, quotient);
|
||||
bgc_matrix2x2_multiply_fp64(dividend, 1.0 / divisor, quotient);
|
||||
}
|
||||
|
||||
// ============ Left Vector Product ============= //
|
||||
|
||||
inline void matrix2x2_left_product_fp32(const vector2_fp32_t* vector, const matrix2x2_fp32_t* matrix, vector2_fp32_t* result)
|
||||
inline void bgc_matrix2x2_left_product_fp32(const bgc_vector2_fp32_t* vector, const bgc_matrix2x2_fp32_t* matrix, bgc_vector2_fp32_t* result)
|
||||
{
|
||||
const float x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
|
||||
const float x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
|
||||
|
@ -500,7 +500,7 @@ inline void matrix2x2_left_product_fp32(const vector2_fp32_t* vector, const matr
|
|||
result->x2 = x2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_left_product_fp64(const vector2_fp64_t* vector, const matrix2x2_fp64_t* matrix, vector2_fp64_t* result)
|
||||
inline void bgc_matrix2x2_left_product_fp64(const bgc_vector2_fp64_t* vector, const bgc_matrix2x2_fp64_t* matrix, bgc_vector2_fp64_t* result)
|
||||
{
|
||||
const double x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
|
||||
const double x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
|
||||
|
@ -511,7 +511,7 @@ inline void matrix2x2_left_product_fp64(const vector2_fp64_t* vector, const matr
|
|||
|
||||
// ============ Right Vector Product ============ //
|
||||
|
||||
inline void matrix2x2_right_product_fp32(const matrix2x2_fp32_t* matrix, const vector2_fp32_t* vector, vector2_fp32_t* result)
|
||||
inline void bgc_matrix2x2_right_product_fp32(const bgc_matrix2x2_fp32_t* matrix, const bgc_vector2_fp32_t* vector, bgc_vector2_fp32_t* result)
|
||||
{
|
||||
const float x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
|
||||
const float x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
|
||||
|
@ -520,7 +520,7 @@ inline void matrix2x2_right_product_fp32(const matrix2x2_fp32_t* matrix, const v
|
|||
result->x2 = x2;
|
||||
}
|
||||
|
||||
inline void matrix2x2_right_product_fp64(const matrix2x2_fp64_t* matrix, const vector2_fp64_t* vector, vector2_fp64_t* result)
|
||||
inline void bgc_matrix2x2_right_product_fp64(const bgc_matrix2x2_fp64_t* matrix, const bgc_vector2_fp64_t* vector, bgc_vector2_fp64_t* result)
|
||||
{
|
||||
const double x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
|
||||
const double x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue