diff --git a/Geometry.workspace b/Geometry.workspace
index e53afab..cd8d7cc 100644
--- a/Geometry.workspace
+++ b/Geometry.workspace
@@ -1,12 +1,12 @@
+
-
diff --git a/basic-geometry-test/basic-geometry-test.cbp b/basic-geometry-test/basic-geometry-test.cbp
index 77109a6..74356e5 100644
--- a/basic-geometry-test/basic-geometry-test.cbp
+++ b/basic-geometry-test/basic-geometry-test.cbp
@@ -51,186 +51,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/basic-geometry/basic-geometry.cbp b/basic-geometry/basic-geometry.cbp
index bed02d1..ef4457c 100644
--- a/basic-geometry/basic-geometry.cbp
+++ b/basic-geometry/basic-geometry.cbp
@@ -64,6 +64,14 @@
+
+
+
+
+
+
+
+
@@ -80,10 +88,6 @@
-
-
-
-
diff --git a/basic-geometry/complex.c b/basic-geometry/complex.c
index b5f6788..af68316 100644
--- a/basic-geometry/complex.c
+++ b/basic-geometry/complex.c
@@ -90,7 +90,7 @@ void bgc_fp32_complex_get_exponation(BGC_FP32_Complex* power, const BGC_FP32_Com
{
const float square_modulus = bgc_fp32_complex_get_square_modulus(base);
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON) {
power->real = 0.0f;
power->imaginary = 0.0f;
return;
@@ -110,7 +110,7 @@ void bgc_fp64_complex_get_exponation(BGC_FP64_Complex* power, const BGC_FP64_Com
{
const double square_modulus = bgc_fp64_complex_get_square_modulus(base);
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON) {
power->real = 0.0;
power->imaginary = 0.0;
return;
diff --git a/basic-geometry/complex.h b/basic-geometry/complex.h
index 6bd26a2..d1e3587 100644
--- a/basic-geometry/complex.h
+++ b/basic-geometry/complex.h
@@ -70,12 +70,12 @@ inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* number)
inline int bgc_fp32_complex_is_zero(const BGC_FP32_Complex* number)
{
- return bgc_fp32_complex_get_square_modulus(number) <= BGC_FP32_SQUARE_EPSYLON;
+ return bgc_fp32_complex_get_square_modulus(number) <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* number)
{
- return bgc_fp64_complex_get_square_modulus(number) <= BGC_FP64_SQUARE_EPSYLON;
+ return bgc_fp64_complex_get_square_modulus(number) <= BGC_FP64_SQUARE_EPSILON;
}
inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* number)
@@ -178,7 +178,7 @@ inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* number)
return 1;
}
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -198,7 +198,7 @@ inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number)
return 1;
}
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -220,7 +220,7 @@ inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* normalized, const B
return 1;
}
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
normalized->real = 0.0f;
normalized->imaginary = 0.0f;
return 0;
@@ -244,7 +244,7 @@ inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* normalized, const B
return 1;
}
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
normalized->real = 0.0;
normalized->imaginary = 0.0;
return 0;
@@ -288,7 +288,7 @@ inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* inverse, const BGC_FP3
{
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -304,7 +304,7 @@ inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* inverse, const BGC_FP6
{
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -368,7 +368,7 @@ inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* difference, const BGC_FP
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
}
-inline void bgc_fp64_complex_subtract(const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend, BGC_FP64_Complex* difference)
+inline void bgc_fp64_complex_subtract(BGC_FP64_Complex* difference, const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend)
{
difference->real = minuend->real - subtrahend->real;
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
@@ -414,7 +414,7 @@ inline int bgc_fp32_complex_get_ratio(BGC_FP32_Complex* quotient, const BGC_FP32
{
const float square_modulus = bgc_fp32_complex_get_square_modulus(divisor);
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON) {
return 0;
}
@@ -433,7 +433,7 @@ inline int bgc_fp64_complex_get_ratio(BGC_FP64_Complex* quotient, const BGC_FP64
{
const double square_modulus = bgc_fp64_complex_get_square_modulus(divisor);
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON) {
return 0;
}
@@ -518,11 +518,11 @@ inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* number1, const BGC
const float square_distance = d_real * d_real + d_imaginary * d_imaginary;
- if (square_modulus1 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_distance <= BGC_FP32_SQUARE_EPSYLON;
+ if (square_modulus1 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_distance <= BGC_FP32_SQUARE_EPSILON;
}
- return square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus2;
+ return square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus2;
}
inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
@@ -535,11 +535,11 @@ inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* number1, const BGC
const double square_distance = d_real * d_real + d_imaginary * d_imaginary;
- if (square_modulus1 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_distance <= BGC_FP64_SQUARE_EPSYLON;
+ if (square_modulus1 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_distance <= BGC_FP64_SQUARE_EPSILON;
}
- return square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus2;
+ return square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus2;
}
#endif
diff --git a/basic-geometry/cotes-number.c b/basic-geometry/cotes-number.c
index f7b99a7..610e15b 100644
--- a/basic-geometry/cotes-number.c
+++ b/basic-geometry/cotes-number.c
@@ -62,7 +62,7 @@ void _bgc_fp32_cotes_number_normalize(BGC_FP32_CotesNumber* number)
{
const float square_modulus = number->_cos * number->_cos + number->_sin * number->_sin;
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
number->_cos = 1.0f;
number->_sin = 0.0f;
return;
@@ -78,7 +78,7 @@ void _bgc_fp64_cotes_number_normalize(BGC_FP64_CotesNumber* number)
{
const double square_modulus = number->_cos * number->_cos + number->_sin * number->_sin;
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
number->_cos = 1.0;
number->_sin = 0.0;
return;
diff --git a/basic-geometry/cotes-number.h b/basic-geometry/cotes-number.h
index f40a3d5..f37c000 100644
--- a/basic-geometry/cotes-number.h
+++ b/basic-geometry/cotes-number.h
@@ -250,36 +250,36 @@ inline void bgc_fp64_cotes_number_exclude(BGC_FP64_CotesNumber* difference, cons
inline void bgc_fp32_cotes_number_get_rotation_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number)
{
- matrix->r1c1 = number->_cos;
- matrix->r1c2 = -number->_sin;
- matrix->r2c1 = number->_sin;
- matrix->r2c2 = number->_cos;
+ matrix->row1_col1 = number->_cos;
+ matrix->row1_col2 = -number->_sin;
+ matrix->row2_col1 = number->_sin;
+ matrix->row2_col2 = number->_cos;
}
inline void bgc_fp64_cotes_number_get_rotation_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number)
{
- matrix->r1c1 = number->_cos;
- matrix->r1c2 = -number->_sin;
- matrix->r2c1 = number->_sin;
- matrix->r2c2 = number->_cos;
+ matrix->row1_col1 = number->_cos;
+ matrix->row1_col2 = -number->_sin;
+ matrix->row2_col1 = number->_sin;
+ matrix->row2_col2 = number->_cos;
}
// ============== Reverse Matrix ================ //
inline void bgc_fp32_cotes_number_get_reverse_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number)
{
- matrix->r1c1 = number->_cos;
- matrix->r1c2 = number->_sin;
- matrix->r2c1 = -number->_sin;
- matrix->r2c2 = number->_cos;
+ matrix->row1_col1 = number->_cos;
+ matrix->row1_col2 = number->_sin;
+ matrix->row2_col1 = -number->_sin;
+ matrix->row2_col2 = number->_cos;
}
inline void bgc_fp64_cotes_number_get_reverse_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number)
{
- matrix->r1c1 = number->_cos;
- matrix->r1c2 = number->_sin;
- matrix->r2c1 = -number->_sin;
- matrix->r2c2 = number->_cos;
+ matrix->row1_col1 = number->_cos;
+ matrix->row1_col2 = number->_sin;
+ matrix->row2_col1 = -number->_sin;
+ matrix->row2_col2 = number->_cos;
}
// ================ Turn Vector ================= //
@@ -329,7 +329,7 @@ inline int bgc_fp32_cotes_number_are_close(const BGC_FP32_CotesNumber* number1,
const float d_cos = number1->_cos - number2->_cos;
const float d_sin = number1->_sin - number2->_sin;
- return d_cos * d_cos + d_sin * d_sin <= BGC_FP32_SQUARE_EPSYLON;
+ return d_cos * d_cos + d_sin * d_sin <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_cotes_number_are_close(const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2)
@@ -337,7 +337,7 @@ inline int bgc_fp64_cotes_number_are_close(const BGC_FP64_CotesNumber* number1,
const double d_cos = number1->_cos - number2->_cos;
const double d_sin = number1->_sin - number2->_sin;
- return d_cos * d_cos + d_sin * d_sin <= BGC_FP64_SQUARE_EPSYLON;
+ return d_cos * d_cos + d_sin * d_sin <= BGC_FP64_SQUARE_EPSILON;
}
#endif
diff --git a/basic-geometry/hg-vector3.c b/basic-geometry/hg-vector3.c
new file mode 100644
index 0000000..02d5a59
--- /dev/null
+++ b/basic-geometry/hg-vector3.c
@@ -0,0 +1,28 @@
+#include "./hg-vector3.h"
+
+extern inline void bgc_fp32_hg_vector3_reset_point(BGC_FP32_HgVector3* homogeneous_vector);
+extern inline void bgc_fp64_hg_vector3_reset_point(BGC_FP64_HgVector3* homogeneous_vector);
+
+extern inline void bgc_fp32_hg_vector3_reset_vector(BGC_FP32_HgVector3* homogeneous_vector);
+extern inline void bgc_fp64_hg_vector3_reset_vector(BGC_FP64_HgVector3* homogeneous_vector);
+
+extern inline void bgc_fp32_hg_vector3_make(BGC_FP32_HgVector3* homogeneous_vector, const float x1, const float x2, const float x3, const float ratio);
+extern inline void bgc_fp64_hg_vector3_make(BGC_FP64_HgVector3* homogeneous_vector, const double x1, const double x2, const double x3, const double ratio);
+
+extern inline void bgc_fp32_hg_vector3_make_point(BGC_FP32_HgVector3* homogeneous_vector, const BGC_FP32_Vector3* regular_vector);
+extern inline void bgc_fp64_hg_vector3_make_point(BGC_FP64_HgVector3* homogeneous_vector, const BGC_FP64_Vector3* regular_vector);
+
+extern inline void bgc_fp32_hg_vector3_make_vector(BGC_FP32_HgVector3* homogeneous_vector, const BGC_FP32_Vector3* regular_vector);
+extern inline void bgc_fp64_hg_vector3_make_vector(BGC_FP64_HgVector3* homogeneous_vector, const BGC_FP64_Vector3* regular_vector);
+
+extern inline int bgc_fp32_hg_vector3_is_point(const BGC_FP32_HgVector3* homogeneous_vector);
+extern inline int bgc_fp64_hg_vector3_is_point(const BGC_FP64_HgVector3* homogeneous_vector);
+
+extern inline int bgc_fp32_hg_vector3_is_vector(const BGC_FP32_HgVector3* homogeneous_vector);
+extern inline int bgc_fp64_hg_vector3_is_vector(const BGC_FP64_HgVector3* homogeneous_vector);
+
+extern inline void bgc_fp32_hg_vector3_copy(BGC_FP32_HgVector3* destination, const BGC_FP32_HgVector3* source);
+extern inline void bgc_fp64_hg_vector3_copy(BGC_FP64_HgVector3* destination, const BGC_FP64_HgVector3* source);
+
+extern inline void bgc_fp32_hg_vector3_swap(BGC_FP32_HgVector3* first, BGC_FP32_HgVector3* second);
+extern inline void bgc_fp64_hg_vector3_swap(BGC_FP64_HgVector3* first, BGC_FP64_HgVector3* second);
diff --git a/basic-geometry/hg-vector3.h b/basic-geometry/hg-vector3.h
new file mode 100644
index 0000000..73db4dd
--- /dev/null
+++ b/basic-geometry/hg-vector3.h
@@ -0,0 +1,190 @@
+#ifndef _BGC_HG_VECTOR3_H_INCLUDED_
+#define _BGC_HG_VECTOR3_H_INCLUDED_
+
+#include "./vector3.h"
+
+// ================== Vector3 =================== //
+
+// Homogeneous 3D Vector
+typedef struct
+{
+ float x1, x2, x3, ratio;
+} BGC_FP32_HgVector3;
+
+// Homogeneous 3D Vector
+typedef struct
+{
+ double x1, x2, x3, ratio;
+} BGC_FP64_HgVector3;
+
+// ================ Reset Point ================= //
+
+inline void bgc_fp32_hg_vector3_reset_point(BGC_FP32_HgVector3* homogeneous_vector)
+{
+ homogeneous_vector->x1 = 0.0f;
+ homogeneous_vector->x2 = 0.0f;
+ homogeneous_vector->x3 = 0.0f;
+ homogeneous_vector->ratio = 1.0f;
+}
+
+inline void bgc_fp64_hg_vector3_reset_point(BGC_FP64_HgVector3* homogeneous_vector)
+{
+ homogeneous_vector->x1 = 0.0;
+ homogeneous_vector->x2 = 0.0;
+ homogeneous_vector->x3 = 0.0;
+ homogeneous_vector->ratio = 1.0;
+}
+
+// ================ Reset Point ================= //
+
+inline void bgc_fp32_hg_vector3_reset_vector(BGC_FP32_HgVector3* homogeneous_vector)
+{
+ homogeneous_vector->x1 = 0.0f;
+ homogeneous_vector->x2 = 0.0f;
+ homogeneous_vector->x3 = 0.0f;
+ homogeneous_vector->ratio = 0.0f;
+}
+
+inline void bgc_fp64_hg_vector3_reset_vector(BGC_FP64_HgVector3* homogeneous_vector)
+{
+ homogeneous_vector->x1 = 0.0;
+ homogeneous_vector->x2 = 0.0;
+ homogeneous_vector->x3 = 0.0;
+ homogeneous_vector->ratio = 0.0;
+}
+
+// ==================== Make ==================== //
+
+inline void bgc_fp32_hg_vector3_make(BGC_FP32_HgVector3* homogeneous_vector, const float x1, const float x2, const float x3, const float ratio)
+{
+ homogeneous_vector->x1 = x1;
+ homogeneous_vector->x2 = x2;
+ homogeneous_vector->x3 = x3;
+ homogeneous_vector->ratio = ratio;
+}
+
+inline void bgc_fp64_hg_vector3_make(BGC_FP64_HgVector3* homogeneous_vector, const double x1, const double x2, const double x3, const double ratio)
+{
+ homogeneous_vector->x1 = x1;
+ homogeneous_vector->x2 = x2;
+ homogeneous_vector->x3 = x3;
+ homogeneous_vector->ratio = ratio;
+}
+
+// ================= Make Point ================= //
+
+inline void bgc_fp32_hg_vector3_make_point(BGC_FP32_HgVector3* homogeneous_vector, const BGC_FP32_Vector3* regular_vector)
+{
+ homogeneous_vector->x1 = regular_vector->x1;
+ homogeneous_vector->x2 = regular_vector->x2;
+ homogeneous_vector->x3 = regular_vector->x3;
+ homogeneous_vector->ratio = 1.0f;
+}
+
+inline void bgc_fp64_hg_vector3_make_point(BGC_FP64_HgVector3* homogeneous_vector, const BGC_FP64_Vector3* regular_vector)
+{
+ homogeneous_vector->x1 = regular_vector->x1;
+ homogeneous_vector->x2 = regular_vector->x2;
+ homogeneous_vector->x3 = regular_vector->x3;
+ homogeneous_vector->ratio = 1.0;
+}
+
+// ================ Make Vector ================= //
+
+inline void bgc_fp32_hg_vector3_make_vector(BGC_FP32_HgVector3* homogeneous_vector, const BGC_FP32_Vector3* regular_vector)
+{
+ homogeneous_vector->x1 = regular_vector->x1;
+ homogeneous_vector->x2 = regular_vector->x2;
+ homogeneous_vector->x3 = regular_vector->x3;
+ homogeneous_vector->ratio = 0.0f;
+}
+
+inline void bgc_fp64_hg_vector3_make_vector(BGC_FP64_HgVector3* homogeneous_vector, const BGC_FP64_Vector3* regular_vector)
+{
+ homogeneous_vector->x1 = regular_vector->x1;
+ homogeneous_vector->x2 = regular_vector->x2;
+ homogeneous_vector->x3 = regular_vector->x3;
+ homogeneous_vector->ratio = 0.0;
+}
+
+// ================== Is Point ================== //
+
+inline int bgc_fp32_hg_vector3_is_point(const BGC_FP32_HgVector3* homogeneous_vector)
+{
+ return !bgc_fp32_is_zero(homogeneous_vector->ratio);
+}
+
+inline int bgc_fp64_hg_vector3_is_point(const BGC_FP64_HgVector3* homogeneous_vector)
+{
+ return !bgc_fp64_is_zero(homogeneous_vector->ratio);
+}
+
+// ================= Is Vector ================== //
+
+inline int bgc_fp32_hg_vector3_is_vector(const BGC_FP32_HgVector3* homogeneous_vector)
+{
+ return bgc_fp32_is_zero(homogeneous_vector->ratio);
+}
+
+inline int bgc_fp64_hg_vector3_is_vector(const BGC_FP64_HgVector3* homogeneous_vector)
+{
+ return bgc_fp64_is_zero(homogeneous_vector->ratio);
+}
+
+// ==================== Copy ==================== //
+
+inline void bgc_fp32_hg_vector3_copy(BGC_FP32_HgVector3* destination, const BGC_FP32_HgVector3* source)
+{
+ destination->x1 = source->x1;
+ destination->x2 = source->x2;
+ destination->x3 = source->x3;
+ destination->ratio = source->ratio;
+}
+
+inline void bgc_fp64_hg_vector3_copy(BGC_FP64_HgVector3* destination, const BGC_FP64_HgVector3* source)
+{
+ destination->x1 = source->x1;
+ destination->x2 = source->x2;
+ destination->x3 = source->x3;
+ destination->ratio = source->ratio;
+}
+
+// ==================== Swap ==================== //
+
+inline void bgc_fp32_hg_vector3_swap(BGC_FP32_HgVector3* first, BGC_FP32_HgVector3* second)
+{
+ const float x1 = first->x1;
+ const float x2 = first->x2;
+ const float x3 = first->x3;
+ const float ratio = first->ratio;
+
+ first->x1 = second->x1;
+ first->x2 = second->x2;
+ first->x3 = second->x3;
+ first->ratio = second->ratio;
+
+ second->x1 = x1;
+ second->x2 = x2;
+ second->x3 = x3;
+ second->ratio = ratio;
+}
+
+inline void bgc_fp64_hg_vector3_swap(BGC_FP64_HgVector3* first, BGC_FP64_HgVector3* second)
+{
+ const double x1 = first->x1;
+ const double x2 = first->x2;
+ const double x3 = first->x3;
+ const double ratio = first->ratio;
+
+ first->x1 = second->x1;
+ first->x2 = second->x2;
+ first->x3 = second->x3;
+ first->ratio = second->ratio;
+
+ second->x1 = x1;
+ second->x2 = x2;
+ second->x3 = x3;
+ second->ratio = ratio;
+}
+
+#endif
diff --git a/basic-geometry/matrices.h b/basic-geometry/matrices.h
index 3f2180e..4044b37 100644
--- a/basic-geometry/matrices.h
+++ b/basic-geometry/matrices.h
@@ -4,361 +4,361 @@
// ================== Matrix2x2 ================= //
typedef struct {
- float r1c1, r1c2;
- float r2c1, r2c2;
+ float row1_col1, row1_col2;
+ float row2_col1, row2_col2;
} BGC_FP32_Matrix2x2;
typedef struct {
- double r1c1, r1c2;
- double r2c1, r2c2;
+ double row1_col1, row1_col2;
+ double row2_col1, row2_col2;
} BGC_FP64_Matrix2x2;
// ================== Matrix2x3 ================= //
typedef struct {
- float r1c1, r1c2;
- float r2c1, r2c2;
- float r3c1, r3c2;
+ float row1_col1, row1_col2;
+ float row2_col1, row2_col2;
+ float row3_col1, row3_col2;
} BGC_FP32_Matrix2x3;
typedef struct {
- double r1c1, r1c2;
- double r2c1, r2c2;
- double r3c1, r3c2;
+ double row1_col1, row1_col2;
+ double row2_col1, row2_col2;
+ double row3_col1, row3_col2;
} BGC_FP64_Matrix2x3;
// ================== Matrix3x2 ================= //
typedef struct {
- float r1c1, r1c2, r1c3;
- float r2c1, r2c2, r2c3;
+ float row1_col1, row1_col2, row1_col3;
+ float row2_col1, row2_col2, row2_col3;
} BGC_FP32_Matrix3x2;
typedef struct {
- double r1c1, r1c2, r1c3;
- double r2c1, r2c2, r2c3;
+ double row1_col1, row1_col2, row1_col3;
+ double row2_col1, row2_col2, row2_col3;
} BGC_FP64_Matrix3x2;
// ================== Matrix3x3 ================= //
typedef struct {
- float r1c1, r1c2, r1c3;
- float r2c1, r2c2, r2c3;
- float r3c1, r3c2, r3c3;
+ float row1_col1, row1_col2, row1_col3;
+ float row2_col1, row2_col2, row2_col3;
+ float row3_col1, row3_col2, row3_col3;
} BGC_FP32_Matrix3x3;
typedef struct {
- double r1c1, r1c2, r1c3;
- double r2c1, r2c2, r2c3;
- double r3c1, r3c2, r3c3;
+ double row1_col1, row1_col2, row1_col3;
+ double row2_col1, row2_col2, row2_col3;
+ double row3_col1, row3_col2, row3_col3;
} BGC_FP64_Matrix3x3;
// ========== Matrix Product 2x2 at 2x2 ========= //
inline void bgc_fp32_multiply_matrix2x2_by_matrix2x2(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix2x2* matrix2)
{
- const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
- const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
+ const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
+ const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
- const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
- const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
+ const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
+ const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
}
inline void bgc_fp64_multiply_matrix2x2_by_matrix2x2(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix2x2* matrix2)
{
- const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
- const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
+ const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
+ const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
- const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
- const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
+ const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
+ const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
}
// ========== Matrix Product 2x2 at 3x2 ========= //
inline void bgc_fp32_multiply_matrix2x2_by_matrix3x2(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix3x2* matrix2)
{
- const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
- const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
- const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
+ const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
+ const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
+ const float row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3;
- const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
- const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
- const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
+ const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
+ const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
+ const float row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
- product->r1c3 = r1c3;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
+ product->row1_col3 = row1_col3;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
- product->r2c3 = r2c3;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
+ product->row2_col3 = row2_col3;
}
inline void bgc_fp64_multiply_matrix2x2_by_matrix3x2(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix3x2* matrix2)
{
- const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
- const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
- const double r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
+ const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
+ const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
+ const double row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3;
- const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
- const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
- const double r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
+ const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
+ const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
+ const double row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
- product->r1c3 = r1c3;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
+ product->row1_col3 = row1_col3;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
- product->r2c3 = r2c3;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
+ product->row2_col3 = row2_col3;
}
// ========== Matrix Product 2x3 at 2x2 ========= //
inline void bgc_fp32_multiply_matrix2x3_by_matrix2x2(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix2x2* matrix2)
{
- const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
- const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
+ const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
+ const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
- const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
- const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
+ const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
+ const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
- const float r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
- const float r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
+ const float row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1;
+ const float row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
- product->r3c1 = r3c1;
- product->r3c2 = r3c2;
+ product->row3_col1 = row3_col1;
+ product->row3_col2 = row3_col2;
}
inline void bgc_fp64_multiply_matrix2x3_by_matrix2x2(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix2x2* matrix2)
{
- const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
- const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
+ const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
+ const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
- const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
- const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
+ const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
+ const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
- const double r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
- const double r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
+ const double row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1;
+ const double row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
- product->r3c1 = r3c1;
- product->r3c2 = r3c2;
+ product->row3_col1 = row3_col1;
+ product->row3_col2 = row3_col2;
}
// ========== Matrix Product 2x3 at 3x2 ========= //
inline void bgc_fp32_multiply_matrix2x3_by_matrix3x2(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix3x2* matrix2)
{
- product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
- product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
- product->r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
+ product->row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
+ product->row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
+ product->row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3;
- product->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
- product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
- product->r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
+ product->row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
+ product->row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
+ product->row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3;
- product->r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
- product->r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
- product->r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3;
+ product->row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1;
+ product->row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2;
+ product->row3_col3 = matrix1->row3_col1 * matrix2->row1_col3 + matrix1->row3_col2 * matrix2->row2_col3;
}
inline void bgc_fp64_multiply_matrix2x3_by_matrix3x2(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix3x2* matrix2)
{
- product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
- product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
- product->r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
+ product->row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
+ product->row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
+ product->row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3;
- product->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
- product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
- product->r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
+ product->row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
+ product->row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
+ product->row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3;
- product->r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
- product->r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
- product->r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3;
+ product->row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1;
+ product->row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2;
+ product->row3_col3 = matrix1->row3_col1 * matrix2->row1_col3 + matrix1->row3_col2 * matrix2->row2_col3;
}
// ========== Matrix Product 3x2 at 2x3 ========= //
inline void bgc_fp32_multiply_matrix3x2_by_matrix2x3(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix2x3* matrix2)
{
- product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
- product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
+ product->row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
+ product->row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
- product->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
- product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
+ product->row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
+ product->row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
}
inline void bgc_fp64_multiply_matrix3x2_by_matrix2x3(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix2x3* matrix2)
{
- product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
- product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
+ product->row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
+ product->row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
- product->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
- product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
+ product->row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
+ product->row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
}
// ========== Matrix Product 3x2 at 3x3 ========= //
inline void bgc_fp32_multiply_matrix3x2_by_matrix3x3(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix3x3* matrix2)
{
- const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
- const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
- const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
+ const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
+ const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
+ const float row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3 + matrix1->row1_col3 * matrix2->row3_col3;
- const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
- const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
- const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
+ const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
+ const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
+ const float row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3 + matrix1->row2_col3 * matrix2->row3_col3;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
- product->r1c3 = r1c3;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
+ product->row1_col3 = row1_col3;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
- product->r2c3 = r2c3;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
+ product->row2_col3 = row2_col3;
}
inline void bgc_fp64_multiply_matrix3x2_by_matrix3x3(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix3x3* matrix2)
{
- const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
- const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
- const double r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
+ const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
+ const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
+ const double row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3 + matrix1->row1_col3 * matrix2->row3_col3;
- const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
- const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
- const double r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
+ const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
+ const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
+ const double row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3 + matrix1->row2_col3 * matrix2->row3_col3;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
- product->r1c3 = r1c3;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
+ product->row1_col3 = row1_col3;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
- product->r2c3 = r2c3;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
+ product->row2_col3 = row2_col3;
}
// ========== Matrix Product 3x3 at 2x3 ========= //
inline void bgc_fp32_multiply_matrix3x3_by_matrix2x3(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix2x3* matrix2)
{
- const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
- const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
+ const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
+ const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
- const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
- const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
+ const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
+ const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
- const float r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
- const float r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
+ const float row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1 + matrix1->row3_col3 * matrix2->row3_col1;
+ const float row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2 + matrix1->row3_col3 * matrix2->row3_col2;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
- product->r3c1 = r3c1;
- product->r3c2 = r3c2;
+ product->row3_col1 = row3_col1;
+ product->row3_col2 = row3_col2;
}
inline void bgc_fp64_multiply_matrix3x3_by_matrix2x3(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix2x3* matrix2)
{
- const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
- const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
+ const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
+ const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
- const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
- const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
+ const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
+ const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
- const double r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
- const double r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
+ const double row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1 + matrix1->row3_col3 * matrix2->row3_col1;
+ const double row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2 + matrix1->row3_col3 * matrix2->row3_col2;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
- product->r3c1 = r3c1;
- product->r3c2 = r3c2;
+ product->row3_col1 = row3_col1;
+ product->row3_col2 = row3_col2;
}
// ========== Matrix Product 3x3 at 3x3 ========= //
inline void bgc_fp32_multiply_matrix3x3_by_matrix3x3(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix3x3* matrix2)
{
- const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
- const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
- const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
+ const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
+ const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
+ const float row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3 + matrix1->row1_col3 * matrix2->row3_col3;
- const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
- const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
- const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
+ const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
+ const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
+ const float row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3 + matrix1->row2_col3 * matrix2->row3_col3;
- const float r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
- const float r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
- const float r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3 + matrix1->r3c3 * matrix2->r3c3;
+ const float row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1 + matrix1->row3_col3 * matrix2->row3_col1;
+ const float row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2 + matrix1->row3_col3 * matrix2->row3_col2;
+ const float row3_col3 = matrix1->row3_col1 * matrix2->row1_col3 + matrix1->row3_col2 * matrix2->row2_col3 + matrix1->row3_col3 * matrix2->row3_col3;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
- product->r1c3 = r1c3;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
+ product->row1_col3 = row1_col3;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
- product->r2c3 = r2c3;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
+ product->row2_col3 = row2_col3;
- product->r3c1 = r3c1;
- product->r3c2 = r3c2;
- product->r3c3 = r3c3;
+ product->row3_col1 = row3_col1;
+ product->row3_col2 = row3_col2;
+ product->row3_col3 = row3_col3;
}
inline void bgc_fp64_multiply_matrix3x3_by_matrix3x3(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix3x3* matrix2)
{
- const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
- const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
- const double r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
+ const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
+ const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
+ const double row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3 + matrix1->row1_col3 * matrix2->row3_col3;
- const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
- const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
- const double r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
+ const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
+ const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
+ const double row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3 + matrix1->row2_col3 * matrix2->row3_col3;
- const double r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
- const double r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
- const double r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3 + matrix1->r3c3 * matrix2->r3c3;
+ const double row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1 + matrix1->row3_col3 * matrix2->row3_col1;
+ const double row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2 + matrix1->row3_col3 * matrix2->row3_col2;
+ const double row3_col3 = matrix1->row3_col1 * matrix2->row1_col3 + matrix1->row3_col2 * matrix2->row2_col3 + matrix1->row3_col3 * matrix2->row3_col3;
- product->r1c1 = r1c1;
- product->r1c2 = r1c2;
- product->r1c3 = r1c3;
+ product->row1_col1 = row1_col1;
+ product->row1_col2 = row1_col2;
+ product->row1_col3 = row1_col3;
- product->r2c1 = r2c1;
- product->r2c2 = r2c2;
- product->r2c3 = r2c3;
+ product->row2_col1 = row2_col1;
+ product->row2_col2 = row2_col2;
+ product->row2_col3 = row2_col3;
- product->r3c1 = r3c1;
- product->r3c2 = r3c2;
- product->r3c3 = r3c3;
+ product->row3_col1 = row3_col1;
+ product->row3_col2 = row3_col2;
+ product->row3_col3 = row3_col3;
}
#endif // _BGC_MATRIX_TYPES_H_
diff --git a/basic-geometry/matrix2x2.h b/basic-geometry/matrix2x2.h
index f84d444..941a84b 100644
--- a/basic-geometry/matrix2x2.h
+++ b/basic-geometry/matrix2x2.h
@@ -9,54 +9,54 @@
inline void bgc_fp32_matrix2x2_reset(BGC_FP32_Matrix2x2* matrix)
{
- matrix->r1c1 = 0.0f;
- matrix->r1c2 = 0.0f;
- matrix->r2c1 = 0.0f;
- matrix->r2c2 = 0.0f;
+ matrix->row1_col1 = 0.0f;
+ matrix->row1_col2 = 0.0f;
+ matrix->row2_col1 = 0.0f;
+ matrix->row2_col2 = 0.0f;
}
inline void bgc_fp64_matrix2x2_reset(BGC_FP64_Matrix2x2* matrix)
{
- matrix->r1c1 = 0.0;
- matrix->r1c2 = 0.0;
- matrix->r2c1 = 0.0;
- matrix->r2c2 = 0.0;
+ matrix->row1_col1 = 0.0;
+ matrix->row1_col2 = 0.0;
+ matrix->row2_col1 = 0.0;
+ matrix->row2_col2 = 0.0;
}
// ================== Identity ================== //
inline void bgc_fp32_matrix2x2_make_identity(BGC_FP32_Matrix2x2* matrix)
{
- matrix->r1c1 = 1.0f;
- matrix->r1c2 = 0.0f;
- matrix->r2c1 = 0.0f;
- matrix->r2c2 = 1.0f;
+ matrix->row1_col1 = 1.0f;
+ matrix->row1_col2 = 0.0f;
+ matrix->row2_col1 = 0.0f;
+ matrix->row2_col2 = 1.0f;
}
inline void bgc_fp64_matrix2x2_make_identity(BGC_FP64_Matrix2x2* matrix)
{
- matrix->r1c1 = 1.0;
- matrix->r1c2 = 0.0;
- matrix->r2c1 = 0.0;
- matrix->r2c2 = 1.0;
+ matrix->row1_col1 = 1.0;
+ matrix->row1_col2 = 0.0;
+ matrix->row2_col1 = 0.0;
+ matrix->row2_col2 = 1.0;
}
// ================ Set Diagonal ================ //
inline void bgc_fp32_matrix2x2_make_diagonal(BGC_FP32_Matrix2x2* matrix, const float d1, const float d2)
{
- matrix->r1c1 = d1;
- matrix->r1c2 = 0.0f;
- matrix->r2c1 = 0.0f;
- matrix->r2c2 = d2;
+ matrix->row1_col1 = d1;
+ matrix->row1_col2 = 0.0f;
+ matrix->row2_col1 = 0.0f;
+ matrix->row2_col2 = d2;
}
inline void bgc_fp64_matrix2x2_make_diagonal(BGC_FP64_Matrix2x2* matrix, const double d1, const double d2)
{
- matrix->r1c1 = d1;
- matrix->r1c2 = 0.0;
- matrix->r2c1 = 0.0;
- matrix->r2c2 = d2;
+ matrix->row1_col1 = d1;
+ matrix->row1_col2 = 0.0;
+ matrix->row2_col1 = 0.0;
+ matrix->row2_col2 = d2;
}
// ============== Rotation Matrix =============== //
@@ -67,10 +67,10 @@ inline void bgc_fp32_matrix2x2_make_for_turn(BGC_FP32_Matrix2x2* matrix, const f
const float cosine = cosf(radians);
const float sine = sinf(radians);
- matrix->r1c1 = cosine;
- matrix->r1c2 = -sine;
- matrix->r2c1 = sine;
- matrix->r2c2 = cosine;
+ matrix->row1_col1 = cosine;
+ matrix->row1_col2 = -sine;
+ matrix->row2_col1 = sine;
+ matrix->row2_col2 = cosine;
}
inline void bgc_fp64_matrix2x2_make_for_turn(BGC_FP64_Matrix2x2* matrix, const double angle, const int angle_unit)
@@ -79,36 +79,36 @@ inline void bgc_fp64_matrix2x2_make_for_turn(BGC_FP64_Matrix2x2* matrix, const d
const double cosine = cos(radians);
const double sine = sin(radians);
- matrix->r1c1 = cosine;
- matrix->r1c2 = -sine;
- matrix->r2c1 = sine;
- matrix->r2c2 = cosine;
+ matrix->row1_col1 = cosine;
+ matrix->row1_col2 = -sine;
+ matrix->row2_col1 = sine;
+ matrix->row2_col2 = cosine;
}
// ================ Determinant ================= //
inline float bgc_fp32_matrix2x2_get_determinant(const BGC_FP32_Matrix2x2* matrix)
{
- return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
+ return matrix->row1_col1 * matrix->row2_col2 - matrix->row1_col2 * matrix->row2_col1;
}
inline double bgc_fp64_matrix2x2_get_determinant(const BGC_FP64_Matrix2x2* matrix)
{
- return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
+ return matrix->row1_col1 * matrix->row2_col2 - matrix->row1_col2 * matrix->row2_col1;
}
// ================ Is Identity ================= //
inline int bgc_fp32_matrix2x2_is_identity(const BGC_FP32_Matrix2x2* matrix)
{
- return bgc_fp32_is_unit(matrix->r1c1) && bgc_fp32_is_zero(matrix->r1c2)
- && bgc_fp32_is_zero(matrix->r2c1) && bgc_fp32_is_unit(matrix->r2c2);
+ return bgc_fp32_is_unit(matrix->row1_col1) && bgc_fp32_is_zero(matrix->row1_col2)
+ && bgc_fp32_is_zero(matrix->row2_col1) && bgc_fp32_is_unit(matrix->row2_col2);
}
inline int bgc_fp64_matrix2x2_is_identity(const BGC_FP64_Matrix2x2* matrix)
{
- return bgc_fp64_is_unit(matrix->r1c1) && bgc_fp64_is_zero(matrix->r1c2)
- && bgc_fp64_is_zero(matrix->r2c1) && bgc_fp64_is_unit(matrix->r2c2);
+ return bgc_fp64_is_unit(matrix->row1_col1) && bgc_fp64_is_zero(matrix->row1_col2)
+ && bgc_fp64_is_zero(matrix->row2_col1) && bgc_fp64_is_unit(matrix->row2_col2);
}
// ================ Is Singular ================= //
@@ -129,11 +129,11 @@ inline int bgc_fp32_matrix2x2_is_rotation(const BGC_FP32_Matrix2x2* matrix)
{
BGC_FP32_Matrix2x2 product;
- product.r1c1 = matrix->r1c1 * matrix->r1c1 + matrix->r1c2 * matrix->r2c1;
- product.r1c2 = matrix->r1c1 * matrix->r1c2 + matrix->r1c2 * matrix->r2c2;
+ product.row1_col1 = matrix->row1_col1 * matrix->row1_col1 + matrix->row1_col2 * matrix->row2_col1;
+ product.row1_col2 = matrix->row1_col1 * matrix->row1_col2 + matrix->row1_col2 * matrix->row2_col2;
- product.r2c1 = matrix->r2c1 * matrix->r1c1 + matrix->r2c2 * matrix->r2c1;
- product.r2c2 = matrix->r2c1 * matrix->r1c2 + matrix->r2c2 * matrix->r2c2;
+ product.row2_col1 = matrix->row2_col1 * matrix->row1_col1 + matrix->row2_col2 * matrix->row2_col1;
+ product.row2_col2 = matrix->row2_col1 * matrix->row1_col2 + matrix->row2_col2 * matrix->row2_col2;
return bgc_fp32_matrix2x2_is_identity(&product);
}
@@ -142,11 +142,11 @@ inline int bgc_fp64_matrix2x2_is_rotation(const BGC_FP64_Matrix2x2* matrix)
{
BGC_FP64_Matrix2x2 product;
- product.r1c1 = matrix->r1c1 * matrix->r1c1 + matrix->r1c2 * matrix->r2c1;
- product.r1c2 = matrix->r1c1 * matrix->r1c2 + matrix->r1c2 * matrix->r2c2;
+ product.row1_col1 = matrix->row1_col1 * matrix->row1_col1 + matrix->row1_col2 * matrix->row2_col1;
+ product.row1_col2 = matrix->row1_col1 * matrix->row1_col2 + matrix->row1_col2 * matrix->row2_col2;
- product.r2c1 = matrix->r2c1 * matrix->r1c1 + matrix->r2c2 * matrix->r2c1;
- product.r2c2 = matrix->r2c1 * matrix->r1c2 + matrix->r2c2 * matrix->r2c2;
+ product.row2_col1 = matrix->row2_col1 * matrix->row1_col1 + matrix->row2_col2 * matrix->row2_col1;
+ product.row2_col2 = matrix->row2_col1 * matrix->row1_col2 + matrix->row2_col2 * matrix->row2_col2;
return bgc_fp64_matrix2x2_is_identity(&product);
}
@@ -155,84 +155,84 @@ inline int bgc_fp64_matrix2x2_is_rotation(const BGC_FP64_Matrix2x2* matrix)
inline void bgc_fp32_matrix2x2_copy(BGC_FP32_Matrix2x2* destination, const BGC_FP32_Matrix2x2* 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;
}
inline void bgc_fp64_matrix2x2_copy(BGC_FP64_Matrix2x2* destination, const BGC_FP64_Matrix2x2* 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;
}
// ==================== Swap ==================== //
inline void bgc_fp32_matrix2x2_swap(BGC_FP32_Matrix2x2* matrix1, BGC_FP32_Matrix2x2* 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;
- 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;
- 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;
}
inline void bgc_fp64_matrix2x2_swap(BGC_FP64_Matrix2x2* matrix1, BGC_FP64_Matrix2x2* 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;
- 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;
- 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;
}
// ================== Convert =================== //
inline void bgc_fp64_matrix2x2_convert_to_fp32(BGC_FP32_Matrix2x2* destination, const BGC_FP64_Matrix2x2* 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;
}
inline void bgc_fp32_matrix2x2_convert_to_fp64(BGC_FP64_Matrix2x2* destination, const BGC_FP32_Matrix2x2* 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;
}
// ================ Get Inverse ================= //
@@ -245,19 +245,19 @@ inline int bgc_fp32_matrix2x2_get_inverse(BGC_FP32_Matrix2x2* inverse, const BGC
return 0;
}
- const float r1c1 = matrix->r2c2;
- const float r1c2 = -matrix->r1c2;
+ const float row1_col1 = matrix->row2_col2;
+ const float row1_col2 = -matrix->row1_col2;
- const float r2c1 = -matrix->r2c1;
- const float r2c2 = matrix->r1c1;
+ const float row2_col1 = -matrix->row2_col1;
+ const float row2_col2 = matrix->row1_col1;
const float multiplier = 1.0f / determinant;
- inverse->r1c1 = r1c1 * multiplier;
- inverse->r1c2 = r1c2 * multiplier;
+ inverse->row1_col1 = row1_col1 * multiplier;
+ inverse->row1_col2 = row1_col2 * multiplier;
- inverse->r2c1 = r2c1 * multiplier;
- inverse->r2c2 = r2c2 * multiplier;
+ inverse->row2_col1 = row2_col1 * multiplier;
+ inverse->row2_col2 = row2_col2 * multiplier;
return 1;
}
@@ -270,19 +270,19 @@ inline int bgc_fp64_matrix2x2_get_inverse(BGC_FP64_Matrix2x2* inverse, const BGC
return 0;
}
- const double r1c1 = matrix->r2c2;
- const double r1c2 = -matrix->r1c2;
+ const double row1_col1 = matrix->row2_col2;
+ const double row1_col2 = -matrix->row1_col2;
- const double r2c1 = -matrix->r2c1;
- const double r2c2 = matrix->r1c1;
+ const double row2_col1 = -matrix->row2_col1;
+ const double row2_col2 = matrix->row1_col1;
const double multiplier = 1.0 / determinant;
- inverse->r1c1 = r1c1 * multiplier;
- inverse->r1c2 = r1c2 * multiplier;
+ inverse->row1_col1 = row1_col1 * multiplier;
+ inverse->row1_col2 = row1_col2 * multiplier;
- inverse->r2c1 = r2c1 * multiplier;
- inverse->r2c2 = r2c2 * multiplier;
+ inverse->row2_col1 = row2_col1 * multiplier;
+ inverse->row2_col2 = row2_col2 * multiplier;
return 1;
}
@@ -303,40 +303,40 @@ inline int bgc_fp64_matrix2x2_invert(BGC_FP64_Matrix2x2* matrix)
inline void bgc_fp32_matrix2x2_transpose(BGC_FP32_Matrix2x2* matrix)
{
- const float r1c2 = matrix->r1c2;
- matrix->r1c2 = matrix->r2c1;
- matrix->r2c1 = r1c2;
+ const float row1_col2 = matrix->row1_col2;
+ matrix->row1_col2 = matrix->row2_col1;
+ matrix->row2_col1 = row1_col2;
}
inline void bgc_fp64_matrix2x2_transpose(BGC_FP64_Matrix2x2* matrix)
{
- const double r1c2 = matrix->r1c2;
- matrix->r1c2 = matrix->r2c1;
- matrix->r2c1 = r1c2;
+ const double row1_col2 = matrix->row1_col2;
+ matrix->row1_col2 = matrix->row2_col1;
+ matrix->row2_col1 = row1_col2;
}
// =============== Get Transpose ================ //
inline void bgc_fp32_matrix2x2_get_transposed(BGC_FP32_Matrix2x2* transposed, const BGC_FP32_Matrix2x2* matrix)
{
- const float r1c2 = matrix->r1c2;
+ const float row1_col2 = matrix->row1_col2;
- transposed->r1c1 = matrix->r1c1;
- transposed->r1c2 = matrix->r2c1;
+ transposed->row1_col1 = matrix->row1_col1;
+ transposed->row1_col2 = matrix->row2_col1;
- transposed->r2c1 = r1c2;
- transposed->r2c2 = matrix->r2c2;
+ transposed->row2_col1 = row1_col2;
+ transposed->row2_col2 = matrix->row2_col2;
}
inline void bgc_fp64_matrix2x2_get_transposed(BGC_FP64_Matrix2x2* transposed, const BGC_FP64_Matrix2x2* matrix)
{
- const double r1c2 = matrix->r1c2;
+ const double row1_col2 = matrix->row1_col2;
- transposed->r1c1 = matrix->r1c1;
- transposed->r1c2 = matrix->r2c1;
+ transposed->row1_col1 = matrix->row1_col1;
+ transposed->row1_col2 = matrix->row2_col1;
- transposed->r2c1 = r1c2;
- transposed->r2c2 = matrix->r2c2;
+ transposed->row2_col1 = row1_col2;
+ transposed->row2_col2 = matrix->row2_col2;
}
// ================== Get Row =================== //
@@ -344,14 +344,14 @@ inline void bgc_fp64_matrix2x2_get_transposed(BGC_FP64_Matrix2x2* transposed, co
inline void bgc_fp32_matrix2x2_get_row(BGC_FP32_Vector2* row, const BGC_FP32_Matrix2x2* 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;
}
@@ -362,14 +362,14 @@ inline void bgc_fp32_matrix2x2_get_row(BGC_FP32_Vector2* row, const BGC_FP32_Mat
inline void bgc_fp64_matrix2x2_get_row(BGC_FP64_Vector2* row, const BGC_FP64_Matrix2x2* 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;
}
@@ -382,28 +382,28 @@ inline void bgc_fp64_matrix2x2_get_row(BGC_FP64_Vector2* row, const BGC_FP64_Mat
inline void bgc_fp32_matrix2x2_set_row(BGC_FP32_Matrix2x2* 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;
}
}
inline void bgc_fp64_matrix2x2_set_row(BGC_FP64_Matrix2x2* 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;
}
}
@@ -412,14 +412,14 @@ inline void bgc_fp64_matrix2x2_set_row(BGC_FP64_Matrix2x2* matrix, const int row
inline void bgc_fp32_matrix2x2_get_column(BGC_FP32_Vector2* column, const BGC_FP32_Matrix2x2* matrix, const int column_number)
{
if (column_number == 1) {
- column->x1 = matrix->r1c1;
- column->x2 = matrix->r2c1;
+ column->x1 = matrix->row1_col1;
+ column->x2 = matrix->row2_col1;
return;
}
if (column_number == 2) {
- column->x1 = matrix->r1c2;
- column->x2 = matrix->r2c2;
+ column->x1 = matrix->row1_col2;
+ column->x2 = matrix->row2_col2;
return;
}
@@ -430,14 +430,14 @@ inline void bgc_fp32_matrix2x2_get_column(BGC_FP32_Vector2* column, const BGC_FP
inline void bgc_fp64_matrix2x2_get_column(BGC_FP64_Vector2* column, const BGC_FP64_Matrix2x2* matrix, const int column_number)
{
if (column_number == 1) {
- column->x1 = matrix->r1c1;
- column->x2 = matrix->r2c1;
+ column->x1 = matrix->row1_col1;
+ column->x2 = matrix->row2_col1;
return;
}
if (column_number == 2) {
- column->x1 = matrix->r1c2;
- column->x2 = matrix->r2c2;
+ column->x1 = matrix->row1_col2;
+ column->x2 = matrix->row2_col2;
return;
}
@@ -450,28 +450,28 @@ inline void bgc_fp64_matrix2x2_get_column(BGC_FP64_Vector2* column, const BGC_FP
inline void bgc_fp32_matrix2x2_set_column(BGC_FP32_Matrix2x2* matrix, const int column_number, const BGC_FP32_Vector2* column)
{
if (column_number == 1) {
- matrix->r1c1 = column->x1;
- matrix->r2c1 = column->x2;
+ matrix->row1_col1 = column->x1;
+ matrix->row2_col1 = column->x2;
return;
}
if (column_number == 2) {
- matrix->r1c2 = column->x1;
- matrix->r2c2 = column->x2;
+ matrix->row1_col2 = column->x1;
+ matrix->row2_col2 = column->x2;
}
}
inline void bgc_fp64_matrix2x2_set_column(BGC_FP64_Matrix2x2* matrix, const int column_number, const BGC_FP64_Vector2* column)
{
if (column_number == 1) {
- matrix->r1c1 = column->x1;
- matrix->r2c1 = column->x2;
+ matrix->row1_col1 = column->x1;
+ matrix->row2_col1 = column->x2;
return;
}
if (column_number == 2) {
- matrix->r1c2 = column->x1;
- matrix->r2c2 = column->x2;
+ matrix->row1_col2 = column->x1;
+ matrix->row2_col2 = column->x2;
}
}
@@ -479,80 +479,80 @@ inline void bgc_fp64_matrix2x2_set_column(BGC_FP64_Matrix2x2* matrix, const int
inline void bgc_fp32_matrix2x2_add(BGC_FP32_Matrix2x2* sum, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix2x2* matrix2)
{
- sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
- sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
+ sum->row1_col1 = matrix1->row1_col1 + matrix2->row1_col1;
+ sum->row1_col2 = matrix1->row1_col2 + matrix2->row1_col2;
- sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
- sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
+ sum->row2_col1 = matrix1->row2_col1 + matrix2->row2_col1;
+ sum->row2_col2 = matrix1->row2_col2 + matrix2->row2_col2;
}
inline void bgc_fp64_matrix2x2_add(BGC_FP64_Matrix2x2* sum, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix2x2* matrix2)
{
- sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
- sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
+ sum->row1_col1 = matrix1->row1_col1 + matrix2->row1_col1;
+ sum->row1_col2 = matrix1->row1_col2 + matrix2->row1_col2;
- sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
- sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
+ sum->row2_col1 = matrix1->row2_col1 + matrix2->row2_col1;
+ sum->row2_col2 = matrix1->row2_col2 + matrix2->row2_col2;
}
// ================= Add scaled ================= //
inline void bgc_fp32_matrix2x2_add_scaled(BGC_FP32_Matrix2x2* sum, const BGC_FP32_Matrix2x2* basic_matrix, const BGC_FP32_Matrix2x2* scalable_matrix, const float scale)
{
- sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
- sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
+ sum->row1_col1 = basic_matrix->row1_col1 + scalable_matrix->row1_col1 * scale;
+ sum->row1_col2 = basic_matrix->row1_col2 + scalable_matrix->row1_col2 * scale;
- sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
- sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
+ sum->row2_col1 = basic_matrix->row2_col1 + scalable_matrix->row2_col1 * scale;
+ sum->row2_col2 = basic_matrix->row2_col2 + scalable_matrix->row2_col2 * scale;
}
inline void bgc_fp64_matrix2x2_add_scaled(BGC_FP64_Matrix2x2* sum, const BGC_FP64_Matrix2x2* basic_matrix, const BGC_FP64_Matrix2x2* scalable_matrix, const double scale)
{
- sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
- sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
+ sum->row1_col1 = basic_matrix->row1_col1 + scalable_matrix->row1_col1 * scale;
+ sum->row1_col2 = basic_matrix->row1_col2 + scalable_matrix->row1_col2 * scale;
- sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
- sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
+ sum->row2_col1 = basic_matrix->row2_col1 + scalable_matrix->row2_col1 * scale;
+ sum->row2_col2 = basic_matrix->row2_col2 + scalable_matrix->row2_col2 * scale;
}
// ================== Subtract ================== //
inline void bgc_fp32_matrix2x2_subtract(BGC_FP32_Matrix2x2* difference, const BGC_FP32_Matrix2x2* minuend, const BGC_FP32_Matrix2x2* subtrahend)
{
- difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
- difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
+ difference->row1_col1 = minuend->row1_col1 - subtrahend->row1_col1;
+ difference->row1_col2 = minuend->row1_col2 - subtrahend->row1_col2;
- difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
- difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
+ difference->row2_col1 = minuend->row2_col1 - subtrahend->row2_col1;
+ difference->row2_col2 = minuend->row2_col2 - subtrahend->row2_col2;
}
inline void bgc_fp64_matrix2x2_subtract(BGC_FP64_Matrix2x2* difference, const BGC_FP64_Matrix2x2* minuend, const BGC_FP64_Matrix2x2* subtrahend)
{
- difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
- difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
+ difference->row1_col1 = minuend->row1_col1 - subtrahend->row1_col1;
+ difference->row1_col2 = minuend->row1_col2 - subtrahend->row1_col2;
- difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
- difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
+ difference->row2_col1 = minuend->row2_col1 - subtrahend->row2_col1;
+ difference->row2_col2 = minuend->row2_col2 - subtrahend->row2_col2;
}
// ================== Multiply ================== //
inline void bgc_fp32_matrix2x2_multiply(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix2x2* multiplicand, const float multiplier)
{
- product->r1c1 = multiplicand->r1c1 * multiplier;
- product->r1c2 = multiplicand->r1c2 * multiplier;
+ product->row1_col1 = multiplicand->row1_col1 * multiplier;
+ product->row1_col2 = multiplicand->row1_col2 * multiplier;
- product->r2c1 = multiplicand->r2c1 * multiplier;
- product->r2c2 = multiplicand->r2c2 * multiplier;
+ product->row2_col1 = multiplicand->row2_col1 * multiplier;
+ product->row2_col2 = multiplicand->row2_col2 * multiplier;
}
inline void bgc_fp64_matrix2x2_multiply(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix2x2* multiplicand, const double multiplier)
{
- product->r1c1 = multiplicand->r1c1 * multiplier;
- product->r1c2 = multiplicand->r1c2 * multiplier;
+ product->row1_col1 = multiplicand->row1_col1 * multiplier;
+ product->row1_col2 = multiplicand->row1_col2 * multiplier;
- product->r2c1 = multiplicand->r2c1 * multiplier;
- product->r2c2 = multiplicand->r2c2 * multiplier;
+ product->row2_col1 = multiplicand->row2_col1 * multiplier;
+ product->row2_col2 = multiplicand->row2_col2 * multiplier;
}
// =================== Divide =================== //
@@ -573,30 +573,30 @@ inline void bgc_fp32_matrix2x2_interpolate(BGC_FP32_Matrix2x2* interpolation, co
{
const float counter_phase = 1.0f - phase;
- interpolation->r1c1 = first->r1c1 * counter_phase + second->r1c1 * phase;
- interpolation->r1c2 = first->r1c2 * counter_phase + second->r1c2 * phase;
+ interpolation->row1_col1 = first->row1_col1 * counter_phase + second->row1_col1 * phase;
+ interpolation->row1_col2 = first->row1_col2 * counter_phase + second->row1_col2 * phase;
- interpolation->r2c1 = first->r2c1 * counter_phase + second->r2c1 * phase;
- interpolation->r2c2 = first->r2c2 * counter_phase + second->r2c2 * phase;
+ interpolation->row2_col1 = first->row2_col1 * counter_phase + second->row2_col1 * phase;
+ interpolation->row2_col2 = first->row2_col2 * counter_phase + second->row2_col2 * phase;
}
inline void bgc_fp64_matrix2x2_interpolate(BGC_FP64_Matrix2x2* interpolation, const BGC_FP64_Matrix2x2* first, const BGC_FP64_Matrix2x2* second, const double phase)
{
const double counter_phase = 1.0 - phase;
- interpolation->r1c1 = first->r1c1 * counter_phase + second->r1c1 * phase;
- interpolation->r1c2 = first->r1c2 * counter_phase + second->r1c2 * phase;
+ interpolation->row1_col1 = first->row1_col1 * counter_phase + second->row1_col1 * phase;
+ interpolation->row1_col2 = first->row1_col2 * counter_phase + second->row1_col2 * phase;
- interpolation->r2c1 = first->r2c1 * counter_phase + second->r2c1 * phase;
- interpolation->r2c2 = first->r2c2 * counter_phase + second->r2c2 * phase;
+ interpolation->row2_col1 = first->row2_col1 * counter_phase + second->row2_col1 * phase;
+ interpolation->row2_col2 = first->row2_col2 * counter_phase + second->row2_col2 * phase;
}
// ============ Right Vector Product ============ //
inline void bgc_fp32_multiply_matrix2x2_by_vector2(BGC_FP32_Vector2* product, const BGC_FP32_Matrix2x2* matrix, const BGC_FP32_Vector2* vector)
{
- const float x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
- const float x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
+ const float x1 = matrix->row1_col1 * vector->x1 + matrix->row1_col2 * vector->x2;
+ const float x2 = matrix->row2_col1 * vector->x1 + matrix->row2_col2 * vector->x2;
product->x1 = x1;
product->x2 = x2;
@@ -604,8 +604,8 @@ inline void bgc_fp32_multiply_matrix2x2_by_vector2(BGC_FP32_Vector2* product, co
inline void bgc_fp64_multiply_matrix2x2_by_vector2(BGC_FP64_Vector2* product, const BGC_FP64_Matrix2x2* matrix, const BGC_FP64_Vector2* vector)
{
- const double x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
- const double x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
+ const double x1 = matrix->row1_col1 * vector->x1 + matrix->row1_col2 * vector->x2;
+ const double x2 = matrix->row2_col1 * vector->x1 + matrix->row2_col2 * vector->x2;
product->x1 = x1;
product->x2 = x2;
@@ -615,8 +615,8 @@ inline void bgc_fp64_multiply_matrix2x2_by_vector2(BGC_FP64_Vector2* product, co
inline void bgc_fp32_multiply_vector2_by_matrix2x2(BGC_FP32_Vector2* product, const BGC_FP32_Vector2* vector, const BGC_FP32_Matrix2x2* matrix)
{
- const float x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
- const float x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
+ const float x1 = vector->x1 * matrix->row1_col1 + vector->x2 * matrix->row2_col1;
+ const float x2 = vector->x1 * matrix->row1_col2 + vector->x2 * matrix->row2_col2;
product->x1 = x1;
product->x2 = x2;
@@ -624,8 +624,8 @@ inline void bgc_fp32_multiply_vector2_by_matrix2x2(BGC_FP32_Vector2* product, co
inline void bgc_fp64_multiply_vector2_by_matrix2x2(BGC_FP64_Vector2* product, const BGC_FP64_Vector2* vector, const BGC_FP64_Matrix2x2* matrix)
{
- const double x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
- const double x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
+ const double x1 = vector->x1 * matrix->row1_col1 + vector->x2 * matrix->row2_col1;
+ const double x2 = vector->x1 * matrix->row1_col2 + vector->x2 * matrix->row2_col2;
product->x1 = x1;
product->x2 = x2;
diff --git a/basic-geometry/matrix2x3.h b/basic-geometry/matrix2x3.h
index 7093a94..b18e6ff 100644
--- a/basic-geometry/matrix2x3.h
+++ b/basic-geometry/matrix2x3.h
@@ -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;
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;
}
}
@@ -335,104 +335,104 @@ inline void bgc_fp64_matrix2x3_set_column(BGC_FP64_Matrix2x3* matrix, const int
inline void bgc_fp32_matrix2x3_add(BGC_FP32_Matrix2x3* sum, const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix2x3* matrix2)
{
- sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
- sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
+ sum->row1_col1 = matrix1->row1_col1 + matrix2->row1_col1;
+ sum->row1_col2 = matrix1->row1_col2 + matrix2->row1_col2;
- sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
- sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
+ sum->row2_col1 = matrix1->row2_col1 + matrix2->row2_col1;
+ sum->row2_col2 = matrix1->row2_col2 + matrix2->row2_col2;
- sum->r3c1 = matrix1->r3c1 + matrix2->r3c1;
- sum->r3c2 = matrix1->r3c2 + matrix2->r3c2;
+ sum->row3_col1 = matrix1->row3_col1 + matrix2->row3_col1;
+ sum->row3_col2 = matrix1->row3_col2 + matrix2->row3_col2;
}
inline void bgc_fp64_matrix2x3_add(BGC_FP64_Matrix2x3* sum, const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix2x3* matrix2)
{
- sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
- sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
+ sum->row1_col1 = matrix1->row1_col1 + matrix2->row1_col1;
+ sum->row1_col2 = matrix1->row1_col2 + matrix2->row1_col2;
- sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
- sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
+ sum->row2_col1 = matrix1->row2_col1 + matrix2->row2_col1;
+ sum->row2_col2 = matrix1->row2_col2 + matrix2->row2_col2;
- sum->r3c1 = matrix1->r3c1 + matrix2->r3c1;
- sum->r3c2 = matrix1->r3c2 + matrix2->r3c2;
+ sum->row3_col1 = matrix1->row3_col1 + matrix2->row3_col1;
+ sum->row3_col2 = matrix1->row3_col2 + matrix2->row3_col2;
}
// ================= Add scaled ================= //
inline void bgc_fp32_matrix2x3_add_scaled(BGC_FP32_Matrix2x3* sum, const BGC_FP32_Matrix2x3* basic_matrix, const BGC_FP32_Matrix2x3* scalable_matrix, const float scale)
{
- sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
- sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
+ sum->row1_col1 = basic_matrix->row1_col1 + scalable_matrix->row1_col1 * scale;
+ sum->row1_col2 = basic_matrix->row1_col2 + scalable_matrix->row1_col2 * scale;
- sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
- sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
+ sum->row2_col1 = basic_matrix->row2_col1 + scalable_matrix->row2_col1 * scale;
+ sum->row2_col2 = basic_matrix->row2_col2 + scalable_matrix->row2_col2 * scale;
- sum->r3c1 = basic_matrix->r3c1 + scalable_matrix->r3c1 * scale;
- sum->r3c2 = basic_matrix->r3c2 + scalable_matrix->r3c2 * scale;
+ sum->row3_col1 = basic_matrix->row3_col1 + scalable_matrix->row3_col1 * scale;
+ sum->row3_col2 = basic_matrix->row3_col2 + scalable_matrix->row3_col2 * scale;
}
inline void bgc_fp64_matrix2x3_add_scaled(BGC_FP64_Matrix2x3* sum, const BGC_FP64_Matrix2x3* basic_matrix, const BGC_FP64_Matrix2x3* scalable_matrix, const double scale)
{
- sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
- sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
+ sum->row1_col1 = basic_matrix->row1_col1 + scalable_matrix->row1_col1 * scale;
+ sum->row1_col2 = basic_matrix->row1_col2 + scalable_matrix->row1_col2 * scale;
- sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
- sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
+ sum->row2_col1 = basic_matrix->row2_col1 + scalable_matrix->row2_col1 * scale;
+ sum->row2_col2 = basic_matrix->row2_col2 + scalable_matrix->row2_col2 * scale;
- sum->r3c1 = basic_matrix->r3c1 + scalable_matrix->r3c1 * scale;
- sum->r3c2 = basic_matrix->r3c2 + scalable_matrix->r3c2 * scale;
+ sum->row3_col1 = basic_matrix->row3_col1 + scalable_matrix->row3_col1 * scale;
+ sum->row3_col2 = basic_matrix->row3_col2 + scalable_matrix->row3_col2 * scale;
}
// ================== Subtract ================== //
inline void bgc_fp32_matrix2x3_subtract(BGC_FP32_Matrix2x3* difference, const BGC_FP32_Matrix2x3* minuend, const BGC_FP32_Matrix2x3* subtrahend)
{
- difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
- difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
+ difference->row1_col1 = minuend->row1_col1 - subtrahend->row1_col1;
+ difference->row1_col2 = minuend->row1_col2 - subtrahend->row1_col2;
- difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
- difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
+ difference->row2_col1 = minuend->row2_col1 - subtrahend->row2_col1;
+ difference->row2_col2 = minuend->row2_col2 - subtrahend->row2_col2;
- difference->r3c1 = minuend->r3c1 - subtrahend->r3c1;
- difference->r3c2 = minuend->r3c2 - subtrahend->r3c2;
+ difference->row3_col1 = minuend->row3_col1 - subtrahend->row3_col1;
+ difference->row3_col2 = minuend->row3_col2 - subtrahend->row3_col2;
}
inline void bgc_fp64_matrix2x3_subtract(BGC_FP64_Matrix2x3* difference, const BGC_FP64_Matrix2x3* minuend, const BGC_FP64_Matrix2x3* subtrahend)
{
- difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
- difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
+ difference->row1_col1 = minuend->row1_col1 - subtrahend->row1_col1;
+ difference->row1_col2 = minuend->row1_col2 - subtrahend->row1_col2;
- difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
- difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
+ difference->row2_col1 = minuend->row2_col1 - subtrahend->row2_col1;
+ difference->row2_col2 = minuend->row2_col2 - subtrahend->row2_col2;
- difference->r3c1 = minuend->r3c1 - subtrahend->r3c1;
- difference->r3c2 = minuend->r3c2 - subtrahend->r3c2;
+ difference->row3_col1 = minuend->row3_col1 - subtrahend->row3_col1;
+ difference->row3_col2 = minuend->row3_col2 - subtrahend->row3_col2;
}
// ================== Multiply ================== //
inline void bgc_fp32_matrix2x3_multiply(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix2x3* multiplicand, const float multiplier)
{
- product->r1c1 = multiplicand->r1c1 * multiplier;
- product->r1c2 = multiplicand->r1c2 * multiplier;
+ product->row1_col1 = multiplicand->row1_col1 * multiplier;
+ product->row1_col2 = multiplicand->row1_col2 * multiplier;
- product->r2c1 = multiplicand->r2c1 * multiplier;
- product->r2c2 = multiplicand->r2c2 * multiplier;
+ product->row2_col1 = multiplicand->row2_col1 * multiplier;
+ product->row2_col2 = multiplicand->row2_col2 * multiplier;
- product->r3c1 = multiplicand->r3c1 * multiplier;
- product->r3c2 = multiplicand->r3c2 * multiplier;
+ product->row3_col1 = multiplicand->row3_col1 * multiplier;
+ product->row3_col2 = multiplicand->row3_col2 * multiplier;
}
inline void bgc_fp64_matrix2x3_multiply(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix2x3* multiplicand, const double multiplier)
{
- product->r1c1 = multiplicand->r1c1 * multiplier;
- product->r1c2 = multiplicand->r1c2 * multiplier;
+ product->row1_col1 = multiplicand->row1_col1 * multiplier;
+ product->row1_col2 = multiplicand->row1_col2 * multiplier;
- product->r2c1 = multiplicand->r2c1 * multiplier;
- product->r2c2 = multiplicand->r2c2 * multiplier;
+ product->row2_col1 = multiplicand->row2_col1 * multiplier;
+ product->row2_col2 = multiplicand->row2_col2 * multiplier;
- product->r3c1 = multiplicand->r3c1 * multiplier;
- product->r3c2 = multiplicand->r3c2 * multiplier;
+ product->row3_col1 = multiplicand->row3_col1 * multiplier;
+ product->row3_col2 = multiplicand->row3_col2 * multiplier;
}
// =================== Divide =================== //
@@ -453,58 +453,58 @@ inline void bgc_fp32_matrix2x3_interpolate(BGC_FP32_Matrix2x3* interpolation, co
{
const float couter_phase = 1.0f - phase;
- interpolation->r1c1 = first->r1c1 * couter_phase + second->r1c1 * phase;
- interpolation->r1c2 = first->r1c2 * couter_phase + second->r1c2 * phase;
+ interpolation->row1_col1 = first->row1_col1 * couter_phase + second->row1_col1 * phase;
+ interpolation->row1_col2 = first->row1_col2 * couter_phase + second->row1_col2 * phase;
- interpolation->r2c1 = first->r2c1 * couter_phase + second->r2c1 * phase;
- interpolation->r2c2 = first->r2c2 * couter_phase + second->r2c2 * phase;
+ interpolation->row2_col1 = first->row2_col1 * couter_phase + second->row2_col1 * phase;
+ interpolation->row2_col2 = first->row2_col2 * couter_phase + second->row2_col2 * phase;
- interpolation->r3c1 = first->r3c1 * couter_phase + second->r3c1 * phase;
- interpolation->r3c2 = first->r3c2 * couter_phase + second->r3c2 * phase;
+ interpolation->row3_col1 = first->row3_col1 * couter_phase + second->row3_col1 * phase;
+ interpolation->row3_col2 = first->row3_col2 * couter_phase + second->row3_col2 * phase;
}
inline void bgc_fp64_matrix2x3_interpolate(BGC_FP64_Matrix2x3* interpolation, const BGC_FP64_Matrix2x3* first, const BGC_FP64_Matrix2x3* second, const double phase)
{
const double couter_phase = 1.0 - phase;
- interpolation->r1c1 = first->r1c1 * couter_phase + second->r1c1 * phase;
- interpolation->r1c2 = first->r1c2 * couter_phase + second->r1c2 * phase;
+ interpolation->row1_col1 = first->row1_col1 * couter_phase + second->row1_col1 * phase;
+ interpolation->row1_col2 = first->row1_col2 * couter_phase + second->row1_col2 * phase;
- interpolation->r2c1 = first->r2c1 * couter_phase + second->r2c1 * phase;
- interpolation->r2c2 = first->r2c2 * couter_phase + second->r2c2 * phase;
+ interpolation->row2_col1 = first->row2_col1 * couter_phase + second->row2_col1 * phase;
+ interpolation->row2_col2 = first->row2_col2 * couter_phase + second->row2_col2 * phase;
- interpolation->r3c1 = first->r3c1 * couter_phase + second->r3c1 * phase;
- interpolation->r3c2 = first->r3c2 * couter_phase + second->r3c2 * phase;
+ interpolation->row3_col1 = first->row3_col1 * couter_phase + second->row3_col1 * phase;
+ interpolation->row3_col2 = first->row3_col2 * couter_phase + second->row3_col2 * phase;
}
// ============ Left Vector Product ============= //
inline void bgc_fp32_multiply_vector3_by_matrix2x3(BGC_FP32_Vector2* product, const BGC_FP32_Vector3* vector, const BGC_FP32_Matrix2x3* matrix)
{
- product->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1;
- product->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
+ product->x1 = vector->x1 * matrix->row1_col1 + vector->x2 * matrix->row2_col1 + vector->x3 * matrix->row3_col1;
+ product->x2 = vector->x1 * matrix->row1_col2 + vector->x2 * matrix->row2_col2 + vector->x3 * matrix->row3_col2;
}
inline void bgc_fp64_multiply_vector3_by_matrix2x3(BGC_FP64_Vector2* product, const BGC_FP64_Vector3* vector, const BGC_FP64_Matrix2x3* matrix)
{
- product->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1;
- product->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
+ product->x1 = vector->x1 * matrix->row1_col1 + vector->x2 * matrix->row2_col1 + vector->x3 * matrix->row3_col1;
+ product->x2 = vector->x1 * matrix->row1_col2 + vector->x2 * matrix->row2_col2 + vector->x3 * matrix->row3_col2;
}
// ============ Right Vector Product ============ //
inline void bgc_fp32_multiply_matrix2x3_by_vector2(BGC_FP32_Vector3* product, const BGC_FP32_Matrix2x3* matrix, const BGC_FP32_Vector2* vector)
{
- product->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
- product->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
- product->x3 = matrix->r3c1 * vector->x1 + matrix->r3c2 * vector->x2;
+ product->x1 = matrix->row1_col1 * vector->x1 + matrix->row1_col2 * vector->x2;
+ product->x2 = matrix->row2_col1 * vector->x1 + matrix->row2_col2 * vector->x2;
+ product->x3 = matrix->row3_col1 * vector->x1 + matrix->row3_col2 * vector->x2;
}
inline void bgc_fp64_multiply_matrix2x3_by_vector2(BGC_FP64_Vector3* product, const BGC_FP64_Matrix2x3* matrix, const BGC_FP64_Vector2* vector)
{
- product->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
- product->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
- product->x3 = matrix->r3c1 * vector->x1 + matrix->r3c2 * vector->x2;
+ product->x1 = matrix->row1_col1 * vector->x1 + matrix->row1_col2 * vector->x2;
+ product->x2 = matrix->row2_col1 * vector->x1 + matrix->row2_col2 * vector->x2;
+ product->x3 = matrix->row3_col1 * vector->x1 + matrix->row3_col2 * vector->x2;
}
#endif
diff --git a/basic-geometry/matrix3x2.h b/basic-geometry/matrix3x2.h
index b219ddd..c9ce123 100644
--- a/basic-geometry/matrix3x2.h
+++ b/basic-geometry/matrix3x2.h
@@ -9,152 +9,152 @@
inline void bgc_fp32_matrix3x2_reset(BGC_FP32_Matrix3x2* matrix)
{
- matrix->r1c1 = 0.0f;
- matrix->r1c2 = 0.0f;
- matrix->r1c3 = 0.0f;
+ matrix->row1_col1 = 0.0f;
+ matrix->row1_col2 = 0.0f;
+ matrix->row1_col3 = 0.0f;
- matrix->r2c1 = 0.0f;
- matrix->r2c2 = 0.0f;
- matrix->r2c3 = 0.0f;
+ matrix->row2_col1 = 0.0f;
+ matrix->row2_col2 = 0.0f;
+ matrix->row2_col3 = 0.0f;
}
inline void bgc_fp64_matrix3x2_reset(BGC_FP64_Matrix3x2* matrix)
{
- matrix->r1c1 = 0.0;
- matrix->r1c2 = 0.0;
- matrix->r1c3 = 0.0;
+ matrix->row1_col1 = 0.0;
+ matrix->row1_col2 = 0.0;
+ matrix->row1_col3 = 0.0;
- matrix->r2c1 = 0.0;
- matrix->r2c2 = 0.0;
- matrix->r2c3 = 0.0;
+ matrix->row2_col1 = 0.0;
+ matrix->row2_col2 = 0.0;
+ matrix->row2_col3 = 0.0;
}
// ==================== Copy ==================== //
inline void bgc_fp32_matrix3x2_copy(BGC_FP32_Matrix3x2* destination, const BGC_FP32_Matrix3x2* source)
{
- destination->r1c1 = source->r1c1;
- destination->r1c2 = source->r1c2;
- destination->r1c3 = source->r1c3;
+ destination->row1_col1 = source->row1_col1;
+ destination->row1_col2 = source->row1_col2;
+ destination->row1_col3 = source->row1_col3;
- destination->r2c1 = source->r2c1;
- destination->r2c2 = source->r2c2;
- destination->r2c3 = source->r2c3;
+ destination->row2_col1 = source->row2_col1;
+ destination->row2_col2 = source->row2_col2;
+ destination->row2_col3 = source->row2_col3;
}
inline void bgc_fp64_matrix3x2_copy(BGC_FP64_Matrix3x2* destination, const BGC_FP64_Matrix3x2* source)
{
- destination->r1c1 = source->r1c1;
- destination->r1c2 = source->r1c2;
- destination->r1c3 = source->r1c3;
+ destination->row1_col1 = source->row1_col1;
+ destination->row1_col2 = source->row1_col2;
+ destination->row1_col3 = source->row1_col3;
- destination->r2c1 = source->r2c1;
- destination->r2c2 = source->r2c2;
- destination->r2c3 = source->r2c3;
+ destination->row2_col1 = source->row2_col1;
+ destination->row2_col2 = source->row2_col2;
+ destination->row2_col3 = source->row2_col3;
}
// ==================== Swap ==================== //
inline void bgc_fp32_matrix3x2_swap(BGC_FP32_Matrix3x2* matrix1, BGC_FP32_Matrix3x2* matrix2)
{
- const float r1c1 = matrix2->r1c1;
- const float r1c2 = matrix2->r1c2;
- const float r1c3 = matrix2->r1c3;
+ const float row1_col1 = matrix2->row1_col1;
+ const float row1_col2 = matrix2->row1_col2;
+ const float row1_col3 = matrix2->row1_col3;
- const float r2c1 = matrix2->r2c1;
- const float r2c2 = matrix2->r2c2;
- const float r2c3 = matrix2->r2c3;
+ const float row2_col1 = matrix2->row2_col1;
+ const float row2_col2 = matrix2->row2_col2;
+ const float row2_col3 = matrix2->row2_col3;
- matrix2->r1c1 = matrix1->r1c1;
- matrix2->r1c2 = matrix1->r1c2;
- matrix2->r1c3 = matrix1->r1c3;
+ matrix2->row1_col1 = matrix1->row1_col1;
+ matrix2->row1_col2 = matrix1->row1_col2;
+ matrix2->row1_col3 = matrix1->row1_col3;
- matrix2->r2c1 = matrix1->r2c1;
- matrix2->r2c2 = matrix1->r2c2;
- matrix2->r2c3 = matrix1->r2c3;
+ matrix2->row2_col1 = matrix1->row2_col1;
+ matrix2->row2_col2 = matrix1->row2_col2;
+ matrix2->row2_col3 = matrix1->row2_col3;
- matrix1->r1c1 = r1c1;
- matrix1->r1c2 = r1c2;
- matrix1->r1c3 = r1c3;
+ matrix1->row1_col1 = row1_col1;
+ matrix1->row1_col2 = row1_col2;
+ matrix1->row1_col3 = row1_col3;
- matrix1->r2c1 = r2c1;
- matrix1->r2c2 = r2c2;
- matrix1->r2c3 = r2c3;
+ matrix1->row2_col1 = row2_col1;
+ matrix1->row2_col2 = row2_col2;
+ matrix1->row2_col3 = row2_col3;
}
inline void bgc_fp64_matrix3x2_swap(BGC_FP64_Matrix3x2* matrix1, BGC_FP64_Matrix3x2* matrix2)
{
- const double r1c1 = matrix2->r1c1;
- const double r1c2 = matrix2->r1c2;
- const double r1c3 = matrix2->r1c3;
+ const double row1_col1 = matrix2->row1_col1;
+ const double row1_col2 = matrix2->row1_col2;
+ const double row1_col3 = matrix2->row1_col3;
- const double r2c1 = matrix2->r2c1;
- const double r2c2 = matrix2->r2c2;
- const double r2c3 = matrix2->r2c3;
+ const double row2_col1 = matrix2->row2_col1;
+ const double row2_col2 = matrix2->row2_col2;
+ const double row2_col3 = matrix2->row2_col3;
- matrix2->r1c1 = matrix1->r1c1;
- matrix2->r1c2 = matrix1->r1c2;
- matrix2->r1c3 = matrix1->r1c3;
+ matrix2->row1_col1 = matrix1->row1_col1;
+ matrix2->row1_col2 = matrix1->row1_col2;
+ matrix2->row1_col3 = matrix1->row1_col3;
- matrix2->r2c1 = matrix1->r2c1;
- matrix2->r2c2 = matrix1->r2c2;
- matrix2->r2c3 = matrix1->r2c3;
+ matrix2->row2_col1 = matrix1->row2_col1;
+ matrix2->row2_col2 = matrix1->row2_col2;
+ matrix2->row2_col3 = matrix1->row2_col3;
- matrix1->r1c1 = r1c1;
- matrix1->r1c2 = r1c2;
- matrix1->r1c3 = r1c3;
+ matrix1->row1_col1 = row1_col1;
+ matrix1->row1_col2 = row1_col2;
+ matrix1->row1_col3 = row1_col3;
- matrix1->r2c1 = r2c1;
- matrix1->r2c2 = r2c2;
- matrix1->r2c3 = r2c3;
+ matrix1->row2_col1 = row2_col1;
+ matrix1->row2_col2 = row2_col2;
+ matrix1->row2_col3 = row2_col3;
}
// ================== Convert =================== //
inline void bgc_fp64_matrix3x2_convert_to_fp32(BGC_FP32_Matrix3x2* destination, const BGC_FP64_Matrix3x2* source)
{
- destination->r1c1 = (float)source->r1c1;
- destination->r1c2 = (float)source->r1c2;
- destination->r1c3 = (float)source->r1c3;
+ destination->row1_col1 = (float)source->row1_col1;
+ destination->row1_col2 = (float)source->row1_col2;
+ destination->row1_col3 = (float)source->row1_col3;
- destination->r2c1 = (float)source->r2c1;
- destination->r2c2 = (float)source->r2c2;
- destination->r2c3 = (float)source->r2c3;
+ destination->row2_col1 = (float)source->row2_col1;
+ destination->row2_col2 = (float)source->row2_col2;
+ destination->row2_col3 = (float)source->row2_col3;
}
inline void bgc_fp32_matrix3x2_convert_to_fp64(BGC_FP64_Matrix3x2* destination, const BGC_FP32_Matrix3x2* source)
{
- destination->r1c1 = source->r1c1;
- destination->r1c2 = source->r1c2;
- destination->r1c3 = source->r1c3;
+ destination->row1_col1 = source->row1_col1;
+ destination->row1_col2 = source->row1_col2;
+ destination->row1_col3 = source->row1_col3;
- destination->r2c1 = source->r2c1;
- destination->r2c2 = source->r2c2;
- destination->r2c3 = source->r2c3;
+ destination->row2_col1 = source->row2_col1;
+ destination->row2_col2 = source->row2_col2;
+ destination->row2_col3 = source->row2_col3;
}
// ================= Transpose ================== //
inline void bgc_fp32_matrix3x2_get_transposed(BGC_FP32_Matrix3x2* transposed, const BGC_FP32_Matrix2x3* matrix)
{
- transposed->r1c1 = matrix->r1c1;
- transposed->r1c2 = matrix->r2c1;
- transposed->r1c3 = matrix->r3c1;
+ transposed->row1_col1 = matrix->row1_col1;
+ transposed->row1_col2 = matrix->row2_col1;
+ transposed->row1_col3 = matrix->row3_col1;
- transposed->r2c1 = matrix->r1c2;
- transposed->r2c2 = matrix->r2c2;
- transposed->r2c3 = matrix->r3c2;
+ transposed->row2_col1 = matrix->row1_col2;
+ transposed->row2_col2 = matrix->row2_col2;
+ transposed->row2_col3 = matrix->row3_col2;
}
inline void bgc_fp64_matrix3x2_get_transposed(BGC_FP64_Matrix3x2* transposed, const BGC_FP64_Matrix2x3* matrix)
{
- transposed->r1c1 = matrix->r1c1;
- transposed->r1c2 = matrix->r2c1;
- transposed->r1c3 = matrix->r3c1;
+ transposed->row1_col1 = matrix->row1_col1;
+ transposed->row1_col2 = matrix->row2_col1;
+ transposed->row1_col3 = matrix->row3_col1;
- transposed->r2c1 = matrix->r1c2;
- transposed->r2c2 = matrix->r2c2;
- transposed->r2c3 = matrix->r3c2;
+ transposed->row2_col1 = matrix->row1_col2;
+ transposed->row2_col2 = matrix->row2_col2;
+ transposed->row2_col3 = matrix->row3_col2;
}
// ================== Get Row =================== //
@@ -163,17 +163,17 @@ inline void bgc_fp32_matrix3x2_get_row(BGC_FP32_Vector3* row, const BGC_FP32_Mat
{
if (row_number == 1)
{
- row->x1 = matrix->r1c1;
- row->x2 = matrix->r1c2;
- row->x3 = matrix->r1c3;
+ row->x1 = matrix->row1_col1;
+ row->x2 = matrix->row1_col2;
+ row->x3 = matrix->row1_col3;
return;
}
if (row_number == 2)
{
- row->x1 = matrix->r2c1;
- row->x2 = matrix->r2c2;
- row->x3 = matrix->r2c3;
+ row->x1 = matrix->row2_col1;
+ row->x2 = matrix->row2_col2;
+ row->x3 = matrix->row2_col3;
return;
}
@@ -186,17 +186,17 @@ inline void bgc_fp64_matrix3x2_get_row(BGC_FP64_Vector3* row, const BGC_FP64_Mat
{
if (row_number == 1)
{
- row->x1 = matrix->r1c1;
- row->x2 = matrix->r1c2;
- row->x3 = matrix->r1c3;
+ row->x1 = matrix->row1_col1;
+ row->x2 = matrix->row1_col2;
+ row->x3 = matrix->row1_col3;
return;
}
if (row_number == 2)
{
- row->x1 = matrix->r2c1;
- row->x2 = matrix->r2c2;
- row->x3 = matrix->r2c3;
+ row->x1 = matrix->row2_col1;
+ row->x2 = matrix->row2_col2;
+ row->x3 = matrix->row2_col3;
return;
}
@@ -211,17 +211,17 @@ inline void bgc_fp32_matrix3x2_set_row(BGC_FP32_Matrix3x2* matrix, const int row
{
if (row_number == 1)
{
- matrix->r1c1 = row->x1;
- matrix->r1c2 = row->x2;
- matrix->r1c3 = row->x3;
+ matrix->row1_col1 = row->x1;
+ matrix->row1_col2 = row->x2;
+ matrix->row1_col3 = row->x3;
return;
}
if (row_number == 2)
{
- matrix->r2c1 = row->x1;
- matrix->r2c2 = row->x2;
- matrix->r2c3 = row->x3;
+ matrix->row2_col1 = row->x1;
+ matrix->row2_col2 = row->x2;
+ matrix->row2_col3 = row->x3;
}
}
@@ -229,17 +229,17 @@ inline void bgc_fp64_matrix3x2_set_row(BGC_FP64_Matrix3x2* matrix, const int row
{
if (row_number == 1)
{
- matrix->r1c1 = row->x1;
- matrix->r1c2 = row->x2;
- matrix->r1c3 = row->x3;
+ matrix->row1_col1 = row->x1;
+ matrix->row1_col2 = row->x2;
+ matrix->row1_col3 = row->x3;
return;
}
if (row_number == 2)
{
- matrix->r2c1 = row->x1;
- matrix->r2c2 = row->x2;
- matrix->r2c3 = row->x3;
+ matrix->row2_col1 = row->x1;
+ matrix->row2_col2 = row->x2;
+ matrix->row2_col3 = row->x3;
}
}
@@ -249,22 +249,22 @@ inline void bgc_fp32_matrix3x2_get_column(BGC_FP32_Vector2* column, const BGC_FP
{
if (column_number == 1)
{
- column->x1 = matrix->r1c1;
- column->x2 = matrix->r2c1;
+ column->x1 = matrix->row1_col1;
+ column->x2 = matrix->row2_col1;
return;
}
if (column_number == 2)
{
- column->x1 = matrix->r1c2;
- column->x2 = matrix->r2c2;
+ column->x1 = matrix->row1_col2;
+ column->x2 = matrix->row2_col2;
return;
}
if (column_number == 3)
{
- column->x1 = matrix->r1c3;
- column->x2 = matrix->r2c3;
+ column->x1 = matrix->row1_col3;
+ column->x2 = matrix->row2_col3;
return;
}
@@ -276,22 +276,22 @@ inline void bgc_fp64_matrix3x2_get_column(BGC_FP64_Vector2* column, const BGC_FP
{
if (column_number == 1)
{
- column->x1 = matrix->r1c1;
- column->x2 = matrix->r2c1;
+ column->x1 = matrix->row1_col1;
+ column->x2 = matrix->row2_col1;
return;
}
if (column_number == 2)
{
- column->x1 = matrix->r1c2;
- column->x2 = matrix->r2c2;
+ column->x1 = matrix->row1_col2;
+ column->x2 = matrix->row2_col2;
return;
}
if (column_number == 3)
{
- column->x1 = matrix->r1c3;
- column->x2 = matrix->r2c3;
+ column->x1 = matrix->row1_col3;
+ column->x2 = matrix->row2_col3;
return;
}
@@ -305,22 +305,22 @@ inline void bgc_fp32_matrix3x2_set_column(BGC_FP32_Matrix3x2* matrix, const int
{
if (column_number == 1)
{
- matrix->r1c1 = column->x1;
- matrix->r2c1 = column->x2;
+ matrix->row1_col1 = column->x1;
+ matrix->row2_col1 = column->x2;
return;
}
if (column_number == 2)
{
- matrix->r1c2 = column->x1;
- matrix->r2c2 = column->x2;
+ matrix->row1_col2 = column->x1;
+ matrix->row2_col2 = column->x2;
return;
}
if (column_number == 3)
{
- matrix->r1c3 = column->x1;
- matrix->r2c3 = column->x2;
+ matrix->row1_col3 = column->x1;
+ matrix->row2_col3 = column->x2;
}
}
@@ -328,22 +328,22 @@ inline void bgc_fp64_matrix3x2_set_column(BGC_FP64_Matrix3x2* matrix, const int
{
if (column_number == 1)
{
- matrix->r1c1 = column->x1;
- matrix->r2c1 = column->x2;
+ matrix->row1_col1 = column->x1;
+ matrix->row2_col1 = column->x2;
return;
}
if (column_number == 2)
{
- matrix->r1c2 = column->x1;
- matrix->r2c2 = column->x2;
+ matrix->row1_col2 = column->x1;
+ matrix->row2_col2 = column->x2;
return;
}
if (column_number == 3)
{
- matrix->r1c3 = column->x1;
- matrix->r2c3 = column->x2;
+ matrix->row1_col3 = column->x1;
+ matrix->row2_col3 = column->x2;
}
}
@@ -351,96 +351,96 @@ inline void bgc_fp64_matrix3x2_set_column(BGC_FP64_Matrix3x2* matrix, const int
inline void bgc_fp32_matrix3x2_add(BGC_FP32_Matrix3x2* sum, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix3x2* matrix2)
{
- sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
- sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
- sum->r1c3 = matrix1->r1c3 + matrix2->r1c3;
+ sum->row1_col1 = matrix1->row1_col1 + matrix2->row1_col1;
+ sum->row1_col2 = matrix1->row1_col2 + matrix2->row1_col2;
+ sum->row1_col3 = matrix1->row1_col3 + matrix2->row1_col3;
- sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
- sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
- sum->r2c3 = matrix1->r2c3 + matrix2->r2c3;
+ sum->row2_col1 = matrix1->row2_col1 + matrix2->row2_col1;
+ sum->row2_col2 = matrix1->row2_col2 + matrix2->row2_col2;
+ sum->row2_col3 = matrix1->row2_col3 + matrix2->row2_col3;
}
inline void bgc_fp64_matrix3x2_add(BGC_FP64_Matrix3x2* sum, const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix3x2* matrix2)
{
- sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
- sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
- sum->r1c3 = matrix1->r1c3 + matrix2->r1c3;
+ sum->row1_col1 = matrix1->row1_col1 + matrix2->row1_col1;
+ sum->row1_col2 = matrix1->row1_col2 + matrix2->row1_col2;
+ sum->row1_col3 = matrix1->row1_col3 + matrix2->row1_col3;
- sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
- sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
- sum->r2c3 = matrix1->r2c3 + matrix2->r2c3;
+ sum->row2_col1 = matrix1->row2_col1 + matrix2->row2_col1;
+ sum->row2_col2 = matrix1->row2_col2 + matrix2->row2_col2;
+ sum->row2_col3 = matrix1->row2_col3 + matrix2->row2_col3;
}
// ================= Add scaled ================= //
inline void bgc_fp32_matrix3x2_add_scaled(BGC_FP32_Matrix3x2* sum, const BGC_FP32_Matrix3x2* basic_matrix, const BGC_FP32_Matrix3x2* scalable_matrix, const float scale)
{
- sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
- sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
- sum->r1c3 = basic_matrix->r1c3 + scalable_matrix->r1c3 * scale;
+ sum->row1_col1 = basic_matrix->row1_col1 + scalable_matrix->row1_col1 * scale;
+ sum->row1_col2 = basic_matrix->row1_col2 + scalable_matrix->row1_col2 * scale;
+ sum->row1_col3 = basic_matrix->row1_col3 + scalable_matrix->row1_col3 * scale;
- sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
- sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
- sum->r2c3 = basic_matrix->r2c3 + scalable_matrix->r2c3 * scale;
+ sum->row2_col1 = basic_matrix->row2_col1 + scalable_matrix->row2_col1 * scale;
+ sum->row2_col2 = basic_matrix->row2_col2 + scalable_matrix->row2_col2 * scale;
+ sum->row2_col3 = basic_matrix->row2_col3 + scalable_matrix->row2_col3 * scale;
}
inline void bgc_fp64_matrix3x2_add_scaled(BGC_FP64_Matrix3x2* sum, const BGC_FP64_Matrix3x2* basic_matrix, const BGC_FP64_Matrix3x2* scalable_matrix, const double scale)
{
- sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
- sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
- sum->r1c3 = basic_matrix->r1c3 + scalable_matrix->r1c3 * scale;
+ sum->row1_col1 = basic_matrix->row1_col1 + scalable_matrix->row1_col1 * scale;
+ sum->row1_col2 = basic_matrix->row1_col2 + scalable_matrix->row1_col2 * scale;
+ sum->row1_col3 = basic_matrix->row1_col3 + scalable_matrix->row1_col3 * scale;
- sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
- sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
- sum->r2c3 = basic_matrix->r2c3 + scalable_matrix->r2c3 * scale;
+ sum->row2_col1 = basic_matrix->row2_col1 + scalable_matrix->row2_col1 * scale;
+ sum->row2_col2 = basic_matrix->row2_col2 + scalable_matrix->row2_col2 * scale;
+ sum->row2_col3 = basic_matrix->row2_col3 + scalable_matrix->row2_col3 * scale;
}
// ================== Subtract ================== //
inline void bgc_fp32_matrix3x2_subtract(BGC_FP32_Matrix3x2* difference, const BGC_FP32_Matrix3x2* minuend, const BGC_FP32_Matrix3x2* subtrahend)
{
- difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
- difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
- difference->r1c3 = minuend->r1c3 - subtrahend->r1c3;
+ difference->row1_col1 = minuend->row1_col1 - subtrahend->row1_col1;
+ difference->row1_col2 = minuend->row1_col2 - subtrahend->row1_col2;
+ difference->row1_col3 = minuend->row1_col3 - subtrahend->row1_col3;
- difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
- difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
- difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
+ difference->row2_col1 = minuend->row2_col1 - subtrahend->row2_col1;
+ difference->row2_col2 = minuend->row2_col2 - subtrahend->row2_col2;
+ difference->row2_col3 = minuend->row2_col3 - subtrahend->row2_col3;
}
inline void bgc_fp64_matrix3x2_subtract(BGC_FP64_Matrix3x2* difference, const BGC_FP64_Matrix3x2* minuend, const BGC_FP64_Matrix3x2* subtrahend)
{
- difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
- difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
- difference->r1c3 = minuend->r1c3 - subtrahend->r1c3;
+ difference->row1_col1 = minuend->row1_col1 - subtrahend->row1_col1;
+ difference->row1_col2 = minuend->row1_col2 - subtrahend->row1_col2;
+ difference->row1_col3 = minuend->row1_col3 - subtrahend->row1_col3;
- difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
- difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
- difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
+ difference->row2_col1 = minuend->row2_col1 - subtrahend->row2_col1;
+ difference->row2_col2 = minuend->row2_col2 - subtrahend->row2_col2;
+ difference->row2_col3 = minuend->row2_col3 - subtrahend->row2_col3;
}
// ================== Multiply ================== //
inline void bgc_fp32_matrix3x2_multiply(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix3x2* multiplicand, const float multiplier)
{
- product->r1c1 = multiplicand->r1c1 * multiplier;
- product->r1c2 = multiplicand->r1c2 * multiplier;
- product->r1c3 = multiplicand->r1c3 * multiplier;
+ product->row1_col1 = multiplicand->row1_col1 * multiplier;
+ product->row1_col2 = multiplicand->row1_col2 * multiplier;
+ product->row1_col3 = multiplicand->row1_col3 * multiplier;
- product->r2c1 = multiplicand->r2c1 * multiplier;
- product->r2c2 = multiplicand->r2c2 * multiplier;
- product->r2c3 = multiplicand->r2c3 * multiplier;
+ product->row2_col1 = multiplicand->row2_col1 * multiplier;
+ product->row2_col2 = multiplicand->row2_col2 * multiplier;
+ product->row2_col3 = multiplicand->row2_col3 * multiplier;
}
inline void bgc_fp64_matrix3x2_multiply(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix3x2* multiplicand, const double multiplier)
{
- product->r1c1 = multiplicand->r1c1 * multiplier;
- product->r1c2 = multiplicand->r1c2 * multiplier;
- product->r1c3 = multiplicand->r1c3 * multiplier;
+ product->row1_col1 = multiplicand->row1_col1 * multiplier;
+ product->row1_col2 = multiplicand->row1_col2 * multiplier;
+ product->row1_col3 = multiplicand->row1_col3 * multiplier;
- product->r2c1 = multiplicand->r2c1 * multiplier;
- product->r2c2 = multiplicand->r2c2 * multiplier;
- product->r2c3 = multiplicand->r2c3 * multiplier;
+ product->row2_col1 = multiplicand->row2_col1 * multiplier;
+ product->row2_col2 = multiplicand->row2_col2 * multiplier;
+ product->row2_col3 = multiplicand->row2_col3 * multiplier;
}
// =================== Divide =================== //
@@ -461,56 +461,56 @@ inline void bgc_fp32_matrix3x2_interpolate(BGC_FP32_Matrix3x2* interpolation, co
{
const float couter_phase = 1.0f - phase;
- interpolation->r1c1 = first->r1c1 * couter_phase + second->r1c1 * phase;
- interpolation->r1c2 = first->r1c2 * couter_phase + second->r1c2 * phase;
- interpolation->r1c3 = first->r1c3 * couter_phase + second->r1c3 * phase;
+ interpolation->row1_col1 = first->row1_col1 * couter_phase + second->row1_col1 * phase;
+ interpolation->row1_col2 = first->row1_col2 * couter_phase + second->row1_col2 * phase;
+ interpolation->row1_col3 = first->row1_col3 * couter_phase + second->row1_col3 * phase;
- interpolation->r2c1 = first->r2c1 * couter_phase + second->r2c1 * phase;
- interpolation->r2c2 = first->r2c2 * couter_phase + second->r2c2 * phase;
- interpolation->r2c3 = first->r2c3 * couter_phase + second->r2c3 * phase;
+ interpolation->row2_col1 = first->row2_col1 * couter_phase + second->row2_col1 * phase;
+ interpolation->row2_col2 = first->row2_col2 * couter_phase + second->row2_col2 * phase;
+ interpolation->row2_col3 = first->row2_col3 * couter_phase + second->row2_col3 * phase;
}
inline void bgc_fp64_matrix3x2_interpolate(BGC_FP64_Matrix3x2* interpolation, const BGC_FP64_Matrix3x2* first, const BGC_FP64_Matrix3x2* second, const double phase)
{
const double couter_phase = 1.0 - phase;
- interpolation->r1c1 = first->r1c1 * couter_phase + second->r1c1 * phase;
- interpolation->r1c2 = first->r1c2 * couter_phase + second->r1c2 * phase;
- interpolation->r1c3 = first->r1c3 * couter_phase + second->r1c3 * phase;
+ interpolation->row1_col1 = first->row1_col1 * couter_phase + second->row1_col1 * phase;
+ interpolation->row1_col2 = first->row1_col2 * couter_phase + second->row1_col2 * phase;
+ interpolation->row1_col3 = first->row1_col3 * couter_phase + second->row1_col3 * phase;
- interpolation->r2c1 = first->r2c1 * couter_phase + second->r2c1 * phase;
- interpolation->r2c2 = first->r2c2 * couter_phase + second->r2c2 * phase;
- interpolation->r2c3 = first->r2c3 * couter_phase + second->r2c3 * phase;
+ interpolation->row2_col1 = first->row2_col1 * couter_phase + second->row2_col1 * phase;
+ interpolation->row2_col2 = first->row2_col2 * couter_phase + second->row2_col2 * phase;
+ interpolation->row2_col3 = first->row2_col3 * couter_phase + second->row2_col3 * phase;
}
// ============ Left Vector Product ============= //
inline void bgc_fp32_multiply_vector2_by_matrix3x2(BGC_FP32_Vector3* product, const BGC_FP32_Vector2* vector, const BGC_FP32_Matrix3x2* matrix)
{
- product->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
- product->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
- product->x3 = vector->x1 * matrix->r1c3 + vector->x2 * matrix->r2c3;
+ product->x1 = vector->x1 * matrix->row1_col1 + vector->x2 * matrix->row2_col1;
+ product->x2 = vector->x1 * matrix->row1_col2 + vector->x2 * matrix->row2_col2;
+ product->x3 = vector->x1 * matrix->row1_col3 + vector->x2 * matrix->row2_col3;
}
inline void bgc_fp64_multiply_vector2_by_matrix3x2(BGC_FP64_Vector3* product, const BGC_FP64_Vector2* vector, const BGC_FP64_Matrix3x2* matrix)
{
- product->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
- product->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
- product->x3 = vector->x1 * matrix->r1c3 + vector->x2 * matrix->r2c3;
+ product->x1 = vector->x1 * matrix->row1_col1 + vector->x2 * matrix->row2_col1;
+ product->x2 = vector->x1 * matrix->row1_col2 + vector->x2 * matrix->row2_col2;
+ product->x3 = vector->x1 * matrix->row1_col3 + vector->x2 * matrix->row2_col3;
}
// ============ Right Vector Product ============ //
inline void bgc_fp32_multiply_matrix3x2_by_vector3(BGC_FP32_Vector2* product, const BGC_FP32_Matrix3x2* matrix, const BGC_FP32_Vector3* vector)
{
- product->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3;
- product->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
+ product->x1 = matrix->row1_col1 * vector->x1 + matrix->row1_col2 * vector->x2 + matrix->row1_col3 * vector->x3;
+ product->x2 = matrix->row2_col1 * vector->x1 + matrix->row2_col2 * vector->x2 + matrix->row2_col3 * vector->x3;
}
inline void bgc_fp64_multiply_matrix3x2_by_vector3(BGC_FP64_Vector2* product, const BGC_FP64_Matrix3x2* matrix, const BGC_FP64_Vector3* vector)
{
- product->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3;
- product->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
+ product->x1 = matrix->row1_col1 * vector->x1 + matrix->row1_col2 * vector->x2 + matrix->row1_col3 * vector->x3;
+ product->x2 = matrix->row2_col1 * vector->x1 + matrix->row2_col2 * vector->x2 + matrix->row2_col3 * vector->x3;
}
#endif
diff --git a/basic-geometry/matrix3x3.c b/basic-geometry/matrix3x3.c
index 4125e37..eff063d 100644
--- a/basic-geometry/matrix3x3.c
+++ b/basic-geometry/matrix3x3.c
@@ -85,31 +85,31 @@ int bgc_fp32_matrix3x3_get_inverse(BGC_FP32_Matrix3x3* inverse, const BGC_FP32_M
return 0;
}
- const float r1c1 = matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2;
- const float r1c2 = matrix->r1c3 * matrix->r3c2 - matrix->r1c2 * matrix->r3c3;
- const float r1c3 = matrix->r1c2 * matrix->r2c3 - matrix->r1c3 * matrix->r2c2;
+ const float row1_col1 = matrix->row2_col2 * matrix->row3_col3 - matrix->row2_col3 * matrix->row3_col2;
+ const float row1_col2 = matrix->row1_col3 * matrix->row3_col2 - matrix->row1_col2 * matrix->row3_col3;
+ const float row1_col3 = matrix->row1_col2 * matrix->row2_col3 - matrix->row1_col3 * matrix->row2_col2;
- const float r2c1 = matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3;
- const float r2c2 = matrix->r1c1 * matrix->r3c3 - matrix->r1c3 * matrix->r3c1;
- const float r2c3 = matrix->r1c3 * matrix->r2c1 - matrix->r1c1 * matrix->r2c3;
+ const float row2_col1 = matrix->row2_col3 * matrix->row3_col1 - matrix->row2_col1 * matrix->row3_col3;
+ const float row2_col2 = matrix->row1_col1 * matrix->row3_col3 - matrix->row1_col3 * matrix->row3_col1;
+ const float row2_col3 = matrix->row1_col3 * matrix->row2_col1 - matrix->row1_col1 * matrix->row2_col3;
- const float r3c1 = matrix->r2c1 * matrix->r3c2 - matrix->r2c2 * matrix->r3c1;
- const float r3c2 = matrix->r1c2 * matrix->r3c1 - matrix->r1c1 * matrix->r3c2;
- const float r3c3 = matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
+ const float row3_col1 = matrix->row2_col1 * matrix->row3_col2 - matrix->row2_col2 * matrix->row3_col1;
+ const float row3_col2 = matrix->row1_col2 * matrix->row3_col1 - matrix->row1_col1 * matrix->row3_col2;
+ const float row3_col3 = matrix->row1_col1 * matrix->row2_col2 - matrix->row1_col2 * matrix->row2_col1;
const float multiplier = 1.0f / determinant;
- inverse->r1c1 = r1c1 * multiplier;
- inverse->r1c2 = r1c2 * multiplier;
- inverse->r1c3 = r1c3 * multiplier;
+ inverse->row1_col1 = row1_col1 * multiplier;
+ inverse->row1_col2 = row1_col2 * multiplier;
+ inverse->row1_col3 = row1_col3 * multiplier;
- inverse->r2c1 = r2c1 * multiplier;
- inverse->r2c2 = r2c2 * multiplier;
- inverse->r2c3 = r2c3 * multiplier;
+ inverse->row2_col1 = row2_col1 * multiplier;
+ inverse->row2_col2 = row2_col2 * multiplier;
+ inverse->row2_col3 = row2_col3 * multiplier;
- inverse->r3c1 = r3c1 * multiplier;
- inverse->r3c2 = r3c2 * multiplier;
- inverse->r3c3 = r3c3 * multiplier;
+ inverse->row3_col1 = row3_col1 * multiplier;
+ inverse->row3_col2 = row3_col2 * multiplier;
+ inverse->row3_col3 = row3_col3 * multiplier;
return 1;
}
@@ -122,31 +122,31 @@ int bgc_fp64_matrix3x3_get_inverse(BGC_FP64_Matrix3x3* inverse, const BGC_FP64_M
return 0;
}
- const double r1c1 = matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2;
- const double r1c2 = matrix->r1c3 * matrix->r3c2 - matrix->r1c2 * matrix->r3c3;
- const double r1c3 = matrix->r1c2 * matrix->r2c3 - matrix->r1c3 * matrix->r2c2;
+ const double row1_col1 = matrix->row2_col2 * matrix->row3_col3 - matrix->row2_col3 * matrix->row3_col2;
+ const double row1_col2 = matrix->row1_col3 * matrix->row3_col2 - matrix->row1_col2 * matrix->row3_col3;
+ const double row1_col3 = matrix->row1_col2 * matrix->row2_col3 - matrix->row1_col3 * matrix->row2_col2;
- const double r2c1 = matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3;
- const double r2c2 = matrix->r1c1 * matrix->r3c3 - matrix->r1c3 * matrix->r3c1;
- const double r2c3 = matrix->r1c3 * matrix->r2c1 - matrix->r1c1 * matrix->r2c3;
+ const double row2_col1 = matrix->row2_col3 * matrix->row3_col1 - matrix->row2_col1 * matrix->row3_col3;
+ const double row2_col2 = matrix->row1_col1 * matrix->row3_col3 - matrix->row1_col3 * matrix->row3_col1;
+ const double row2_col3 = matrix->row1_col3 * matrix->row2_col1 - matrix->row1_col1 * matrix->row2_col3;
- const double r3c1 = matrix->r2c1 * matrix->r3c2 - matrix->r2c2 * matrix->r3c1;
- const double r3c2 = matrix->r1c2 * matrix->r3c1 - matrix->r1c1 * matrix->r3c2;
- const double r3c3 = matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
+ const double row3_col1 = matrix->row2_col1 * matrix->row3_col2 - matrix->row2_col2 * matrix->row3_col1;
+ const double row3_col2 = matrix->row1_col2 * matrix->row3_col1 - matrix->row1_col1 * matrix->row3_col2;
+ const double row3_col3 = matrix->row1_col1 * matrix->row2_col2 - matrix->row1_col2 * matrix->row2_col1;
const double multiplier = 1.0 / determinant;
- inverse->r1c1 = r1c1 * multiplier;
- inverse->r1c2 = r1c2 * multiplier;
- inverse->r1c3 = r1c3 * multiplier;
+ inverse->row1_col1 = row1_col1 * multiplier;
+ inverse->row1_col2 = row1_col2 * multiplier;
+ inverse->row1_col3 = row1_col3 * multiplier;
- inverse->r2c1 = r2c1 * multiplier;
- inverse->r2c2 = r2c2 * multiplier;
- inverse->r2c3 = r2c3 * multiplier;
+ inverse->row2_col1 = row2_col1 * multiplier;
+ inverse->row2_col2 = row2_col2 * multiplier;
+ inverse->row2_col3 = row2_col3 * multiplier;
- inverse->r3c1 = r3c1 * multiplier;
- inverse->r3c2 = r3c2 * multiplier;
- inverse->r3c3 = r3c3 * multiplier;
+ inverse->row3_col1 = row3_col1 * multiplier;
+ inverse->row3_col2 = row3_col2 * multiplier;
+ inverse->row3_col3 = row3_col3 * multiplier;
return 1;
}
diff --git a/basic-geometry/matrix3x3.h b/basic-geometry/matrix3x3.h
index 18568bd..aaf646d 100644
--- a/basic-geometry/matrix3x3.h
+++ b/basic-geometry/matrix3x3.h
@@ -8,272 +8,272 @@
inline void bgc_fp32_matrix3x3_reset(BGC_FP32_Matrix3x3* matrix)
{
- matrix->r1c1 = 0.0f;
- matrix->r1c2 = 0.0f;
- matrix->r1c3 = 0.0f;
+ matrix->row1_col1 = 0.0f;
+ matrix->row1_col2 = 0.0f;
+ matrix->row1_col3 = 0.0f;
- matrix->r2c1 = 0.0f;
- matrix->r2c2 = 0.0f;
- matrix->r2c3 = 0.0f;
+ matrix->row2_col1 = 0.0f;
+ matrix->row2_col2 = 0.0f;
+ matrix->row2_col3 = 0.0f;
- matrix->r3c1 = 0.0f;
- matrix->r3c2 = 0.0f;
- matrix->r3c3 = 0.0f;
+ matrix->row3_col1 = 0.0f;
+ matrix->row3_col2 = 0.0f;
+ matrix->row3_col3 = 0.0f;
}
inline void bgc_fp64_matrix3x3_reset(BGC_FP64_Matrix3x3* matrix)
{
- matrix->r1c1 = 0.0;
- matrix->r1c2 = 0.0;
- matrix->r1c3 = 0.0;
+ matrix->row1_col1 = 0.0;
+ matrix->row1_col2 = 0.0;
+ matrix->row1_col3 = 0.0;
- matrix->r2c1 = 0.0;
- matrix->r2c2 = 0.0;
- matrix->r2c3 = 0.0;
+ matrix->row2_col1 = 0.0;
+ matrix->row2_col2 = 0.0;
+ matrix->row2_col3 = 0.0;
- matrix->r3c1 = 0.0;
- matrix->r3c2 = 0.0;
- matrix->r3c3 = 0.0;
+ matrix->row3_col1 = 0.0;
+ matrix->row3_col2 = 0.0;
+ matrix->row3_col3 = 0.0;
}
// ================== Identity ================== //
inline void bgc_fp32_matrix3x3_make_identity(BGC_FP32_Matrix3x3* matrix)
{
- matrix->r1c1 = 1.0f;
- matrix->r1c2 = 0.0f;
- matrix->r1c3 = 0.0f;
+ matrix->row1_col1 = 1.0f;
+ matrix->row1_col2 = 0.0f;
+ matrix->row1_col3 = 0.0f;
- matrix->r2c1 = 0.0f;
- matrix->r2c2 = 1.0f;
- matrix->r2c3 = 0.0f;
+ matrix->row2_col1 = 0.0f;
+ matrix->row2_col2 = 1.0f;
+ matrix->row2_col3 = 0.0f;
- matrix->r3c1 = 0.0f;
- matrix->r3c2 = 0.0f;
- matrix->r3c3 = 1.0f;
+ matrix->row3_col1 = 0.0f;
+ matrix->row3_col2 = 0.0f;
+ matrix->row3_col3 = 1.0f;
}
inline void bgc_fp64_matrix3x3_make_identity(BGC_FP64_Matrix3x3* matrix)
{
- matrix->r1c1 = 1.0;
- matrix->r1c2 = 0.0;
- matrix->r1c3 = 0.0;
+ matrix->row1_col1 = 1.0;
+ matrix->row1_col2 = 0.0;
+ matrix->row1_col3 = 0.0;
- matrix->r2c1 = 0.0;
- matrix->r2c2 = 1.0;
- matrix->r2c3 = 0.0;
+ matrix->row2_col1 = 0.0;
+ matrix->row2_col2 = 1.0;
+ matrix->row2_col3 = 0.0;
- matrix->r3c1 = 0.0;
- matrix->r3c2 = 0.0;
- matrix->r3c3 = 1.0;
+ matrix->row3_col1 = 0.0;
+ matrix->row3_col2 = 0.0;
+ matrix->row3_col3 = 1.0;
}
// ================ Set Diagonal ================ //
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;
- matrix->r1c3 = 0.0f;
+ matrix->row1_col1 = d1;
+ matrix->row1_col2 = 0.0f;
+ matrix->row1_col3 = 0.0f;
- matrix->r2c1 = 0.0f;
- matrix->r2c2 = d2;
- matrix->r2c3 = 0.0f;
+ matrix->row2_col1 = 0.0f;
+ matrix->row2_col2 = d2;
+ matrix->row2_col3 = 0.0f;
- matrix->r3c1 = 0.0f;
- matrix->r3c2 = 0.0f;
- matrix->r3c3 = d2;
+ matrix->row3_col1 = 0.0f;
+ matrix->row3_col2 = 0.0f;
+ matrix->row3_col3 = d2;
}
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;
- matrix->r1c3 = 0.0;
+ matrix->row1_col1 = d1;
+ matrix->row1_col2 = 0.0;
+ matrix->row1_col3 = 0.0;
- matrix->r2c1 = 0.0;
- matrix->r2c2 = d2;
- matrix->r2c3 = 0.0;
+ matrix->row2_col1 = 0.0;
+ matrix->row2_col2 = d2;
+ matrix->row2_col3 = 0.0;
- matrix->r3c1 = 0.0;
- matrix->r3c2 = 0.0;
- matrix->r3c3 = d2;
+ matrix->row3_col1 = 0.0;
+ matrix->row3_col2 = 0.0;
+ matrix->row3_col3 = d2;
}
// ==================== Copy ==================== //
inline void bgc_fp32_matrix3x3_copy(BGC_FP32_Matrix3x3* destination, const BGC_FP32_Matrix3x3* source)
{
- destination->r1c1 = source->r1c1;
- destination->r1c2 = source->r1c2;
- destination->r1c3 = source->r1c3;
+ destination->row1_col1 = source->row1_col1;
+ destination->row1_col2 = source->row1_col2;
+ destination->row1_col3 = source->row1_col3;
- destination->r2c1 = source->r2c1;
- destination->r2c2 = source->r2c2;
- destination->r2c3 = source->r2c3;
+ destination->row2_col1 = source->row2_col1;
+ destination->row2_col2 = source->row2_col2;
+ destination->row2_col3 = source->row2_col3;
- destination->r3c1 = source->r3c1;
- destination->r3c2 = source->r3c2;
- destination->r3c3 = source->r3c3;
+ destination->row3_col1 = source->row3_col1;
+ destination->row3_col2 = source->row3_col2;
+ destination->row3_col3 = source->row3_col3;
}
inline void bgc_fp64_matrix3x3_copy(BGC_FP64_Matrix3x3* destination, const BGC_FP64_Matrix3x3* source)
{
- destination->r1c1 = source->r1c1;
- destination->r1c2 = source->r1c2;
- destination->r1c3 = source->r1c3;
+ destination->row1_col1 = source->row1_col1;
+ destination->row1_col2 = source->row1_col2;
+ destination->row1_col3 = source->row1_col3;
- destination->r2c1 = source->r2c1;
- destination->r2c2 = source->r2c2;
- destination->r2c3 = source->r2c3;
+ destination->row2_col1 = source->row2_col1;
+ destination->row2_col2 = source->row2_col2;
+ destination->row2_col3 = source->row2_col3;
- destination->r3c1 = source->r3c1;
- destination->r3c2 = source->r3c2;
- destination->r3c3 = source->r3c3;
+ destination->row3_col1 = source->row3_col1;
+ destination->row3_col2 = source->row3_col2;
+ destination->row3_col3 = source->row3_col3;
}
// ==================== Swap ==================== //
inline void bgc_fp32_matrix3x3_swap(BGC_FP32_Matrix3x3* matrix1, BGC_FP32_Matrix3x3* matrix2)
{
- const float r1c1 = matrix2->r1c1;
- const float r1c2 = matrix2->r1c2;
- const float r1c3 = matrix2->r1c3;
+ const float row1_col1 = matrix2->row1_col1;
+ const float row1_col2 = matrix2->row1_col2;
+ const float row1_col3 = matrix2->row1_col3;
- const float r2c1 = matrix2->r2c1;
- const float r2c2 = matrix2->r2c2;
- const float r2c3 = matrix2->r2c3;
+ const float row2_col1 = matrix2->row2_col1;
+ const float row2_col2 = matrix2->row2_col2;
+ const float row2_col3 = matrix2->row2_col3;
- const float r3c1 = matrix2->r3c1;
- const float r3c2 = matrix2->r3c2;
- const float r3c3 = matrix2->r3c3;
+ const float row3_col1 = matrix2->row3_col1;
+ const float row3_col2 = matrix2->row3_col2;
+ const float row3_col3 = matrix2->row3_col3;
- matrix2->r1c1 = matrix1->r1c1;
- matrix2->r1c2 = matrix1->r1c2;
- matrix2->r1c3 = matrix1->r1c3;
+ matrix2->row1_col1 = matrix1->row1_col1;
+ matrix2->row1_col2 = matrix1->row1_col2;
+ matrix2->row1_col3 = matrix1->row1_col3;
- matrix2->r2c1 = matrix1->r2c1;
- matrix2->r2c2 = matrix1->r2c2;
- matrix2->r2c3 = matrix1->r2c3;
+ matrix2->row2_col1 = matrix1->row2_col1;
+ matrix2->row2_col2 = matrix1->row2_col2;
+ matrix2->row2_col3 = matrix1->row2_col3;
- matrix2->r3c1 = matrix1->r3c1;
- matrix2->r3c2 = matrix1->r3c2;
- matrix2->r3c3 = matrix1->r3c3;
+ matrix2->row3_col1 = matrix1->row3_col1;
+ matrix2->row3_col2 = matrix1->row3_col2;
+ matrix2->row3_col3 = matrix1->row3_col3;
- matrix1->r1c1 = r1c1;
- matrix1->r1c2 = r1c2;
- matrix1->r1c3 = r1c3;
+ matrix1->row1_col1 = row1_col1;
+ matrix1->row1_col2 = row1_col2;
+ matrix1->row1_col3 = row1_col3;
- matrix1->r2c1 = r2c1;
- matrix1->r2c2 = r2c2;
- matrix1->r2c3 = r2c3;
+ matrix1->row2_col1 = row2_col1;
+ matrix1->row2_col2 = row2_col2;
+ matrix1->row2_col3 = row2_col3;
- matrix1->r3c1 = r3c1;
- matrix1->r3c2 = r3c2;
- matrix1->r3c3 = r3c3;
+ matrix1->row3_col1 = row3_col1;
+ matrix1->row3_col2 = row3_col2;
+ matrix1->row3_col3 = row3_col3;
}
inline void bgc_fp64_matrix3x3_swap(BGC_FP64_Matrix3x3* matrix1, BGC_FP64_Matrix3x3* matrix2)
{
- const double r1c1 = matrix2->r1c1;
- const double r1c2 = matrix2->r1c2;
- const double r1c3 = matrix2->r1c3;
+ const double row1_col1 = matrix2->row1_col1;
+ const double row1_col2 = matrix2->row1_col2;
+ const double row1_col3 = matrix2->row1_col3;
- const double r2c1 = matrix2->r2c1;
- const double r2c2 = matrix2->r2c2;
- const double r2c3 = matrix2->r2c3;
+ const double row2_col1 = matrix2->row2_col1;
+ const double row2_col2 = matrix2->row2_col2;
+ const double row2_col3 = matrix2->row2_col3;
- const double r3c1 = matrix2->r3c1;
- const double r3c2 = matrix2->r3c2;
- const double r3c3 = matrix2->r3c3;
+ const double row3_col1 = matrix2->row3_col1;
+ const double row3_col2 = matrix2->row3_col2;
+ const double row3_col3 = matrix2->row3_col3;
- matrix2->r1c1 = matrix1->r1c1;
- matrix2->r1c2 = matrix1->r1c2;
- matrix2->r1c3 = matrix1->r1c3;
+ matrix2->row1_col1 = matrix1->row1_col1;
+ matrix2->row1_col2 = matrix1->row1_col2;
+ matrix2->row1_col3 = matrix1->row1_col3;
- matrix2->r2c1 = matrix1->r2c1;
- matrix2->r2c2 = matrix1->r2c2;
- matrix2->r2c3 = matrix1->r2c3;
+ matrix2->row2_col1 = matrix1->row2_col1;
+ matrix2->row2_col2 = matrix1->row2_col2;
+ matrix2->row2_col3 = matrix1->row2_col3;
- matrix2->r3c1 = matrix1->r3c1;
- matrix2->r3c2 = matrix1->r3c2;
- matrix2->r3c3 = matrix1->r3c3;
+ matrix2->row3_col1 = matrix1->row3_col1;
+ matrix2->row3_col2 = matrix1->row3_col2;
+ matrix2->row3_col3 = matrix1->row3_col3;
- matrix1->r1c1 = r1c1;
- matrix1->r1c2 = r1c2;
- matrix1->r1c3 = r1c3;
+ matrix1->row1_col1 = row1_col1;
+ matrix1->row1_col2 = row1_col2;
+ matrix1->row1_col3 = row1_col3;
- matrix1->r2c1 = r2c1;
- matrix1->r2c2 = r2c2;
- matrix1->r2c3 = r2c3;
+ matrix1->row2_col1 = row2_col1;
+ matrix1->row2_col2 = row2_col2;
+ matrix1->row2_col3 = row2_col3;
- matrix1->r3c1 = r3c1;
- matrix1->r3c2 = r3c2;
- matrix1->r3c3 = r3c3;
+ matrix1->row3_col1 = row3_col1;
+ matrix1->row3_col2 = row3_col2;
+ matrix1->row3_col3 = row3_col3;
}
// ================== Convert =================== //
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;
- destination->r1c3 = (float)source->r1c3;
+ destination->row1_col1 = (float)source->row1_col1;
+ destination->row1_col2 = (float)source->row1_col2;
+ destination->row1_col3 = (float)source->row1_col3;
- destination->r2c1 = (float)source->r2c1;
- destination->r2c2 = (float)source->r2c2;
- destination->r2c3 = (float)source->r2c3;
+ destination->row2_col1 = (float)source->row2_col1;
+ destination->row2_col2 = (float)source->row2_col2;
+ destination->row2_col3 = (float)source->row2_col3;
- destination->r3c1 = (float)source->r3c1;
- destination->r3c2 = (float)source->r3c2;
- destination->r3c3 = (float)source->r3c3;
+ destination->row3_col1 = (float)source->row3_col1;
+ destination->row3_col2 = (float)source->row3_col2;
+ destination->row3_col3 = (float)source->row3_col3;
}
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;
- destination->r1c3 = source->r1c3;
+ destination->row1_col1 = source->row1_col1;
+ destination->row1_col2 = source->row1_col2;
+ destination->row1_col3 = source->row1_col3;
- destination->r2c1 = source->r2c1;
- destination->r2c2 = source->r2c2;
- destination->r2c3 = source->r2c3;
+ destination->row2_col1 = source->row2_col1;
+ destination->row2_col2 = source->row2_col2;
+ destination->row2_col3 = source->row2_col3;
- destination->r3c1 = source->r3c1;
- destination->r3c2 = source->r3c2;
- destination->r3c3 = source->r3c3;
+ destination->row3_col1 = source->row3_col1;
+ destination->row3_col2 = source->row3_col2;
+ destination->row3_col3 = source->row3_col3;
}
// ================ Determinant ================= //
inline float bgc_fp32_matrix3x3_get_determinant(const BGC_FP32_Matrix3x3* 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);
+ return matrix->row1_col1 * (matrix->row2_col2 * matrix->row3_col3 - matrix->row2_col3 * matrix->row3_col2)
+ + matrix->row1_col2 * (matrix->row2_col3 * matrix->row3_col1 - matrix->row2_col1 * matrix->row3_col3)
+ + matrix->row1_col3 * (matrix->row2_col1 * matrix->row3_col2 - matrix->row2_col2 * matrix->row3_col1);
}
inline double bgc_fp64_matrix3x3_get_determinant(const BGC_FP64_Matrix3x3* 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);
+ return matrix->row1_col1 * (matrix->row2_col2 * matrix->row3_col3 - matrix->row2_col3 * matrix->row3_col2)
+ + matrix->row1_col2 * (matrix->row2_col3 * matrix->row3_col1 - matrix->row2_col1 * matrix->row3_col3)
+ + matrix->row1_col3 * (matrix->row2_col1 * matrix->row3_col2 - matrix->row2_col2 * matrix->row3_col1);
}
// ================ Is Identity ================= //
inline int bgc_fp32_matrix3x3_is_identity(const BGC_FP32_Matrix3x3* matrix)
{
- return bgc_fp32_is_unit(matrix->r1c1) && bgc_fp32_is_zero(matrix->r1c2) && bgc_fp32_is_zero(matrix->r1c3)
- && bgc_fp32_is_zero(matrix->r2c1) && bgc_fp32_is_unit(matrix->r2c2) && bgc_fp32_is_zero(matrix->r2c3)
- && bgc_fp32_is_zero(matrix->r3c1) && bgc_fp32_is_zero(matrix->r3c2) && bgc_fp32_is_unit(matrix->r3c3);
+ return bgc_fp32_is_unit(matrix->row1_col1) && bgc_fp32_is_zero(matrix->row1_col2) && bgc_fp32_is_zero(matrix->row1_col3)
+ && bgc_fp32_is_zero(matrix->row2_col1) && bgc_fp32_is_unit(matrix->row2_col2) && bgc_fp32_is_zero(matrix->row2_col3)
+ && bgc_fp32_is_zero(matrix->row3_col1) && bgc_fp32_is_zero(matrix->row3_col2) && bgc_fp32_is_unit(matrix->row3_col3);
}
inline int bgc_fp64_matrix3x3_is_identity(const BGC_FP64_Matrix3x3* matrix)
{
- return bgc_fp64_is_unit(matrix->r1c1) && bgc_fp64_is_zero(matrix->r1c2) && bgc_fp64_is_zero(matrix->r1c3)
- && bgc_fp64_is_zero(matrix->r2c1) && bgc_fp64_is_unit(matrix->r2c2) && bgc_fp64_is_zero(matrix->r2c3)
- && bgc_fp64_is_zero(matrix->r3c1) && bgc_fp64_is_zero(matrix->r3c2) && bgc_fp64_is_unit(matrix->r3c3);
+ return bgc_fp64_is_unit(matrix->row1_col1) && bgc_fp64_is_zero(matrix->row1_col2) && bgc_fp64_is_zero(matrix->row1_col3)
+ && bgc_fp64_is_zero(matrix->row2_col1) && bgc_fp64_is_unit(matrix->row2_col2) && bgc_fp64_is_zero(matrix->row2_col3)
+ && bgc_fp64_is_zero(matrix->row3_col1) && bgc_fp64_is_zero(matrix->row3_col2) && bgc_fp64_is_unit(matrix->row3_col3);
}
// ================ Is Singular ================= //
@@ -294,17 +294,17 @@ inline int bgc_fp32_matrix3x3_is_rotation(const BGC_FP32_Matrix3x3* matrix)
{
BGC_FP32_Matrix3x3 product;
- product.r1c1 = matrix->r1c1 * matrix->r1c1 + matrix->r1c2 * matrix->r2c1 + matrix->r1c3 * matrix->r3c1;
- product.r1c2 = matrix->r1c1 * matrix->r1c2 + matrix->r1c2 * matrix->r2c2 + matrix->r1c3 * matrix->r3c2;
- product.r1c3 = matrix->r1c1 * matrix->r1c3 + matrix->r1c2 * matrix->r2c3 + matrix->r1c3 * matrix->r3c3;
+ product.row1_col1 = matrix->row1_col1 * matrix->row1_col1 + matrix->row1_col2 * matrix->row2_col1 + matrix->row1_col3 * matrix->row3_col1;
+ product.row1_col2 = matrix->row1_col1 * matrix->row1_col2 + matrix->row1_col2 * matrix->row2_col2 + matrix->row1_col3 * matrix->row3_col2;
+ product.row1_col3 = matrix->row1_col1 * matrix->row1_col3 + matrix->row1_col2 * matrix->row2_col3 + matrix->row1_col3 * matrix->row3_col3;
- product.r2c1 = matrix->r2c1 * matrix->r1c1 + matrix->r2c2 * matrix->r2c1 + matrix->r2c3 * matrix->r3c1;
- product.r2c2 = matrix->r2c1 * matrix->r1c2 + matrix->r2c2 * matrix->r2c2 + matrix->r2c3 * matrix->r3c2;
- product.r2c3 = matrix->r2c1 * matrix->r1c3 + matrix->r2c2 * matrix->r2c3 + matrix->r2c3 * matrix->r3c3;
+ product.row2_col1 = matrix->row2_col1 * matrix->row1_col1 + matrix->row2_col2 * matrix->row2_col1 + matrix->row2_col3 * matrix->row3_col1;
+ product.row2_col2 = matrix->row2_col1 * matrix->row1_col2 + matrix->row2_col2 * matrix->row2_col2 + matrix->row2_col3 * matrix->row3_col2;
+ product.row2_col3 = matrix->row2_col1 * matrix->row1_col3 + matrix->row2_col2 * matrix->row2_col3 + matrix->row2_col3 * matrix->row3_col3;
- product.r3c1 = matrix->r3c1 * matrix->r1c1 + matrix->r3c2 * matrix->r2c1 + matrix->r3c3 * matrix->r3c1;
- product.r3c2 = matrix->r3c1 * matrix->r1c2 + matrix->r3c2 * matrix->r2c2 + matrix->r3c3 * matrix->r3c2;
- product.r3c3 = matrix->r3c1 * matrix->r1c3 + matrix->r3c2 * matrix->r2c3 + matrix->r3c3 * matrix->r3c3;
+ product.row3_col1 = matrix->row3_col1 * matrix->row1_col1 + matrix->row3_col2 * matrix->row2_col1 + matrix->row3_col3 * matrix->row3_col1;
+ product.row3_col2 = matrix->row3_col1 * matrix->row1_col2 + matrix->row3_col2 * matrix->row2_col2 + matrix->row3_col3 * matrix->row3_col2;
+ product.row3_col3 = matrix->row3_col1 * matrix->row1_col3 + matrix->row3_col2 * matrix->row2_col3 + matrix->row3_col3 * matrix->row3_col3;
return bgc_fp32_matrix3x3_is_identity(&product);
}
@@ -313,17 +313,17 @@ inline int bgc_fp64_matrix3x3_is_rotation(const BGC_FP64_Matrix3x3* matrix)
{
BGC_FP64_Matrix3x3 product;
- product.r1c1 = matrix->r1c1 * matrix->r1c1 + matrix->r1c2 * matrix->r2c1 + matrix->r1c3 * matrix->r3c1;
- product.r1c2 = matrix->r1c1 * matrix->r1c2 + matrix->r1c2 * matrix->r2c2 + matrix->r1c3 * matrix->r3c2;
- product.r1c3 = matrix->r1c1 * matrix->r1c3 + matrix->r1c2 * matrix->r2c3 + matrix->r1c3 * matrix->r3c3;
+ product.row1_col1 = matrix->row1_col1 * matrix->row1_col1 + matrix->row1_col2 * matrix->row2_col1 + matrix->row1_col3 * matrix->row3_col1;
+ product.row1_col2 = matrix->row1_col1 * matrix->row1_col2 + matrix->row1_col2 * matrix->row2_col2 + matrix->row1_col3 * matrix->row3_col2;
+ product.row1_col3 = matrix->row1_col1 * matrix->row1_col3 + matrix->row1_col2 * matrix->row2_col3 + matrix->row1_col3 * matrix->row3_col3;
- product.r2c1 = matrix->r2c1 * matrix->r1c1 + matrix->r2c2 * matrix->r2c1 + matrix->r2c3 * matrix->r3c1;
- product.r2c2 = matrix->r2c1 * matrix->r1c2 + matrix->r2c2 * matrix->r2c2 + matrix->r2c3 * matrix->r3c2;
- product.r2c3 = matrix->r2c1 * matrix->r1c3 + matrix->r2c2 * matrix->r2c3 + matrix->r2c3 * matrix->r3c3;
+ product.row2_col1 = matrix->row2_col1 * matrix->row1_col1 + matrix->row2_col2 * matrix->row2_col1 + matrix->row2_col3 * matrix->row3_col1;
+ product.row2_col2 = matrix->row2_col1 * matrix->row1_col2 + matrix->row2_col2 * matrix->row2_col2 + matrix->row2_col3 * matrix->row3_col2;
+ product.row2_col3 = matrix->row2_col1 * matrix->row1_col3 + matrix->row2_col2 * matrix->row2_col3 + matrix->row2_col3 * matrix->row3_col3;
- product.r3c1 = matrix->r3c1 * matrix->r1c1 + matrix->r3c2 * matrix->r2c1 + matrix->r3c3 * matrix->r3c1;
- product.r3c2 = matrix->r3c1 * matrix->r1c2 + matrix->r3c2 * matrix->r2c2 + matrix->r3c3 * matrix->r3c2;
- product.r3c3 = matrix->r3c1 * matrix->r1c3 + matrix->r3c2 * matrix->r2c3 + matrix->r3c3 * matrix->r3c3;
+ product.row3_col1 = matrix->row3_col1 * matrix->row1_col1 + matrix->row3_col2 * matrix->row2_col1 + matrix->row3_col3 * matrix->row3_col1;
+ product.row3_col2 = matrix->row3_col1 * matrix->row1_col2 + matrix->row3_col2 * matrix->row2_col2 + matrix->row3_col3 * matrix->row3_col2;
+ product.row3_col3 = matrix->row3_col1 * matrix->row1_col3 + matrix->row3_col2 * matrix->row2_col3 + matrix->row3_col3 * matrix->row3_col3;
return bgc_fp64_matrix3x3_is_identity(&product);
}
@@ -350,72 +350,72 @@ inline int bgc_fp64_matrix3x3_invert(BGC_FP64_Matrix3x3* matrix)
inline void bgc_fp32_matrix3x3_transpose(BGC_FP32_Matrix3x3* matrix)
{
- const float r1c2 = matrix->r1c2;
- const float r1c3 = matrix->r1c3;
- const float r2c3 = matrix->r2c3;
+ const float row1_col2 = matrix->row1_col2;
+ const float row1_col3 = matrix->row1_col3;
+ const float row2_col3 = matrix->row2_col3;
- matrix->r1c2 = matrix->r2c1;
- matrix->r1c3 = matrix->r3c1;
- matrix->r2c3 = matrix->r3c2;
+ matrix->row1_col2 = matrix->row2_col1;
+ matrix->row1_col3 = matrix->row3_col1;
+ matrix->row2_col3 = matrix->row3_col2;
- matrix->r2c1 = r1c2;
- matrix->r3c1 = r1c3;
- matrix->r3c2 = r2c3;
+ matrix->row2_col1 = row1_col2;
+ matrix->row3_col1 = row1_col3;
+ matrix->row3_col2 = row2_col3;
}
inline void bgc_fp64_matrix3x3_transpose(BGC_FP64_Matrix3x3* matrix)
{
- const double r1c2 = matrix->r1c2;
- const double r1c3 = matrix->r1c3;
- const double r2c3 = matrix->r2c3;
+ const double row1_col2 = matrix->row1_col2;
+ const double row1_col3 = matrix->row1_col3;
+ const double row2_col3 = matrix->row2_col3;
- matrix->r1c2 = matrix->r2c1;
- matrix->r1c3 = matrix->r3c1;
- matrix->r2c3 = matrix->r3c2;
+ matrix->row1_col2 = matrix->row2_col1;
+ matrix->row1_col3 = matrix->row3_col1;
+ matrix->row2_col3 = matrix->row3_col2;
- matrix->r2c1 = r1c2;
- matrix->r3c1 = r1c3;
- matrix->r3c2 = r2c3;
+ matrix->row2_col1 = row1_col2;
+ matrix->row3_col1 = row1_col3;
+ matrix->row3_col2 = row2_col3;
}
// =============== Get Transpose ================ //
inline void bgc_fp32_matrix3x3_get_transposed(BGC_FP32_Matrix3x3* transposed, const BGC_FP32_Matrix3x3* matrix)
{
- transposed->r1c1 = matrix->r1c1;
- transposed->r2c2 = matrix->r2c2;
- transposed->r3c3 = matrix->r3c3;
+ transposed->row1_col1 = matrix->row1_col1;
+ transposed->row2_col2 = matrix->row2_col2;
+ transposed->row3_col3 = matrix->row3_col3;
- const float r1c2 = matrix->r1c2;
- const float r1c3 = matrix->r1c3;
- const float r2c3 = matrix->r2c3;
+ const float row1_col2 = matrix->row1_col2;
+ const float row1_col3 = matrix->row1_col3;
+ const float row2_col3 = matrix->row2_col3;
- transposed->r1c2 = matrix->r2c1;
- transposed->r1c3 = matrix->r3c1;
- transposed->r2c3 = matrix->r3c2;
+ transposed->row1_col2 = matrix->row2_col1;
+ transposed->row1_col3 = matrix->row3_col1;
+ transposed->row2_col3 = matrix->row3_col2;
- transposed->r2c1 = r1c2;
- transposed->r3c1 = r1c3;
- transposed->r3c2 = r2c3;
+ transposed->row2_col1 = row1_col2;
+ transposed->row3_col1 = row1_col3;
+ transposed->row3_col2 = row2_col3;
}
inline void bgc_fp64_matrix3x3_get_transposed(BGC_FP64_Matrix3x3* transposed, const BGC_FP64_Matrix3x3* matrix)
{
- transposed->r1c1 = matrix->r1c1;
- transposed->r2c2 = matrix->r2c2;
- transposed->r3c3 = matrix->r3c3;
+ transposed->row1_col1 = matrix->row1_col1;
+ transposed->row2_col2 = matrix->row2_col2;
+ transposed->row3_col3 = matrix->row3_col3;
- const double r1c2 = matrix->r1c2;
- const double r1c3 = matrix->r1c3;
- const double r2c3 = matrix->r2c3;
+ const double row1_col2 = matrix->row1_col2;
+ const double row1_col3 = matrix->row1_col3;
+ const double row2_col3 = matrix->row2_col3;
- transposed->r1c2 = matrix->r2c1;
- transposed->r1c3 = matrix->r3c1;
- transposed->r2c3 = matrix->r3c2;
+ transposed->row1_col2 = matrix->row2_col1;
+ transposed->row1_col3 = matrix->row3_col1;
+ transposed->row2_col3 = matrix->row3_col2;
- transposed->r2c1 = r1c2;
- transposed->r3c1 = r1c3;
- transposed->r3c2 = r2c3;
+ transposed->row2_col1 = row1_col2;
+ transposed->row3_col1 = row1_col3;
+ transposed->row3_col2 = row2_col3;
}
// ================== Get Row -================== //
@@ -424,25 +424,25 @@ inline void bgc_fp32_matrix3x3_get_row(BGC_FP32_Vector3* row, const BGC_FP32_Mat
{
if (row_number == 1)
{
- row->x1 = matrix->r1c1;
- row->x2 = matrix->r1c2;
- row->x3 = matrix->r1c3;
+ row->x1 = matrix->row1_col1;
+ row->x2 = matrix->row1_col2;
+ row->x3 = matrix->row1_col3;
return;
}
if (row_number == 2)
{
- row->x1 = matrix->r2c1;
- row->x2 = matrix->r2c2;
- row->x3 = matrix->r2c3;
+ row->x1 = matrix->row2_col1;
+ row->x2 = matrix->row2_col2;
+ row->x3 = matrix->row2_col3;
return;
}
if (row_number == 3)
{
- row->x1 = matrix->r3c1;
- row->x2 = matrix->r3c2;
- row->x3 = matrix->r3c3;
+ row->x1 = matrix->row3_col1;
+ row->x2 = matrix->row3_col2;
+ row->x3 = matrix->row3_col3;
return;
}
@@ -455,25 +455,25 @@ inline void bgc_fp64_matrix3x3_get_row(BGC_FP64_Vector3* row, const BGC_FP64_Mat
{
if (row_number == 1)
{
- row->x1 = matrix->r1c1;
- row->x2 = matrix->r1c2;
- row->x3 = matrix->r1c3;
+ row->x1 = matrix->row1_col1;
+ row->x2 = matrix->row1_col2;
+ row->x3 = matrix->row1_col3;
return;
}
if (row_number == 2)
{
- row->x1 = matrix->r2c1;
- row->x2 = matrix->r2c2;
- row->x3 = matrix->r2c3;
+ row->x1 = matrix->row2_col1;
+ row->x2 = matrix->row2_col2;
+ row->x3 = matrix->row2_col3;
return;
}
if (row_number == 3)
{
- row->x1 = matrix->r3c1;
- row->x2 = matrix->r3c2;
- row->x3 = matrix->r3c3;
+ row->x1 = matrix->row3_col1;
+ row->x2 = matrix->row3_col2;
+ row->x3 = matrix->row3_col3;
return;
}
@@ -488,25 +488,25 @@ inline void bgc_fp32_matrix3x3_set_row(BGC_FP32_Matrix3x3* matrix, const int row
{
if (row_number == 1)
{
- matrix->r1c1 = row->x1;
- matrix->r1c2 = row->x2;
- matrix->r1c3 = row->x3;
+ matrix->row1_col1 = row->x1;
+ matrix->row1_col2 = row->x2;
+ matrix->row1_col3 = row->x3;
return;
}
if (row_number == 2)
{
- matrix->r2c1 = row->x1;
- matrix->r2c2 = row->x2;
- matrix->r2c3 = row->x3;
+ matrix->row2_col1 = row->x1;
+ matrix->row2_col2 = row->x2;
+ matrix->row2_col3 = row->x3;
return;
}
if (row_number == 3)
{
- matrix->r3c1 = row->x1;
- matrix->r3c2 = row->x2;
- matrix->r3c3 = row->x3;
+ matrix->row3_col1 = row->x1;
+ matrix->row3_col2 = row->x2;
+ matrix->row3_col3 = row->x3;
}
}
@@ -514,25 +514,25 @@ inline void bgc_fp64_matrix3x3_set_row(BGC_FP64_Matrix3x3* matrix, const int row
{
if (row_number == 1)
{
- matrix->r1c1 = row->x1;
- matrix->r1c2 = row->x2;
- matrix->r1c3 = row->x3;
+ matrix->row1_col1 = row->x1;
+ matrix->row1_col2 = row->x2;
+ matrix->row1_col3 = row->x3;
return;
}
if (row_number == 2)
{
- matrix->r2c1 = row->x1;
- matrix->r2c2 = row->x2;
- matrix->r2c3 = row->x3;
+ matrix->row2_col1 = row->x1;
+ matrix->row2_col2 = row->x2;
+ matrix->row2_col3 = row->x3;
return;
}
if (row_number == 3)
{
- matrix->r3c1 = row->x1;
- matrix->r3c2 = row->x2;
- matrix->r3c3 = row->x3;
+ matrix->row3_col1 = row->x1;
+ matrix->row3_col2 = row->x2;
+ matrix->row3_col3 = row->x3;
}
}
@@ -542,25 +542,25 @@ inline void bgc_fp32_matrix3x3_get_column(BGC_FP32_Vector3* column, const BGC_FP
{
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;
return;
}
if (column_number == 3)
{
- column->x1 = matrix->r1c3;
- column->x2 = matrix->r2c3;
- column->x3 = matrix->r3c3;
+ column->x1 = matrix->row1_col3;
+ column->x2 = matrix->row2_col3;
+ column->x3 = matrix->row3_col3;
return;
}
@@ -573,25 +573,25 @@ inline void bgc_fp64_matrix3x3_get_column(BGC_FP64_Vector3* column, const BGC_FP
{
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;
return;
}
if (column_number == 3)
{
- column->x1 = matrix->r1c3;
- column->x2 = matrix->r2c3;
- column->x3 = matrix->r3c3;
+ column->x1 = matrix->row1_col3;
+ column->x2 = matrix->row2_col3;
+ column->x3 = matrix->row3_col3;
return;
}
@@ -606,25 +606,25 @@ inline void bgc_fp32_matrix3x3_set_column(BGC_FP32_Matrix3x3* matrix, const int
{
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;
return;
}
if (column_number == 3)
{
- matrix->r1c3 = column->x1;
- matrix->r2c3 = column->x2;
- matrix->r3c3 = column->x3;
+ matrix->row1_col3 = column->x1;
+ matrix->row2_col3 = column->x2;
+ matrix->row3_col3 = column->x3;
}
}
@@ -632,25 +632,25 @@ inline void bgc_fp64_matrix3x3_set_column(BGC_FP64_Matrix3x3* matrix, const int
{
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;
return;
}
if (column_number == 3)
{
- matrix->r1c3 = column->x1;
- matrix->r2c3 = column->x2;
- matrix->r3c3 = column->x3;
+ matrix->row1_col3 = column->x1;
+ matrix->row2_col3 = column->x2;
+ matrix->row3_col3 = column->x3;
}
}
@@ -658,128 +658,128 @@ inline void bgc_fp64_matrix3x3_set_column(BGC_FP64_Matrix3x3* matrix, const int
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;
- sum->r1c3 = matrix1->r1c3 + matrix2->r1c3;
+ sum->row1_col1 = matrix1->row1_col1 + matrix2->row1_col1;
+ sum->row1_col2 = matrix1->row1_col2 + matrix2->row1_col2;
+ sum->row1_col3 = matrix1->row1_col3 + matrix2->row1_col3;
- sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
- sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
- sum->r2c3 = matrix1->r2c3 + matrix2->r2c3;
+ sum->row2_col1 = matrix1->row2_col1 + matrix2->row2_col1;
+ sum->row2_col2 = matrix1->row2_col2 + matrix2->row2_col2;
+ sum->row2_col3 = matrix1->row2_col3 + matrix2->row2_col3;
- sum->r3c1 = matrix1->r3c1 + matrix2->r3c1;
- sum->r3c2 = matrix1->r3c2 + matrix2->r3c2;
- sum->r3c3 = matrix1->r3c3 + matrix2->r3c3;
+ sum->row3_col1 = matrix1->row3_col1 + matrix2->row3_col1;
+ sum->row3_col2 = matrix1->row3_col2 + matrix2->row3_col2;
+ sum->row3_col3 = matrix1->row3_col3 + matrix2->row3_col3;
}
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;
- sum->r1c3 = matrix1->r1c3 + matrix2->r1c3;
+ sum->row1_col1 = matrix1->row1_col1 + matrix2->row1_col1;
+ sum->row1_col2 = matrix1->row1_col2 + matrix2->row1_col2;
+ sum->row1_col3 = matrix1->row1_col3 + matrix2->row1_col3;
- sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
- sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
- sum->r2c3 = matrix1->r2c3 + matrix2->r2c3;
+ sum->row2_col1 = matrix1->row2_col1 + matrix2->row2_col1;
+ sum->row2_col2 = matrix1->row2_col2 + matrix2->row2_col2;
+ sum->row2_col3 = matrix1->row2_col3 + matrix2->row2_col3;
- sum->r3c1 = matrix1->r3c1 + matrix2->r3c1;
- sum->r3c2 = matrix1->r3c2 + matrix2->r3c2;
- sum->r3c3 = matrix1->r3c3 + matrix2->r3c3;
+ sum->row3_col1 = matrix1->row3_col1 + matrix2->row3_col1;
+ sum->row3_col2 = matrix1->row3_col2 + matrix2->row3_col2;
+ sum->row3_col3 = matrix1->row3_col3 + matrix2->row3_col3;
}
// ================= Add scaled ================= //
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;
- sum->r1c3 = basic_matrix->r1c3 + scalable_matrix->r1c3 * scale;
+ sum->row1_col1 = basic_matrix->row1_col1 + scalable_matrix->row1_col1 * scale;
+ sum->row1_col2 = basic_matrix->row1_col2 + scalable_matrix->row1_col2 * scale;
+ sum->row1_col3 = basic_matrix->row1_col3 + scalable_matrix->row1_col3 * scale;
- sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
- sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
- sum->r2c3 = basic_matrix->r2c3 + scalable_matrix->r2c3 * scale;
+ sum->row2_col1 = basic_matrix->row2_col1 + scalable_matrix->row2_col1 * scale;
+ sum->row2_col2 = basic_matrix->row2_col2 + scalable_matrix->row2_col2 * scale;
+ sum->row2_col3 = basic_matrix->row2_col3 + scalable_matrix->row2_col3 * scale;
- sum->r3c1 = basic_matrix->r3c1 + scalable_matrix->r3c1 * scale;
- sum->r3c2 = basic_matrix->r3c2 + scalable_matrix->r3c2 * scale;
- sum->r3c3 = basic_matrix->r3c3 + scalable_matrix->r3c3 * scale;
+ sum->row3_col1 = basic_matrix->row3_col1 + scalable_matrix->row3_col1 * scale;
+ sum->row3_col2 = basic_matrix->row3_col2 + scalable_matrix->row3_col2 * scale;
+ sum->row3_col3 = basic_matrix->row3_col3 + scalable_matrix->row3_col3 * scale;
}
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;
- sum->r1c3 = basic_matrix->r1c3 + scalable_matrix->r1c3 * scale;
+ sum->row1_col1 = basic_matrix->row1_col1 + scalable_matrix->row1_col1 * scale;
+ sum->row1_col2 = basic_matrix->row1_col2 + scalable_matrix->row1_col2 * scale;
+ sum->row1_col3 = basic_matrix->row1_col3 + scalable_matrix->row1_col3 * scale;
- sum->r2c1 = basic_matrix->r2c1 + scalable_matrix->r2c1 * scale;
- sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
- sum->r2c3 = basic_matrix->r2c3 + scalable_matrix->r2c3 * scale;
+ sum->row2_col1 = basic_matrix->row2_col1 + scalable_matrix->row2_col1 * scale;
+ sum->row2_col2 = basic_matrix->row2_col2 + scalable_matrix->row2_col2 * scale;
+ sum->row2_col3 = basic_matrix->row2_col3 + scalable_matrix->row2_col3 * scale;
- sum->r3c1 = basic_matrix->r3c1 + scalable_matrix->r3c1 * scale;
- sum->r3c2 = basic_matrix->r3c2 + scalable_matrix->r3c2 * scale;
- sum->r3c3 = basic_matrix->r3c3 + scalable_matrix->r3c3 * scale;
+ sum->row3_col1 = basic_matrix->row3_col1 + scalable_matrix->row3_col1 * scale;
+ sum->row3_col2 = basic_matrix->row3_col2 + scalable_matrix->row3_col2 * scale;
+ sum->row3_col3 = basic_matrix->row3_col3 + scalable_matrix->row3_col3 * scale;
}
// ================== Subtract ================== //
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;
- difference->r1c3 = minuend->r1c3 - subtrahend->r1c3;
+ difference->row1_col1 = minuend->row1_col1 - subtrahend->row1_col1;
+ difference->row1_col2 = minuend->row1_col2 - subtrahend->row1_col2;
+ difference->row1_col3 = minuend->row1_col3 - subtrahend->row1_col3;
- difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
- difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
- difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
+ difference->row2_col1 = minuend->row2_col1 - subtrahend->row2_col1;
+ difference->row2_col2 = minuend->row2_col2 - subtrahend->row2_col2;
+ difference->row2_col3 = minuend->row2_col3 - subtrahend->row2_col3;
- difference->r3c1 = minuend->r3c1 - subtrahend->r3c1;
- difference->r3c2 = minuend->r3c2 - subtrahend->r3c2;
- difference->r3c3 = minuend->r3c3 - subtrahend->r3c3;
+ difference->row3_col1 = minuend->row3_col1 - subtrahend->row3_col1;
+ difference->row3_col2 = minuend->row3_col2 - subtrahend->row3_col2;
+ difference->row3_col3 = minuend->row3_col3 - subtrahend->row3_col3;
}
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;
- difference->r1c3 = minuend->r1c3 - subtrahend->r1c3;
+ difference->row1_col1 = minuend->row1_col1 - subtrahend->row1_col1;
+ difference->row1_col2 = minuend->row1_col2 - subtrahend->row1_col2;
+ difference->row1_col3 = minuend->row1_col3 - subtrahend->row1_col3;
- difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
- difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
- difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
+ difference->row2_col1 = minuend->row2_col1 - subtrahend->row2_col1;
+ difference->row2_col2 = minuend->row2_col2 - subtrahend->row2_col2;
+ difference->row2_col3 = minuend->row2_col3 - subtrahend->row2_col3;
- difference->r3c1 = minuend->r3c1 - subtrahend->r3c1;
- difference->r3c2 = minuend->r3c2 - subtrahend->r3c2;
- difference->r3c3 = minuend->r3c3 - subtrahend->r3c3;
+ difference->row3_col1 = minuend->row3_col1 - subtrahend->row3_col1;
+ difference->row3_col2 = minuend->row3_col2 - subtrahend->row3_col2;
+ difference->row3_col3 = minuend->row3_col3 - subtrahend->row3_col3;
}
// ================== Multiply ================== //
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;
- product->r1c3 = multiplicand->r1c3 * multiplier;
+ product->row1_col1 = multiplicand->row1_col1 * multiplier;
+ product->row1_col2 = multiplicand->row1_col2 * multiplier;
+ product->row1_col3 = multiplicand->row1_col3 * multiplier;
- product->r2c1 = multiplicand->r2c1 * multiplier;
- product->r2c2 = multiplicand->r2c2 * multiplier;
- product->r2c3 = multiplicand->r2c3 * multiplier;
+ product->row2_col1 = multiplicand->row2_col1 * multiplier;
+ product->row2_col2 = multiplicand->row2_col2 * multiplier;
+ product->row2_col3 = multiplicand->row2_col3 * multiplier;
- product->r3c1 = multiplicand->r3c1 * multiplier;
- product->r3c2 = multiplicand->r3c2 * multiplier;
- product->r3c3 = multiplicand->r3c3 * multiplier;
+ product->row3_col1 = multiplicand->row3_col1 * multiplier;
+ product->row3_col2 = multiplicand->row3_col2 * multiplier;
+ product->row3_col3 = multiplicand->row3_col3 * multiplier;
}
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;
- product->r1c3 = multiplicand->r1c3 * multiplier;
+ product->row1_col1 = multiplicand->row1_col1 * multiplier;
+ product->row1_col2 = multiplicand->row1_col2 * multiplier;
+ product->row1_col3 = multiplicand->row1_col3 * multiplier;
- product->r2c1 = multiplicand->r2c1 * multiplier;
- product->r2c2 = multiplicand->r2c2 * multiplier;
- product->r2c3 = multiplicand->r2c3 * multiplier;
+ product->row2_col1 = multiplicand->row2_col1 * multiplier;
+ product->row2_col2 = multiplicand->row2_col2 * multiplier;
+ product->row2_col3 = multiplicand->row2_col3 * multiplier;
- product->r3c1 = multiplicand->r3c1 * multiplier;
- product->r3c2 = multiplicand->r3c2 * multiplier;
- product->r3c3 = multiplicand->r3c3 * multiplier;
+ product->row3_col1 = multiplicand->row3_col1 * multiplier;
+ product->row3_col2 = multiplicand->row3_col2 * multiplier;
+ product->row3_col3 = multiplicand->row3_col3 * multiplier;
}
// =================== Divide =================== //
@@ -800,43 +800,43 @@ inline void bgc_fp32_matrix3x3_interpolate(BGC_FP32_Matrix3x3* interpolation, co
{
const float counter_phase = 1.0f - phase;
- interpolation->r1c1 = first->r1c1 * counter_phase + second->r1c1 * phase;
- interpolation->r1c2 = first->r1c2 * counter_phase + second->r1c2 * phase;
- interpolation->r1c3 = first->r1c3 * counter_phase + second->r1c3 * phase;
+ interpolation->row1_col1 = first->row1_col1 * counter_phase + second->row1_col1 * phase;
+ interpolation->row1_col2 = first->row1_col2 * counter_phase + second->row1_col2 * phase;
+ interpolation->row1_col3 = first->row1_col3 * counter_phase + second->row1_col3 * phase;
- interpolation->r2c1 = first->r2c1 * counter_phase + second->r2c1 * phase;
- interpolation->r2c2 = first->r2c2 * counter_phase + second->r2c2 * phase;
- interpolation->r2c3 = first->r2c3 * counter_phase + second->r2c3 * phase;
+ interpolation->row2_col1 = first->row2_col1 * counter_phase + second->row2_col1 * phase;
+ interpolation->row2_col2 = first->row2_col2 * counter_phase + second->row2_col2 * phase;
+ interpolation->row2_col3 = first->row2_col3 * counter_phase + second->row2_col3 * phase;
- interpolation->r3c1 = first->r3c1 * counter_phase + second->r3c1 * phase;
- interpolation->r3c2 = first->r3c2 * counter_phase + second->r3c2 * phase;
- interpolation->r3c3 = first->r3c3 * counter_phase + second->r3c3 * phase;
+ interpolation->row3_col1 = first->row3_col1 * counter_phase + second->row3_col1 * phase;
+ interpolation->row3_col2 = first->row3_col2 * counter_phase + second->row3_col2 * phase;
+ interpolation->row3_col3 = first->row3_col3 * counter_phase + second->row3_col3 * phase;
}
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;
- interpolation->r1c1 = first->r1c1 * counter_phase + second->r1c1 * phase;
- interpolation->r1c2 = first->r1c2 * counter_phase + second->r1c2 * phase;
- interpolation->r1c3 = first->r1c3 * counter_phase + second->r1c3 * phase;
+ interpolation->row1_col1 = first->row1_col1 * counter_phase + second->row1_col1 * phase;
+ interpolation->row1_col2 = first->row1_col2 * counter_phase + second->row1_col2 * phase;
+ interpolation->row1_col3 = first->row1_col3 * counter_phase + second->row1_col3 * phase;
- interpolation->r2c1 = first->r2c1 * counter_phase + second->r2c1 * phase;
- interpolation->r2c2 = first->r2c2 * counter_phase + second->r2c2 * phase;
- interpolation->r2c3 = first->r2c3 * counter_phase + second->r2c3 * phase;
+ interpolation->row2_col1 = first->row2_col1 * counter_phase + second->row2_col1 * phase;
+ interpolation->row2_col2 = first->row2_col2 * counter_phase + second->row2_col2 * phase;
+ interpolation->row2_col3 = first->row2_col3 * counter_phase + second->row2_col3 * phase;
- interpolation->r3c1 = first->r3c1 * counter_phase + second->r3c1 * phase;
- interpolation->r3c2 = first->r3c2 * counter_phase + second->r3c2 * phase;
- interpolation->r3c3 = first->r3c3 * counter_phase + second->r3c3 * phase;
+ interpolation->row3_col1 = first->row3_col1 * counter_phase + second->row3_col1 * phase;
+ interpolation->row3_col2 = first->row3_col2 * counter_phase + second->row3_col2 * phase;
+ interpolation->row3_col3 = first->row3_col3 * counter_phase + second->row3_col3 * phase;
}
// ============ Left Vector Product ============= //
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;
+ const float x1 = vector->x1 * matrix->row1_col1 + vector->x2 * matrix->row2_col1 + vector->x3 * matrix->row3_col1;
+ const float x2 = vector->x1 * matrix->row1_col2 + vector->x2 * matrix->row2_col2 + vector->x3 * matrix->row3_col2;
+ const float x3 = vector->x1 * matrix->row1_col3 + vector->x2 * matrix->row2_col3 + vector->x3 * matrix->row3_col3;
product->x1 = x1;
product->x2 = x2;
@@ -845,9 +845,9 @@ inline void bgc_fp32_multiply_vector3_by_matrix3x3(BGC_FP32_Vector3* product, co
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;
+ const double x1 = vector->x1 * matrix->row1_col1 + vector->x2 * matrix->row2_col1 + vector->x3 * matrix->row3_col1;
+ const double x2 = vector->x1 * matrix->row1_col2 + vector->x2 * matrix->row2_col2 + vector->x3 * matrix->row3_col2;
+ const double x3 = vector->x1 * matrix->row1_col3 + vector->x2 * matrix->row2_col3 + vector->x3 * matrix->row3_col3;
product->x1 = x1;
product->x2 = x2;
@@ -858,9 +858,9 @@ inline void bgc_fp64_multiply_vector3_by_matrix3x3(BGC_FP64_Vector3* product, co
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;
+ const float x1 = matrix->row1_col1 * vector->x1 + matrix->row1_col2 * vector->x2 + matrix->row1_col3 * vector->x3;
+ const float x2 = matrix->row2_col1 * vector->x1 + matrix->row2_col2 * vector->x2 + matrix->row2_col3 * vector->x3;
+ const float x3 = matrix->row3_col1 * vector->x1 + matrix->row3_col2 * vector->x2 + matrix->row3_col3 * vector->x3;
product->x1 = x1;
product->x2 = x2;
@@ -869,9 +869,9 @@ inline void bgc_fp32_multiply_matrix3x3_by_vector3(BGC_FP32_Vector3* product, co
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;
+ const double x1 = matrix->row1_col1 * vector->x1 + matrix->row1_col2 * vector->x2 + matrix->row1_col3 * vector->x3;
+ const double x2 = matrix->row2_col1 * vector->x1 + matrix->row2_col2 * vector->x2 + matrix->row2_col3 * vector->x3;
+ const double x3 = matrix->row3_col1 * vector->x1 + matrix->row3_col2 * vector->x2 + matrix->row3_col3 * vector->x3;
product->x1 = x1;
product->x2 = x2;
diff --git a/basic-geometry/quaternion.c b/basic-geometry/quaternion.c
index bedd7bf..e7cc0eb 100644
--- a/basic-geometry/quaternion.c
+++ b/basic-geometry/quaternion.c
@@ -114,7 +114,7 @@ int bgc_fp32_quaternion_get_exponation(BGC_FP32_Quaternion* power, const BGC_FP3
return 0;
}
- if (square_vector <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_vector <= BGC_FP32_SQUARE_EPSILON) {
if (base->s0 < 0.0f) {
return 0;
}
@@ -155,7 +155,7 @@ int bgc_fp64_quaternion_get_exponation(BGC_FP64_Quaternion* power, const BGC_FP6
return 0;
}
- if (square_vector <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_vector <= BGC_FP64_SQUARE_EPSILON) {
if (base->s0 < 0.0) {
return 0;
}
diff --git a/basic-geometry/quaternion.h b/basic-geometry/quaternion.h
index b6491d2..dfc6085 100644
--- a/basic-geometry/quaternion.h
+++ b/basic-geometry/quaternion.h
@@ -97,12 +97,12 @@ inline double bgc_fp64_quaternion_get_modulus(const BGC_FP64_Quaternion* quatern
inline int bgc_fp32_quaternion_is_zero(const BGC_FP32_Quaternion* quaternion)
{
- return bgc_fp32_quaternion_get_square_modulus(quaternion) <= BGC_FP32_SQUARE_EPSYLON;
+ return bgc_fp32_quaternion_get_square_modulus(quaternion) <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_quaternion_is_zero(const BGC_FP64_Quaternion* quaternion)
{
- return bgc_fp64_quaternion_get_square_modulus(quaternion) <= BGC_FP64_SQUARE_EPSYLON;
+ return bgc_fp64_quaternion_get_square_modulus(quaternion) <= BGC_FP64_SQUARE_EPSILON;
}
// ================== Is Unit =================== //
@@ -295,7 +295,7 @@ inline int bgc_fp32_quaternion_get_ratio(BGC_FP32_Quaternion* quotient, const BG
{
const float square_modulus = bgc_fp32_quaternion_get_square_modulus(divisor);
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -318,7 +318,7 @@ inline int bgc_fp64_quaternion_get_ratio(BGC_FP64_Quaternion* quotient, const BG
{
const double square_modulus = bgc_fp64_quaternion_get_square_modulus(divisor);
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -477,7 +477,7 @@ inline int bgc_fp32_quaternion_get_inverse(BGC_FP32_Quaternion* inverse, const B
{
const float square_modulus = bgc_fp32_quaternion_get_square_modulus(quaternion);
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -495,7 +495,7 @@ inline int bgc_fp64_quaternion_get_inverse(BGC_FP64_Quaternion* inverse, const B
{
const double square_modulus = bgc_fp64_quaternion_get_square_modulus(quaternion);
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -529,7 +529,7 @@ inline int bgc_fp32_quaternion_normalize(BGC_FP32_Quaternion* quaternion)
return 1;
}
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -551,7 +551,7 @@ inline int bgc_fp64_quaternion_normalize(BGC_FP64_Quaternion* quaternion)
return 1;
}
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -574,7 +574,7 @@ inline int bgc_fp32_quaternion_get_normalized(BGC_FP32_Quaternion* normalized, c
return 1;
}
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
bgc_fp32_quaternion_reset(normalized);
return 0;
}
@@ -592,7 +592,7 @@ inline int bgc_fp64_quaternion_get_normalized(BGC_FP64_Quaternion* normalized, c
return 1;
}
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
bgc_fp64_quaternion_reset(normalized);
return 0;
}
@@ -618,7 +618,7 @@ inline int bgc_fp32_quaternion_get_rotation_matrix(BGC_FP32_Matrix3x3* rotation,
const float square_modulus = (s0s0 + x1x1) + (x2x2 + x3x3);
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus))
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus))
{
bgc_fp32_matrix3x3_make_identity(rotation);
return 0;
@@ -635,17 +635,17 @@ inline int bgc_fp32_quaternion_get_rotation_matrix(BGC_FP32_Matrix3x3* rotation,
const float corrector2 = 2.0f * corrector1;
- rotation->r1c1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
- rotation->r2c2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
- rotation->r3c3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
+ rotation->row1_col1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
+ rotation->row2_col2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
+ rotation->row3_col3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
- rotation->r1c2 = corrector2 * (x1x2 - s0x3);
- rotation->r2c3 = corrector2 * (x2x3 - s0x1);
- rotation->r3c1 = corrector2 * (x1x3 - s0x2);
+ rotation->row1_col2 = corrector2 * (x1x2 - s0x3);
+ rotation->row2_col3 = corrector2 * (x2x3 - s0x1);
+ rotation->row3_col1 = corrector2 * (x1x3 - s0x2);
- rotation->r2c1 = corrector2 * (x1x2 + s0x3);
- rotation->r3c2 = corrector2 * (x2x3 + s0x1);
- rotation->r1c3 = corrector2 * (x1x3 + s0x2);
+ rotation->row2_col1 = corrector2 * (x1x2 + s0x3);
+ rotation->row3_col2 = corrector2 * (x2x3 + s0x1);
+ rotation->row1_col3 = corrector2 * (x1x3 + s0x2);
return 1;
}
@@ -659,7 +659,7 @@ inline int bgc_fp64_quaternion_get_rotation_matrix(BGC_FP64_Matrix3x3* rotation,
const double square_modulus = (s0s0 + x1x1) + (x2x2 + x3x3);
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus))
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus))
{
bgc_fp64_matrix3x3_make_identity(rotation);
return 0;
@@ -676,17 +676,17 @@ inline int bgc_fp64_quaternion_get_rotation_matrix(BGC_FP64_Matrix3x3* rotation,
const double corrector2 = 2.0f * corrector1;
- rotation->r1c1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
- rotation->r2c2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
- rotation->r3c3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
+ rotation->row1_col1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
+ rotation->row2_col2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
+ rotation->row3_col3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
- rotation->r1c2 = corrector2 * (x1x2 - s0x3);
- rotation->r2c3 = corrector2 * (x2x3 - s0x1);
- rotation->r3c1 = corrector2 * (x1x3 - s0x2);
+ rotation->row1_col2 = corrector2 * (x1x2 - s0x3);
+ rotation->row2_col3 = corrector2 * (x2x3 - s0x1);
+ rotation->row3_col1 = corrector2 * (x1x3 - s0x2);
- rotation->r2c1 = corrector2 * (x1x2 + s0x3);
- rotation->r3c2 = corrector2 * (x2x3 + s0x1);
- rotation->r1c3 = corrector2 * (x1x3 + s0x2);
+ rotation->row2_col1 = corrector2 * (x1x2 + s0x3);
+ rotation->row3_col2 = corrector2 * (x2x3 + s0x1);
+ rotation->row1_col3 = corrector2 * (x1x3 + s0x2);
return 1;
}
@@ -702,7 +702,7 @@ inline int bgc_fp32_quaternion_get_reverse_matrix(BGC_FP32_Matrix3x3* reverse, c
const float square_modulus = (s0s0 + x1x1) + (x2x2 + x3x3);
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus))
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus))
{
bgc_fp32_matrix3x3_make_identity(reverse);
return 0;
@@ -719,17 +719,17 @@ inline int bgc_fp32_quaternion_get_reverse_matrix(BGC_FP32_Matrix3x3* reverse, c
const float corrector2 = 2.0f * corrector1;
- reverse->r1c1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
- reverse->r2c2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
- reverse->r3c3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
+ reverse->row1_col1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
+ reverse->row2_col2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
+ reverse->row3_col3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
- reverse->r1c2 = corrector2 * (x1x2 + s0x3);
- reverse->r2c3 = corrector2 * (x2x3 + s0x1);
- reverse->r3c1 = corrector2 * (x1x3 + s0x2);
+ reverse->row1_col2 = corrector2 * (x1x2 + s0x3);
+ reverse->row2_col3 = corrector2 * (x2x3 + s0x1);
+ reverse->row3_col1 = corrector2 * (x1x3 + s0x2);
- reverse->r2c1 = corrector2 * (x1x2 - s0x3);
- reverse->r3c2 = corrector2 * (x2x3 - s0x1);
- reverse->r1c3 = corrector2 * (x1x3 - s0x2);
+ reverse->row2_col1 = corrector2 * (x1x2 - s0x3);
+ reverse->row3_col2 = corrector2 * (x2x3 - s0x1);
+ reverse->row1_col3 = corrector2 * (x1x3 - s0x2);
return 1;
}
@@ -743,7 +743,7 @@ inline int bgc_fp64_quaternion_get_reverse_matrix(BGC_FP64_Matrix3x3* reverse, c
const double square_modulus = (s0s0 + x1x1) + (x2x2 + x3x3);
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus))
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus))
{
bgc_fp64_matrix3x3_make_identity(reverse);
return 0;
@@ -760,17 +760,17 @@ inline int bgc_fp64_quaternion_get_reverse_matrix(BGC_FP64_Matrix3x3* reverse, c
const double corrector2 = 2.0f * corrector1;
- reverse->r1c1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
- reverse->r2c2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
- reverse->r3c3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
+ reverse->row1_col1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
+ reverse->row2_col2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
+ reverse->row3_col3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
- reverse->r1c2 = corrector2 * (x1x2 + s0x3);
- reverse->r2c3 = corrector2 * (x2x3 + s0x1);
- reverse->r3c1 = corrector2 * (x1x3 + s0x2);
+ reverse->row1_col2 = corrector2 * (x1x2 + s0x3);
+ reverse->row2_col3 = corrector2 * (x2x3 + s0x1);
+ reverse->row3_col1 = corrector2 * (x1x3 + s0x2);
- reverse->r2c1 = corrector2 * (x1x2 - s0x3);
- reverse->r3c2 = corrector2 * (x2x3 - s0x1);
- reverse->r1c3 = corrector2 * (x1x3 - s0x2);
+ reverse->row2_col1 = corrector2 * (x1x2 - s0x3);
+ reverse->row3_col2 = corrector2 * (x2x3 - s0x1);
+ reverse->row1_col3 = corrector2 * (x1x3 - s0x2);
return 1;
}
@@ -810,11 +810,11 @@ inline int bgc_fp32_quaternion_are_close(const BGC_FP32_Quaternion* quaternion1,
const float square_modulus2 = bgc_fp32_quaternion_get_square_modulus(quaternion2);
const float square_distance = (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3);
- if (square_modulus1 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_distance <= BGC_FP32_SQUARE_EPSYLON;
+ if (square_modulus1 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_distance <= BGC_FP32_SQUARE_EPSILON;
}
- return square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus2;
+ return square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus2;
}
inline int bgc_fp64_quaternion_are_close(const BGC_FP64_Quaternion* quaternion1, const BGC_FP64_Quaternion* quaternion2)
@@ -828,11 +828,11 @@ inline int bgc_fp64_quaternion_are_close(const BGC_FP64_Quaternion* quaternion1,
const double square_modulus2 = bgc_fp64_quaternion_get_square_modulus(quaternion2);
const double square_distance = (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3);
- if (square_modulus1 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_distance <= BGC_FP64_SQUARE_EPSYLON;
+ if (square_modulus1 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_distance <= BGC_FP64_SQUARE_EPSILON;
}
- return square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus2;
+ return square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus2;
}
#endif
diff --git a/basic-geometry/slerp.c b/basic-geometry/slerp.c
index 55274e9..9112549 100644
--- a/basic-geometry/slerp.c
+++ b/basic-geometry/slerp.c
@@ -21,7 +21,7 @@ void bgc_fp32_slerp_make(BGC_FP32_Slerp* slerp, const BGC_FP32_Versor* start, co
return;
}
- if (square_vector <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_vector <= BGC_FP32_SQUARE_EPSILON) {
slerp->s0_cos_weight = start->_s0;
slerp->x1_cos_weight = start->_x1;
slerp->x2_cos_weight = start->_x2;
@@ -62,7 +62,7 @@ void bgc_fp64_slerp_make(BGC_FP64_Slerp* slerp, const BGC_FP64_Versor* start, co
return;
}
- if (square_vector <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_vector <= BGC_FP64_SQUARE_EPSILON) {
slerp->s0_cos_weight = start->_s0;
slerp->x1_cos_weight = start->_x1;
slerp->x2_cos_weight = start->_x2;
diff --git a/basic-geometry/utilities.h b/basic-geometry/utilities.h
index 4a23f33..9e0a3a9 100644
--- a/basic-geometry/utilities.h
+++ b/basic-geometry/utilities.h
@@ -1,10 +1,10 @@
#ifndef _BGC_UTILITIES_H_
#define _BGC_UTILITIES_H_
-#define BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT 1.0f
+#define BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT 1.0f
-#define BGC_FP32_EPSYLON 4.76837E-7f
-#define BGC_FP32_SQUARE_EPSYLON (BGC_FP32_EPSYLON * BGC_FP32_EPSYLON)
+#define BGC_FP32_EPSILON 4.76837E-7f
+#define BGC_FP32_SQUARE_EPSILON (BGC_FP32_EPSILON * BGC_FP32_EPSILON)
#define BGC_FP32_ONE_THIRD 0.3333333333f
#define BGC_FP32_ONE_SIXTH 0.1666666667f
@@ -14,10 +14,10 @@
#define BGC_FP32_GOLDEN_RATIO_HIGH 1.618034f
#define BGC_FP32_GOLDEN_RATIO_LOW 0.618034f
-#define BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT 1.0
+#define BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT 1.0
-#define BGC_FP64_EPSYLON 4.996003611E-14
-#define BGC_FP64_SQUARE_EPSYLON (BGC_FP64_EPSYLON * BGC_FP64_EPSYLON)
+#define BGC_FP64_EPSILON 4.996003611E-14
+#define BGC_FP64_SQUARE_EPSILON (BGC_FP64_EPSILON * BGC_FP64_EPSILON)
#define BGC_FP64_ONE_THIRD 0.3333333333333333333
#define BGC_FP64_ONE_SIXTH 0.1666666666666666667
@@ -53,34 +53,34 @@ inline int bgc_is_correct_axis(const int axis)
inline int bgc_fp32_is_zero(const float value)
{
- return (-BGC_FP32_EPSYLON <= value) && (value <= BGC_FP32_EPSYLON);
+ return (-BGC_FP32_EPSILON <= value) && (value <= BGC_FP32_EPSILON);
}
inline int bgc_fp64_is_zero(const double value)
{
- return (-BGC_FP64_EPSYLON <= value) && (value <= BGC_FP64_EPSYLON);
+ return (-BGC_FP64_EPSILON <= value) && (value <= BGC_FP64_EPSILON);
}
inline int bgc_fp32_is_unit(const float value)
{
- return (1.0f - BGC_FP32_EPSYLON <= value) && (value <= 1.0f + BGC_FP32_EPSYLON);
+ return (1.0f - BGC_FP32_EPSILON <= value) && (value <= 1.0f + BGC_FP32_EPSILON);
}
inline int bgc_fp64_is_unit(const double value)
{
- return (1.0 - BGC_FP64_EPSYLON <= value) && (value <= 1.0 + BGC_FP64_EPSYLON);
+ return (1.0 - BGC_FP64_EPSILON <= value) && (value <= 1.0 + BGC_FP64_EPSILON);
}
inline int bgc_fp32_is_square_unit(const float square_value)
{
- return (1.0f - 2.0f * BGC_FP32_EPSYLON <= square_value) && (square_value <= 1.0f + 2.0f * BGC_FP32_EPSYLON);
+ return (1.0f - 2.0f * BGC_FP32_EPSILON <= square_value) && (square_value <= 1.0f + 2.0f * BGC_FP32_EPSILON);
}
inline int bgc_fp64_is_square_unit(const double square_value)
{
- return (1.0 - 2.0 * BGC_FP64_EPSYLON <= square_value) && (square_value <= 1.0 + 2.0 * BGC_FP64_EPSYLON);
+ return (1.0 - 2.0 * BGC_FP64_EPSILON <= square_value) && (square_value <= 1.0 + 2.0 * BGC_FP64_EPSILON);
}
// ================== Are Close ================= //
@@ -92,11 +92,11 @@ inline int bgc_fp32_are_close(const float value1, const float value2)
const float square_value2 = value2 * value2;
const float square_difference = difference * difference;
- if (square_value1 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT || square_value2 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_difference <= BGC_FP32_SQUARE_EPSYLON;
+ if (square_value1 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT || square_value2 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_difference <= BGC_FP32_SQUARE_EPSILON;
}
- return square_difference <= BGC_FP32_SQUARE_EPSYLON * square_value1 && square_difference <= BGC_FP32_SQUARE_EPSYLON * square_value2;
+ return square_difference <= BGC_FP32_SQUARE_EPSILON * square_value1 && square_difference <= BGC_FP32_SQUARE_EPSILON * square_value2;
}
inline int bgc_fp64_are_close(const double value1, const double value2)
@@ -106,11 +106,11 @@ inline int bgc_fp64_are_close(const double value1, const double value2)
const double square_value2 = value2 * value2;
const double square_difference = difference * difference;
- if (square_value1 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT || square_value2 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_difference <= BGC_FP64_SQUARE_EPSYLON;
+ if (square_value1 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT || square_value2 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_difference <= BGC_FP64_SQUARE_EPSILON;
}
- return square_difference <= BGC_FP64_SQUARE_EPSYLON * square_value1 && square_difference <= BGC_FP64_SQUARE_EPSYLON * square_value2;
+ return square_difference <= BGC_FP64_SQUARE_EPSILON * square_value1 && square_difference <= BGC_FP64_SQUARE_EPSILON * square_value2;
}
#endif
diff --git a/basic-geometry/vector2.c b/basic-geometry/vector2.c
index 06d18e3..bb854bb 100644
--- a/basic-geometry/vector2.c
+++ b/basic-geometry/vector2.c
@@ -97,14 +97,14 @@ float bgc_fp32_vector2_get_angle(const BGC_FP32_Vector2* vector1, const BGC_FP32
const float square_modulus1 = bgc_fp32_vector2_get_square_modulus(vector1);
// square_modulus1 != square_modulus1 is check for NaN value at square_modulus1
- if (square_modulus1 <= BGC_FP32_SQUARE_EPSYLON || square_modulus1 != square_modulus1) {
+ if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus1 != square_modulus1) {
return 0.0f;
}
const float square_modulus2 = bgc_fp32_vector2_get_square_modulus(vector2);
// square_modulus2 != square_modulus2 is check for NaN value at square_modulus2
- if (square_modulus2 <= BGC_FP32_SQUARE_EPSYLON || square_modulus2 != square_modulus2) {
+ if (square_modulus2 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 != square_modulus2) {
return 0.0f;
}
@@ -122,14 +122,14 @@ double bgc_fp64_vector2_get_angle(const BGC_FP64_Vector2* vector1, const BGC_FP6
const double square_modulus1 = bgc_fp64_vector2_get_square_modulus(vector1);
// square_modulus1 != square_modulus1 is check for NaN value at square_modulus1
- if (square_modulus1 <= BGC_FP64_SQUARE_EPSYLON || square_modulus1 != square_modulus1) {
+ if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus1 != square_modulus1) {
return 0.0;
}
const double square_modulus2 = bgc_fp64_vector2_get_square_modulus(vector2);
// square_modulus2 != square_modulus2 is check for NaN value at square_modulus2
- if (square_modulus2 <= BGC_FP64_SQUARE_EPSYLON || square_modulus2 != square_modulus2) {
+ if (square_modulus2 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 != square_modulus2) {
return 0.0;
}
diff --git a/basic-geometry/vector2.h b/basic-geometry/vector2.h
index 9f12d25..7d7ad2f 100644
--- a/basic-geometry/vector2.h
+++ b/basic-geometry/vector2.h
@@ -70,12 +70,12 @@ inline double bgc_fp64_vector2_get_modulus(const BGC_FP64_Vector2* vector)
inline int bgc_fp32_vector2_is_zero(const BGC_FP32_Vector2* vector)
{
- return bgc_fp32_vector2_get_square_modulus(vector) <= BGC_FP32_SQUARE_EPSYLON;
+ return bgc_fp32_vector2_get_square_modulus(vector) <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_vector2_is_zero(const BGC_FP64_Vector2* vector)
{
- return bgc_fp64_vector2_get_square_modulus(vector) <= BGC_FP64_SQUARE_EPSYLON;
+ return bgc_fp64_vector2_get_square_modulus(vector) <= BGC_FP64_SQUARE_EPSILON;
}
inline int bgc_fp32_vector2_is_unit(const BGC_FP32_Vector2* vector)
@@ -292,7 +292,7 @@ inline int bgc_fp32_vector2_normalize(BGC_FP32_Vector2* vector)
return 1;
}
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -312,7 +312,7 @@ inline int bgc_fp64_vector2_normalize(BGC_FP64_Vector2* vector)
return 1;
}
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -333,7 +333,7 @@ inline int bgc_fp32_vector2_get_normalized(BGC_FP32_Vector2* normalized, const B
return 1;
}
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
bgc_fp32_vector2_reset(normalized);
return 0;
}
@@ -351,7 +351,7 @@ inline int bgc_fp64_vector2_get_normalized(BGC_FP64_Vector2* normalized, const B
return 1;
}
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
bgc_fp64_vector2_reset(normalized);
return 0;
}
@@ -440,11 +440,11 @@ inline int bgc_fp32_vector2_are_close(const BGC_FP32_Vector2* vector1, const BGC
const float square_modulus2 = bgc_fp32_vector2_get_square_modulus(vector2);
const float square_distance = bgc_fp32_vector2_get_square_distance(vector1, vector2);
- if (square_modulus1 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_distance <= BGC_FP32_SQUARE_EPSYLON;
+ if (square_modulus1 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_distance <= BGC_FP32_SQUARE_EPSILON;
}
- return square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus2;
+ return square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus2;
}
inline int bgc_fp64_vector2_are_close(const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2)
@@ -453,11 +453,11 @@ inline int bgc_fp64_vector2_are_close(const BGC_FP64_Vector2* vector1, const BGC
const double square_modulus2 = bgc_fp64_vector2_get_square_modulus(vector2);
const double square_distance = bgc_fp64_vector2_get_square_distance(vector1, vector2);
- if (square_modulus1 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_distance <= BGC_FP64_SQUARE_EPSYLON;
+ if (square_modulus1 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_distance <= BGC_FP64_SQUARE_EPSILON;
}
- return square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus2;
+ return square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus2;
}
@@ -467,38 +467,38 @@ inline int bgc_fp32_vector2_are_parallel(const BGC_FP32_Vector2* vector1, const
{
const float square_modulus1 = bgc_fp32_vector2_get_square_modulus(vector1);
- if (square_modulus1 <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
}
const float square_modulus2 = bgc_fp32_vector2_get_square_modulus(vector2);
- if (square_modulus2 <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
}
const float cross_product = bgc_fp32_vector2_get_cross_product(vector1, vector2);
- return cross_product * cross_product <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ return cross_product * cross_product <= BGC_FP32_SQUARE_EPSILON * square_modulus1 * square_modulus2;
}
inline int bgc_fp64_vector2_are_parallel(const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2)
{
const double square_modulus1 = bgc_fp64_vector2_get_square_modulus(vector1);
- if (square_modulus1 <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
}
const double square_modulus2 = bgc_fp64_vector2_get_square_modulus(vector2);
- if (square_modulus2 <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
}
const double cross_product = bgc_fp64_vector2_get_cross_product(vector1, vector2);
- return cross_product * cross_product <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ return cross_product * cross_product <= BGC_FP64_SQUARE_EPSILON * square_modulus1 * square_modulus2;
}
// ================= Orthogonal ================= //
@@ -507,38 +507,38 @@ inline int bgc_fp32_vector2_are_orthogonal(const BGC_FP32_Vector2* vector1, cons
{
const float square_modulus1 = bgc_fp32_vector2_get_square_modulus(vector1);
- if (square_modulus1 <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
}
const float square_modulus2 = bgc_fp32_vector2_get_square_modulus(vector2);
- if (square_modulus2 <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
}
const float scalar_product = bgc_fp32_vector2_get_dot_product(vector1, vector2);
- return scalar_product * scalar_product <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ return scalar_product * scalar_product <= BGC_FP32_SQUARE_EPSILON * square_modulus1 * square_modulus2;
}
inline int bgc_fp64_vector2_are_orthogonal(const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2)
{
const double square_modulus1 = bgc_fp64_vector2_get_square_modulus(vector1);
- if (square_modulus1 <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
}
const double square_modulus2 = bgc_fp64_vector2_get_square_modulus(vector2);
- if (square_modulus2 <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
}
const double scalar_product = bgc_fp64_vector2_get_dot_product(vector1, vector2);
- return scalar_product * scalar_product <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ return scalar_product * scalar_product <= BGC_FP64_SQUARE_EPSILON * square_modulus1 * square_modulus2;
}
@@ -549,11 +549,11 @@ inline int bgc_fp32_vector2_get_attitude(const BGC_FP32_Vector2* vector1, const
const float square_modulus1 = bgc_fp32_vector2_get_square_modulus(vector1);
const float square_modulus2 = bgc_fp32_vector2_get_square_modulus(vector2);
- if (square_modulus1 <= BGC_FP32_SQUARE_EPSYLON || square_modulus2 <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
return BGC_ATTITUDE_ZERO;
}
- const float square_limit = BGC_FP32_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ const float square_limit = BGC_FP32_SQUARE_EPSILON * square_modulus1 * square_modulus2;
const float scalar_product = bgc_fp32_vector2_get_dot_product(vector1, vector2);
@@ -575,11 +575,11 @@ inline int bgc_fp64_vector2_get_attitude(const BGC_FP64_Vector2* vector1, const
const double square_modulus1 = bgc_fp64_vector2_get_square_modulus(vector1);
const double square_modulus2 = bgc_fp64_vector2_get_square_modulus(vector2);
- if (square_modulus1 <= BGC_FP64_SQUARE_EPSYLON || square_modulus2 <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
return BGC_ATTITUDE_ZERO;
}
- const double square_limit = BGC_FP64_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ const double square_limit = BGC_FP64_SQUARE_EPSILON * square_modulus1 * square_modulus2;
const double scalar_product = bgc_fp64_vector2_get_dot_product(vector1, vector2);
diff --git a/basic-geometry/vector3.c b/basic-geometry/vector3.c
index 2740d11..fbf9615 100644
--- a/basic-geometry/vector3.c
+++ b/basic-geometry/vector3.c
@@ -103,14 +103,14 @@ float bgc_fp32_vector3_get_angle(const BGC_FP32_Vector3* vector1, const BGC_FP32
const float square_modulus1 = bgc_fp32_vector3_get_square_modulus(vector1);
// square_modulus1 != square_modulus1 is check for NaN value at square_modulus1
- if (square_modulus1 <= BGC_FP32_SQUARE_EPSYLON || square_modulus1 != square_modulus1) {
+ if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus1 != square_modulus1) {
return 0.0f;
}
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
// square_modulus2 != square_modulus2 is check for NaN value at square_modulus2
- if (square_modulus2 <= BGC_FP32_SQUARE_EPSYLON || square_modulus2 != square_modulus2) {
+ if (square_modulus2 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 != square_modulus2) {
return 0.0f;
}
@@ -130,14 +130,14 @@ double bgc_fp64_vector3_get_angle(const BGC_FP64_Vector3* vector1, const BGC_FP6
const double square_modulus1 = bgc_fp64_vector3_get_square_modulus(vector1);
// square_modulus1 != square_modulus1 is check for NaN value at square_modulus1
- if (square_modulus1 <= BGC_FP64_SQUARE_EPSYLON || square_modulus1 != square_modulus1) {
+ if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus1 != square_modulus1) {
return 0.0;
}
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
// square_modulus2 != square_modulus2 is check for NaN value at square_modulus2
- if (square_modulus2 <= BGC_FP64_SQUARE_EPSYLON || square_modulus2 != square_modulus2) {
+ if (square_modulus2 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 != square_modulus2) {
return 0.0;
}
diff --git a/basic-geometry/vector3.h b/basic-geometry/vector3.h
index e5dbe6f..4888d56 100644
--- a/basic-geometry/vector3.h
+++ b/basic-geometry/vector3.h
@@ -76,12 +76,12 @@ inline double bgc_fp64_vector3_get_modulus(const BGC_FP64_Vector3* vector)
inline int bgc_fp32_vector3_is_zero(const BGC_FP32_Vector3* vector)
{
- return bgc_fp32_vector3_get_square_modulus(vector) <= BGC_FP32_SQUARE_EPSYLON;
+ return bgc_fp32_vector3_get_square_modulus(vector) <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_vector3_is_zero(const BGC_FP64_Vector3* vector)
{
- return bgc_fp64_vector3_get_square_modulus(vector) <= BGC_FP64_SQUARE_EPSYLON;
+ return bgc_fp64_vector3_get_square_modulus(vector) <= BGC_FP64_SQUARE_EPSILON;
}
inline int bgc_fp32_vector3_is_unit(const BGC_FP32_Vector3* vector)
@@ -326,7 +326,7 @@ inline int bgc_fp32_vector3_normalize(BGC_FP32_Vector3* vector)
return 1;
}
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -347,7 +347,7 @@ inline int bgc_fp64_vector3_normalize(BGC_FP64_Vector3* vector)
return 1;
}
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@@ -369,7 +369,7 @@ inline int bgc_fp32_vector3_get_normalized(BGC_FP32_Vector3* normalized, const B
return 1;
}
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
bgc_fp32_vector3_reset(normalized);
return 0;
}
@@ -387,7 +387,7 @@ inline int bgc_fp64_vector3_get_normalized(BGC_FP64_Vector3* normalized, const B
return 1;
}
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
bgc_fp64_vector3_reset(normalized);
return 0;
}
@@ -528,11 +528,11 @@ inline int bgc_fp32_vector3_are_close(const BGC_FP32_Vector3* vector1, const BGC
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
const float square_distance = bgc_fp32_vector3_get_square_distance(vector1, vector2);
- if (square_modulus1 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_distance <= BGC_FP32_SQUARE_EPSYLON;
+ if (square_modulus1 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_distance <= BGC_FP32_SQUARE_EPSILON;
}
- return square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus2;
+ return square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus2;
}
inline int bgc_fp64_vector3_are_close(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2)
@@ -541,11 +541,11 @@ inline int bgc_fp64_vector3_are_close(const BGC_FP64_Vector3* vector1, const BGC
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
const double square_distance = bgc_fp64_vector3_get_square_distance(vector1, vector2);
- if (square_modulus1 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT) {
- return square_distance <= BGC_FP64_SQUARE_EPSYLON;
+ if (square_modulus1 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT) {
+ return square_distance <= BGC_FP64_SQUARE_EPSILON;
}
- return square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus2;
+ return square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus2;
}
// ================== Parallel ================== //
@@ -555,7 +555,7 @@ inline int bgc_fp32_vector3_are_parallel(const BGC_FP32_Vector3* vector1, const
const float square_modulus1 = bgc_fp32_vector3_get_square_modulus(vector1);
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
- if (square_modulus1 <= BGC_FP32_SQUARE_EPSYLON || square_modulus2 <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
}
@@ -563,7 +563,7 @@ inline int bgc_fp32_vector3_are_parallel(const BGC_FP32_Vector3* vector1, const
bgc_fp32_vector3_get_cross_product(&product, vector1, vector2);
- return bgc_fp32_vector3_get_square_modulus(&product) <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ return bgc_fp32_vector3_get_square_modulus(&product) <= BGC_FP32_SQUARE_EPSILON * square_modulus1 * square_modulus2;
}
inline int bgc_fp64_vector3_are_parallel(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2)
@@ -571,7 +571,7 @@ inline int bgc_fp64_vector3_are_parallel(const BGC_FP64_Vector3* vector1, const
const double square_modulus1 = bgc_fp64_vector3_get_square_modulus(vector1);
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
- if (square_modulus1 <= BGC_FP64_SQUARE_EPSYLON || square_modulus2 <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
}
@@ -579,7 +579,7 @@ inline int bgc_fp64_vector3_are_parallel(const BGC_FP64_Vector3* vector1, const
bgc_fp64_vector3_get_cross_product(&product, vector1, vector2);
- return bgc_fp64_vector3_get_square_modulus(&product) <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ return bgc_fp64_vector3_get_square_modulus(&product) <= BGC_FP64_SQUARE_EPSILON * square_modulus1 * square_modulus2;
}
// ================= Orthogonal ================= //
@@ -589,13 +589,13 @@ inline int bgc_fp32_vector3_are_orthogonal(const BGC_FP32_Vector3* vector1, cons
const float square_modulus1 = bgc_fp32_vector3_get_square_modulus(vector1);
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
- if (square_modulus1 <= BGC_FP32_SQUARE_EPSYLON || square_modulus2 <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
return 1;
}
const float scalar_product = bgc_fp32_vector3_get_dot_product(vector1, vector2);
- return scalar_product * scalar_product <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ return scalar_product * scalar_product <= BGC_FP32_SQUARE_EPSILON * square_modulus1 * square_modulus2;
}
inline int bgc_fp64_vector3_are_orthogonal(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2)
@@ -603,13 +603,13 @@ inline int bgc_fp64_vector3_are_orthogonal(const BGC_FP64_Vector3* vector1, cons
const double square_modulus1 = bgc_fp64_vector3_get_square_modulus(vector1);
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
- if (square_modulus1 <= BGC_FP64_SQUARE_EPSYLON || square_modulus2 <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
return 1;
}
const double scalar_product = bgc_fp64_vector3_get_dot_product(vector1, vector2);
- return scalar_product * scalar_product <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ return scalar_product * scalar_product <= BGC_FP64_SQUARE_EPSILON * square_modulus1 * square_modulus2;
}
// ================== Attitude ================== //
@@ -619,11 +619,11 @@ inline int bgc_fp32_vector3_get_attitude(const BGC_FP32_Vector3* vector1, const
const float square_modulus1 = bgc_fp32_vector3_get_square_modulus(vector1);
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
- if (square_modulus1 <= BGC_FP32_SQUARE_EPSYLON || square_modulus2 <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
return BGC_ATTITUDE_ZERO;
}
- const float square_limit = BGC_FP32_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ const float square_limit = BGC_FP32_SQUARE_EPSILON * square_modulus1 * square_modulus2;
const float scalar_product = bgc_fp32_vector3_get_dot_product(vector1, vector2);
@@ -647,11 +647,11 @@ inline int bgc_fp64_vector3_get_attitude(const BGC_FP64_Vector3* vector1, const
const double square_modulus1 = bgc_fp64_vector3_get_square_modulus(vector1);
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
- if (square_modulus1 <= BGC_FP64_SQUARE_EPSYLON || square_modulus2 <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
return BGC_ATTITUDE_ZERO;
}
- const double square_limit = BGC_FP64_SQUARE_EPSYLON * square_modulus1 * square_modulus2;
+ const double square_limit = BGC_FP64_SQUARE_EPSILON * square_modulus1 * square_modulus2;
const double scalar_product = bgc_fp64_vector3_get_dot_product(vector1, vector2);
diff --git a/basic-geometry/versor.c b/basic-geometry/versor.c
index f08187b..b95d9ae 100644
--- a/basic-geometry/versor.c
+++ b/basic-geometry/versor.c
@@ -79,7 +79,7 @@ void _bgc_fp32_versor_normalize(BGC_FP32_Versor* versor)
{
const float square_modulus = (versor->_s0 * versor->_s0 + versor->_x1 * versor->_x1) + (versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3);
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
versor->_s0 = 1.0f;
versor->_x1 = 0.0f;
versor->_x2 = 0.0f;
@@ -99,7 +99,7 @@ void _bgc_fp64_versor_normalize(BGC_FP64_Versor* versor)
{
const double square_modulus = (versor->_s0 * versor->_s0 + versor->_x1 * versor->_x1) + (versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3);
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
versor->_s0 = 1.0;
versor->_x1 = 0.0;
versor->_x2 = 0.0;
@@ -121,7 +121,7 @@ void bgc_fp32_versor_make_for_turn(BGC_FP32_Versor* versor, const float x1, cons
{
const float square_vector = x1 * x1 + x2 * x2 + x3 * x3;
- if (square_vector <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_vector <= BGC_FP32_SQUARE_EPSILON) {
bgc_fp32_versor_reset(versor);
return;
}
@@ -144,7 +144,7 @@ void bgc_fp64_versor_make_for_turn(BGC_FP64_Versor* versor, const double x1, con
{
const double square_vector = x1 * x1 + x2 * x2 + x3 * x3;
- if (square_vector <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_vector <= BGC_FP64_SQUARE_EPSILON) {
bgc_fp64_versor_reset(versor);
return;
}
@@ -175,7 +175,7 @@ static int _bgc_fp32_versor_make_direction_turn(BGC_FP32_Versor* versor, const B
const float square_modulus = bgc_fp32_vector3_get_square_modulus(&orthogonal_axis);
const float square_sine = square_modulus / square_modulus_product;
- if (square_sine > BGC_FP32_SQUARE_EPSYLON) {
+ if (square_sine > BGC_FP32_SQUARE_EPSILON) {
const float cosine = scalar_product / sqrtf(square_modulus_product);
const float angle = 0.5f * atan2f(sqrtf(square_sine), cosine);
@@ -203,7 +203,7 @@ static int _bgc_fp64_versor_make_direction_turn(BGC_FP64_Versor* versor, const B
const double square_modulus = bgc_fp64_vector3_get_square_modulus(&orthogonal_axis);
const double square_sine = square_modulus / square_modulus_product;
- if (square_sine > BGC_FP64_SQUARE_EPSYLON) {
+ if (square_sine > BGC_FP64_SQUARE_EPSILON) {
const double cosine = scalar_product / sqrt(square_modulus_product);
const double angle = 0.5 * atan2(sqrt(square_sine), cosine);
@@ -226,7 +226,7 @@ int bgc_fp32_versor_make_direction_difference(BGC_FP32_Versor* versor, const BGC
const float start_square_modulus = bgc_fp32_vector3_get_square_modulus(start);
const float end_square_modulus = bgc_fp32_vector3_get_square_modulus(end);
- if (start_square_modulus <= BGC_FP32_SQUARE_EPSYLON || end_square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
+ if (start_square_modulus <= BGC_FP32_SQUARE_EPSILON || end_square_modulus <= BGC_FP32_SQUARE_EPSILON) {
bgc_fp32_versor_reset(versor);
return BGC_ZERO_TURN;
}
@@ -239,7 +239,7 @@ int bgc_fp64_versor_make_direction_difference(BGC_FP64_Versor* versor, const BGC
const double start_square_modulus = bgc_fp64_vector3_get_square_modulus(start);
const double end_square_modulus = bgc_fp64_vector3_get_square_modulus(end);
- if (start_square_modulus <= BGC_FP64_SQUARE_EPSYLON || end_square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
+ if (start_square_modulus <= BGC_FP64_SQUARE_EPSILON || end_square_modulus <= BGC_FP64_SQUARE_EPSILON) {
bgc_fp64_versor_reset(versor);
return BGC_ZERO_TURN;
}
@@ -251,17 +251,17 @@ int bgc_fp64_versor_make_direction_difference(BGC_FP64_Versor* versor, const BGC
static int _bgc_fp32_versor_validate_basis(const float primary_square_modulus, const float auxiliary_square_modulus, const float orthogonal_square_modulus)
{
- if (primary_square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
+ if (primary_square_modulus <= BGC_FP32_SQUARE_EPSILON) {
//TODO: add error code for: primary_vector is zero
return BGC_FAILED;
}
- if (auxiliary_square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
+ if (auxiliary_square_modulus <= BGC_FP32_SQUARE_EPSILON) {
//TODO: add error code for: auxiliary_vector is zero
return BGC_FAILED;
}
- if (orthogonal_square_modulus <= BGC_FP32_SQUARE_EPSYLON * primary_square_modulus * auxiliary_square_modulus) {
+ if (orthogonal_square_modulus <= BGC_FP32_SQUARE_EPSILON * primary_square_modulus * auxiliary_square_modulus) {
//TODO: add error code for: primary_vector and auxiliary_vector are parallel
return BGC_FAILED;
}
@@ -271,17 +271,17 @@ static int _bgc_fp32_versor_validate_basis(const float primary_square_modulus, c
static int _bgc_fp64_versor_validate_basis(const double primary_square_modulus, const double auxiliary_square_modulus, const double orthogonal_square_modulus)
{
- if (primary_square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
+ if (primary_square_modulus <= BGC_FP64_SQUARE_EPSILON) {
//TODO: add error code for: primary_vector is zero
return BGC_FAILED;
}
- if (auxiliary_square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
+ if (auxiliary_square_modulus <= BGC_FP64_SQUARE_EPSILON) {
//TODO: add error code for: auxiliary_vector is zero
return BGC_FAILED;
}
- if (orthogonal_square_modulus <= BGC_FP64_SQUARE_EPSYLON * primary_square_modulus * auxiliary_square_modulus) {
+ if (orthogonal_square_modulus <= BGC_FP64_SQUARE_EPSILON * primary_square_modulus * auxiliary_square_modulus) {
//TODO: add error code for: primary_vector and auxiliary_vector are parallel
return BGC_FAILED;
}
@@ -437,7 +437,7 @@ void bgc_fp32_versor_get_exponation(BGC_FP32_Versor* power, const BGC_FP32_Verso
{
const float square_vector = base->_x1 * base->_x1 + base->_x2 * base->_x2 + base->_x3 * base->_x3;
- if (square_vector <= BGC_FP32_SQUARE_EPSYLON || square_vector != square_vector) {
+ if (square_vector <= BGC_FP32_SQUARE_EPSILON || square_vector != square_vector) {
bgc_fp32_versor_reset(power);
return;
}
@@ -455,7 +455,7 @@ void bgc_fp64_versor_get_exponation(BGC_FP64_Versor* power, const BGC_FP64_Verso
{
const double square_vector = base->_x1 * base->_x1 + base->_x2 * base->_x2 + base->_x3 * base->_x3;
- if (square_vector <= BGC_FP64_SQUARE_EPSYLON || square_vector != square_vector) {
+ if (square_vector <= BGC_FP64_SQUARE_EPSILON || square_vector != square_vector) {
bgc_fp64_versor_reset(power);
return;
}
@@ -481,7 +481,7 @@ void bgc_fp32_versor_spherically_interpolate(BGC_FP32_Versor* interpolation, con
const float square_vector = delta_x1 * delta_x1 + delta_x2 * delta_x2 + delta_x3 * delta_x3;
// square_vector != square_vector means checking for NaN value at square_vector
- if (square_vector <= BGC_FP32_SQUARE_EPSYLON || isnan(square_vector)) {
+ if (square_vector <= BGC_FP32_SQUARE_EPSILON || isnan(square_vector)) {
bgc_fp32_versor_copy(interpolation, end);
return;
}
@@ -516,7 +516,7 @@ void bgc_fp64_versor_spherically_interpolate(BGC_FP64_Versor* interpolation, con
const double square_vector = delta_x1 * delta_x1 + delta_x2 * delta_x2 + delta_x3 * delta_x3;
// square_vector != square_vector means checking for NaN value at square_vector
- if (square_vector <= BGC_FP64_SQUARE_EPSYLON || isnan(square_vector)) {
+ if (square_vector <= BGC_FP64_SQUARE_EPSILON || isnan(square_vector)) {
bgc_fp64_versor_copy(interpolation, end);
return;
}
@@ -547,7 +547,7 @@ void bgc_fp32_versor_get_rotation(BGC_FP32_Rotation3* rotation, const BGC_FP32_V
{
const float square_modulus = versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3;
- if (square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
+ if (square_modulus <= BGC_FP32_SQUARE_EPSILON) {
bgc_fp32_rotation3_reset(rotation);
return;
}
@@ -567,7 +567,7 @@ void bgc_fp64_versor_get_rotation(BGC_FP64_Rotation3* rotation, const BGC_FP64_V
{
const double square_modulus = versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3;
- if (square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
+ if (square_modulus <= BGC_FP64_SQUARE_EPSILON) {
bgc_fp64_rotation3_reset(rotation);
return;
}
diff --git a/basic-geometry/versor.h b/basic-geometry/versor.h
index ee3b4de..f066a17 100644
--- a/basic-geometry/versor.h
+++ b/basic-geometry/versor.h
@@ -192,12 +192,12 @@ inline void bgc_fp64_versor_swap(BGC_FP64_Versor* versor1, BGC_FP64_Versor* vers
inline int bgc_fp32_versor_is_idle(const BGC_FP32_Versor* versor)
{
- return versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3 <= BGC_FP32_SQUARE_EPSYLON;
+ return versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3 <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_versor_is_idle(const BGC_FP64_Versor* versor)
{
- return versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3 <= BGC_FP64_SQUARE_EPSYLON;
+ return versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3 <= BGC_FP64_SQUARE_EPSILON;
}
// ================== Convert =================== //
@@ -460,17 +460,17 @@ inline void bgc_fp32_versor_get_rotation_matrix(BGC_FP32_Matrix3x3* matrix, cons
const float x1x3 = versor->_x1 * versor->_x3;
const float x2x3 = versor->_x2 * versor->_x3;
- matrix->r1c1 = (s0s0 + x1x1) - (x2x2 + x3x3);
- matrix->r2c2 = (s0s0 + x2x2) - (x1x1 + x3x3);
- matrix->r3c3 = (s0s0 + x3x3) - (x1x1 + x2x2);
+ matrix->row1_col1 = (s0s0 + x1x1) - (x2x2 + x3x3);
+ matrix->row2_col2 = (s0s0 + x2x2) - (x1x1 + x3x3);
+ matrix->row3_col3 = (s0s0 + x3x3) - (x1x1 + x2x2);
- matrix->r1c2 = 2.0f * (x1x2 - s0x3);
- matrix->r2c3 = 2.0f * (x2x3 - s0x1);
- matrix->r3c1 = 2.0f * (x1x3 - s0x2);
+ matrix->row1_col2 = 2.0f * (x1x2 - s0x3);
+ matrix->row2_col3 = 2.0f * (x2x3 - s0x1);
+ matrix->row3_col1 = 2.0f * (x1x3 - s0x2);
- matrix->r2c1 = 2.0f * (x1x2 + s0x3);
- matrix->r3c2 = 2.0f * (x2x3 + s0x1);
- matrix->r1c3 = 2.0f * (x1x3 + s0x2);
+ matrix->row2_col1 = 2.0f * (x1x2 + s0x3);
+ matrix->row3_col2 = 2.0f * (x2x3 + s0x1);
+ matrix->row1_col3 = 2.0f * (x1x3 + s0x2);
}
inline void bgc_fp64_versor_get_rotation_matrix(BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Versor* versor)
@@ -487,17 +487,17 @@ inline void bgc_fp64_versor_get_rotation_matrix(BGC_FP64_Matrix3x3* matrix, cons
const double x1x3 = versor->_x1 * versor->_x3;
const double x2x3 = versor->_x2 * versor->_x3;
- matrix->r1c1 = (s0s0 + x1x1) - (x2x2 + x3x3);
- matrix->r2c2 = (s0s0 + x2x2) - (x1x1 + x3x3);
- matrix->r3c3 = (s0s0 + x3x3) - (x1x1 + x2x2);
+ matrix->row1_col1 = (s0s0 + x1x1) - (x2x2 + x3x3);
+ matrix->row2_col2 = (s0s0 + x2x2) - (x1x1 + x3x3);
+ matrix->row3_col3 = (s0s0 + x3x3) - (x1x1 + x2x2);
- matrix->r1c2 = 2.0 * (x1x2 - s0x3);
- matrix->r2c3 = 2.0 * (x2x3 - s0x1);
- matrix->r3c1 = 2.0 * (x1x3 - s0x2);
+ matrix->row1_col2 = 2.0 * (x1x2 - s0x3);
+ matrix->row2_col3 = 2.0 * (x2x3 - s0x1);
+ matrix->row3_col1 = 2.0 * (x1x3 - s0x2);
- matrix->r2c1 = 2.0 * (x1x2 + s0x3);
- matrix->r3c2 = 2.0 * (x2x3 + s0x1);
- matrix->r1c3 = 2.0 * (x1x3 + s0x2);
+ matrix->row2_col1 = 2.0 * (x1x2 + s0x3);
+ matrix->row3_col2 = 2.0 * (x2x3 + s0x1);
+ matrix->row1_col3 = 2.0 * (x1x3 + s0x2);
}
// ============= Get Reverse Matrix ============= //
@@ -516,17 +516,17 @@ inline void bgc_fp32_versor_get_reverse_matrix(BGC_FP32_Matrix3x3* matrix, const
const float x1x3 = versor->_x1 * versor->_x3;
const float x2x3 = versor->_x2 * versor->_x3;
- matrix->r1c1 = (s0s0 + x1x1) - (x2x2 + x3x3);
- matrix->r2c2 = (s0s0 + x2x2) - (x1x1 + x3x3);
- matrix->r3c3 = (s0s0 + x3x3) - (x1x1 + x2x2);
+ matrix->row1_col1 = (s0s0 + x1x1) - (x2x2 + x3x3);
+ matrix->row2_col2 = (s0s0 + x2x2) - (x1x1 + x3x3);
+ matrix->row3_col3 = (s0s0 + x3x3) - (x1x1 + x2x2);
- matrix->r1c2 = 2.0f * (x1x2 + s0x3);
- matrix->r2c3 = 2.0f * (x2x3 + s0x1);
- matrix->r3c1 = 2.0f * (x1x3 + s0x2);
+ matrix->row1_col2 = 2.0f * (x1x2 + s0x3);
+ matrix->row2_col3 = 2.0f * (x2x3 + s0x1);
+ matrix->row3_col1 = 2.0f * (x1x3 + s0x2);
- matrix->r2c1 = 2.0f * (x1x2 - s0x3);
- matrix->r3c2 = 2.0f * (x2x3 - s0x1);
- matrix->r1c3 = 2.0f * (x1x3 - s0x2);
+ matrix->row2_col1 = 2.0f * (x1x2 - s0x3);
+ matrix->row3_col2 = 2.0f * (x2x3 - s0x1);
+ matrix->row1_col3 = 2.0f * (x1x3 - s0x2);
}
inline void bgc_fp64_versor_get_reverse_matrix(BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Versor* versor)
@@ -543,17 +543,17 @@ inline void bgc_fp64_versor_get_reverse_matrix(BGC_FP64_Matrix3x3* matrix, const
const double x1x3 = versor->_x1 * versor->_x3;
const double x2x3 = versor->_x2 * versor->_x3;
- matrix->r1c1 = (s0s0 + x1x1) - (x2x2 + x3x3);
- matrix->r2c2 = (s0s0 + x2x2) - (x1x1 + x3x3);
- matrix->r3c3 = (s0s0 + x3x3) - (x1x1 + x2x2);
+ matrix->row1_col1 = (s0s0 + x1x1) - (x2x2 + x3x3);
+ matrix->row2_col2 = (s0s0 + x2x2) - (x1x1 + x3x3);
+ matrix->row3_col3 = (s0s0 + x3x3) - (x1x1 + x2x2);
- matrix->r1c2 = 2.0 * (x1x2 + s0x3);
- matrix->r2c3 = 2.0 * (x2x3 + s0x1);
- matrix->r3c1 = 2.0 * (x1x3 + s0x2);
+ matrix->row1_col2 = 2.0 * (x1x2 + s0x3);
+ matrix->row2_col3 = 2.0 * (x2x3 + s0x1);
+ matrix->row3_col1 = 2.0 * (x1x3 + s0x2);
- matrix->r2c1 = 2.0 * (x1x2 - s0x3);
- matrix->r3c2 = 2.0 * (x2x3 - s0x1);
- matrix->r1c3 = 2.0 * (x1x3 - s0x2);
+ matrix->row2_col1 = 2.0 * (x1x2 - s0x3);
+ matrix->row3_col2 = 2.0 * (x2x3 - s0x1);
+ matrix->row1_col3 = 2.0 * (x1x3 - s0x2);
}
// ============= Get Both Matrixes ============== //
@@ -643,7 +643,7 @@ inline int bgc_fp32_versor_are_close(const BGC_FP32_Versor* versor1, const BGC_F
const float dx2 = versor1->_x2 - versor2->_x2;
const float dx3 = versor1->_x3 - versor2->_x3;
- return (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3) <= BGC_FP32_SQUARE_EPSYLON;
+ return (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3) <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_versor_are_close(const BGC_FP64_Versor* versor1, const BGC_FP64_Versor* versor2)
@@ -653,7 +653,7 @@ inline int bgc_fp64_versor_are_close(const BGC_FP64_Versor* versor1, const BGC_F
const double dx2 = versor1->_x2 - versor2->_x2;
const double dx3 = versor1->_x3 - versor2->_x3;
- return (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3) <= BGC_FP64_SQUARE_EPSYLON;
+ return (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3) <= BGC_FP64_SQUARE_EPSILON;
}
#endif