Переименование типов в соответствии со стилем POSIX, отказ от префикса bg_
This commit is contained in:
parent
d2a25823a5
commit
605afabd94
25 changed files with 1109 additions and 1035 deletions
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GEOMETRY_MATRIX3X2_H_
|
||||
#define _GEOMETRY_MATRIX3X2_H_
|
||||
#ifndef _BASIC_GEOMETRY_MATRIX3X2_H_
|
||||
#define _BASIC_GEOMETRY_MATRIX3X2_H_
|
||||
|
||||
#include "vector2.h"
|
||||
#include "vector3.h"
|
||||
|
@ -7,7 +7,7 @@
|
|||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_reset(BgFP32Matrix3x2* matrix)
|
||||
static inline void fp32_matrix3x2_reset(fp32_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0f;
|
||||
matrix->r1c2 = 0.0f;
|
||||
|
@ -18,7 +18,7 @@ static inline void bg_fp32_matrix3x2_reset(BgFP32Matrix3x2* matrix)
|
|||
matrix->r2c3 = 0.0f;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_reset(BgFP64Matrix3x2* matrix)
|
||||
static inline void fp64_matrix3x2_reset(fp64_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0;
|
||||
matrix->r1c2 = 0.0;
|
||||
|
@ -31,7 +31,7 @@ static inline void bg_fp64_matrix3x2_reset(BgFP64Matrix3x2* matrix)
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_copy(const BgFP32Matrix3x2* from, BgFP32Matrix3x2* to)
|
||||
static inline void fp32_matrix3x2_copy(const fp32_matrix3x2_t* from, fp32_matrix3x2_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
@ -42,7 +42,7 @@ static inline void bg_fp32_matrix3x2_copy(const BgFP32Matrix3x2* from, BgFP32Mat
|
|||
to->r2c3 = from->r2c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_copy(const BgFP64Matrix3x2* from, BgFP64Matrix3x2* to)
|
||||
static inline void fp64_matrix3x2_copy(const fp64_matrix3x2_t* from, fp64_matrix3x2_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
@ -55,7 +55,7 @@ static inline void bg_fp64_matrix3x2_copy(const BgFP64Matrix3x2* from, BgFP64Mat
|
|||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_swap(BgFP32Matrix3x2* matrix1, BgFP32Matrix3x2* matrix2)
|
||||
static inline void fp32_matrix3x2_swap(fp32_matrix3x2_t* matrix1, fp32_matrix3x2_t* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix2->r1c1;
|
||||
const float r1c2 = matrix2->r1c2;
|
||||
|
@ -82,7 +82,7 @@ static inline void bg_fp32_matrix3x2_swap(BgFP32Matrix3x2* matrix1, BgFP32Matrix
|
|||
matrix1->r2c3 = r2c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_swap(BgFP64Matrix3x2* matrix1, BgFP64Matrix3x2* matrix2)
|
||||
static inline void fp64_matrix3x2_swap(fp64_matrix3x2_t* matrix1, fp64_matrix3x2_t* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix2->r1c1;
|
||||
const double r1c2 = matrix2->r1c2;
|
||||
|
@ -111,7 +111,7 @@ static inline void bg_fp64_matrix3x2_swap(BgFP64Matrix3x2* matrix1, BgFP64Matrix
|
|||
|
||||
// ============= Set from twin type ============= //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_set_from_fp64(const BgFP64Matrix3x2* from, BgFP32Matrix3x2* to)
|
||||
static inline void fp32_matrix3x2_set_from_fp64(const fp64_matrix3x2_t* from, fp32_matrix3x2_t* to)
|
||||
{
|
||||
to->r1c1 = (float) from->r1c1;
|
||||
to->r1c2 = (float) from->r1c2;
|
||||
|
@ -122,7 +122,7 @@ static inline void bg_fp32_matrix3x2_set_from_fp64(const BgFP64Matrix3x2* from,
|
|||
to->r2c3 = (float) from->r2c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_set_from_fp32(const BgFP32Matrix3x2* from, BgFP64Matrix3x2* to)
|
||||
static inline void fp64_matrix3x2_set_from_fp32(const fp32_matrix3x2_t* from, fp64_matrix3x2_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
@ -135,7 +135,7 @@ static inline void bg_fp64_matrix3x2_set_from_fp32(const BgFP32Matrix3x2* from,
|
|||
|
||||
// =============== Set transposed =============== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_set_transposed(const BgFP32Matrix2x3* from, BgFP32Matrix3x2* to)
|
||||
static inline void fp32_matrix3x2_set_transposed(const fp32_matrix2x3_t* from, fp32_matrix3x2_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r2c1;
|
||||
|
@ -146,7 +146,7 @@ static inline void bg_fp32_matrix3x2_set_transposed(const BgFP32Matrix2x3* from,
|
|||
to->r2c3 = from->r3c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_set_transposed(const BgFP64Matrix2x3* from, BgFP64Matrix3x2* to)
|
||||
static inline void fp64_matrix3x2_set_transposed(const fp64_matrix2x3_t* from, fp64_matrix3x2_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r2c1;
|
||||
|
@ -159,7 +159,7 @@ static inline void bg_fp64_matrix3x2_set_transposed(const BgFP64Matrix2x3* from,
|
|||
|
||||
// =============== Set transposed =============== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_set_transposed_fp64(const BgFP64Matrix2x3* from, BgFP32Matrix3x2* to)
|
||||
static inline void fp32_matrix3x2_set_transposed_fp64(const fp64_matrix2x3_t* from, fp32_matrix3x2_t* to)
|
||||
{
|
||||
to->r1c1 = (float) from->r1c1;
|
||||
to->r1c2 = (float) from->r2c1;
|
||||
|
@ -170,7 +170,7 @@ static inline void bg_fp32_matrix3x2_set_transposed_fp64(const BgFP64Matrix2x3*
|
|||
to->r2c3 = (float) from->r3c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_set_transposed_fp32(const BgFP32Matrix2x3* from, BgFP64Matrix3x2* to)
|
||||
static inline void fp64_matrix3x2_set_transposed_fp32(const fp32_matrix2x3_t* from, fp64_matrix3x2_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r2c1;
|
||||
|
@ -183,14 +183,14 @@ static inline void bg_fp64_matrix3x2_set_transposed_fp32(const BgFP32Matrix2x3*
|
|||
|
||||
// ================= Set Row 1 ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_set_row1(const float c1, const float c2, const float c3, BgFP32Matrix3x2* matrix)
|
||||
static inline void fp32_matrix3x2_set_row1(const float c1, const float c2, const float c3, fp32_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
matrix->r1c3 = c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_set_row1(const double c1, const double c2, const double c3, BgFP64Matrix3x2* matrix)
|
||||
static inline void fp64_matrix3x2_set_row1(const double c1, const double c2, const double c3, fp64_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
|
@ -199,14 +199,14 @@ static inline void bg_fp64_matrix3x2_set_row1(const double c1, const double c2,
|
|||
|
||||
// ================= Set Row 2 ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_set_row2(const float c1, const float c2, const float c3, BgFP32Matrix3x2* matrix)
|
||||
static inline void fp32_matrix3x2_set_row2(const float c1, const float c2, const float c3, fp32_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
matrix->r2c3 = c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_set_row2(const double c1, const double c2, const double c3, BgFP64Matrix3x2* matrix)
|
||||
static inline void fp64_matrix3x2_set_row2(const double c1, const double c2, const double c3, fp64_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
|
@ -215,13 +215,13 @@ static inline void bg_fp64_matrix3x2_set_row2(const double c1, const double c2,
|
|||
|
||||
// ================ Set Column 1 ================ //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_set_column1(const float r1, const float r2, BgFP32Matrix3x2* matrix)
|
||||
static inline void fp32_matrix3x2_set_column1(const float r1, const float r2, fp32_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_set_column1(const double r1, const double r2, BgFP64Matrix3x2* matrix)
|
||||
static inline void fp64_matrix3x2_set_column1(const double r1, const double r2, fp64_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
|
@ -229,13 +229,13 @@ static inline void bg_fp64_matrix3x2_set_column1(const double r1, const double r
|
|||
|
||||
// ================ Set Column 2 ================ //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_set_column2(const float r1, const float r2, BgFP32Matrix3x2* matrix)
|
||||
static inline void fp32_matrix3x2_set_column2(const float r1, const float r2, fp32_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_set_column2(const double r1, const double r2, BgFP64Matrix3x2* matrix)
|
||||
static inline void fp64_matrix3x2_set_column2(const double r1, const double r2, fp64_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
|
@ -243,13 +243,13 @@ static inline void bg_fp64_matrix3x2_set_column2(const double r1, const double r
|
|||
|
||||
// ================ Set Column 3 ================ //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_set_column3(const float r1, const float r2, BgFP32Matrix3x2* matrix)
|
||||
static inline void fp32_matrix3x2_set_column3(const float r1, const float r2, fp32_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c3 = r1;
|
||||
matrix->r2c3 = r2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_set_column3(const double r1, const double r2, BgFP64Matrix3x2* matrix)
|
||||
static inline void fp64_matrix3x2_set_column3(const double r1, const double r2, fp64_matrix3x2_t* matrix)
|
||||
{
|
||||
matrix->r1c3 = r1;
|
||||
matrix->r2c3 = r2;
|
||||
|
@ -257,7 +257,7 @@ static inline void bg_fp64_matrix3x2_set_column3(const double r1, const double r
|
|||
|
||||
// ================ Append scaled =============== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_append_scaled(BgFP32Matrix3x2* basic_vector, const BgFP32Matrix3x2* scalable_vector, const float scale)
|
||||
static inline void fp32_matrix3x2_append_scaled(fp32_matrix3x2_t* basic_vector, const fp32_matrix3x2_t* scalable_vector, const float scale)
|
||||
{
|
||||
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||
|
@ -268,7 +268,7 @@ static inline void bg_fp32_matrix3x2_append_scaled(BgFP32Matrix3x2* basic_vector
|
|||
basic_vector->r2c3 += scalable_vector->r2c3 * scale;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_append_scaled(BgFP64Matrix3x2* basic_vector, const BgFP64Matrix3x2* scalable_vector, const double scale)
|
||||
static inline void fp64_matrix3x2_append_scaled(fp64_matrix3x2_t* basic_vector, const fp64_matrix3x2_t* scalable_vector, const double scale)
|
||||
{
|
||||
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||
|
@ -281,7 +281,7 @@ static inline void bg_fp64_matrix3x2_append_scaled(BgFP64Matrix3x2* basic_vector
|
|||
|
||||
// ================== Addition ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_add(const BgFP32Matrix3x2* matrix1, const BgFP32Matrix3x2* matrix2, BgFP32Matrix3x2* sum)
|
||||
static inline void fp32_matrix3x2_add(const fp32_matrix3x2_t* matrix1, const fp32_matrix3x2_t* matrix2, fp32_matrix3x2_t* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
@ -292,7 +292,7 @@ static inline void bg_fp32_matrix3x2_add(const BgFP32Matrix3x2* matrix1, const B
|
|||
sum->r2c3 = matrix1->r2c3 + matrix2->r2c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_add(const BgFP64Matrix3x2* matrix1, const BgFP64Matrix3x2* matrix2, BgFP64Matrix3x2* sum)
|
||||
static inline void fp64_matrix3x2_add(const fp64_matrix3x2_t* matrix1, const fp64_matrix3x2_t* matrix2, fp64_matrix3x2_t* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
@ -305,7 +305,7 @@ static inline void bg_fp64_matrix3x2_add(const BgFP64Matrix3x2* matrix1, const B
|
|||
|
||||
// ================ Subtraction ================= //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_subtract(const BgFP32Matrix3x2* minuend, const BgFP32Matrix3x2* subtrahend, BgFP32Matrix3x2* difference)
|
||||
static inline void fp32_matrix3x2_subtract(const fp32_matrix3x2_t* minuend, const fp32_matrix3x2_t* subtrahend, fp32_matrix3x2_t* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -316,7 +316,7 @@ static inline void bg_fp32_matrix3x2_subtract(const BgFP32Matrix3x2* minuend, co
|
|||
difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_subtract(const BgFP64Matrix3x2* minuend, const BgFP64Matrix3x2* subtrahend, BgFP64Matrix3x2* difference)
|
||||
static inline void fp64_matrix3x2_subtract(const fp64_matrix3x2_t* minuend, const fp64_matrix3x2_t* subtrahend, fp64_matrix3x2_t* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -329,7 +329,7 @@ static inline void bg_fp64_matrix3x2_subtract(const BgFP64Matrix3x2* minuend, co
|
|||
|
||||
// =============== Multiplication =============== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_multiply(const BgFP32Matrix3x2* multiplicand, const float multiplier, BgFP32Matrix3x2* product)
|
||||
static inline void fp32_matrix3x2_multiply(const fp32_matrix3x2_t* multiplicand, const float multiplier, fp32_matrix3x2_t* product)
|
||||
{
|
||||
product->r1c1 = multiplicand->r1c1 * multiplier;
|
||||
product->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -340,7 +340,7 @@ static inline void bg_fp32_matrix3x2_multiply(const BgFP32Matrix3x2* multiplican
|
|||
product->r2c3 = multiplicand->r2c3 * multiplier;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_multiply(const BgFP64Matrix3x2* multiplicand, const double multiplier, BgFP64Matrix3x2* product)
|
||||
static inline void fp64_matrix3x2_multiply(const fp64_matrix3x2_t* multiplicand, const double multiplier, fp64_matrix3x2_t* product)
|
||||
{
|
||||
product->r1c1 = multiplicand->r1c1 * multiplier;
|
||||
product->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -353,26 +353,26 @@ static inline void bg_fp64_matrix3x2_multiply(const BgFP64Matrix3x2* multiplican
|
|||
|
||||
// ================== Division ================== //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_divide(const BgFP32Matrix3x2* dividend, const float divisor, BgFP32Matrix3x2* quotient)
|
||||
static inline void fp32_matrix3x2_divide(const fp32_matrix3x2_t* dividend, const float divisor, fp32_matrix3x2_t* quotient)
|
||||
{
|
||||
bg_fp32_matrix3x2_multiply(dividend, 1.0f / divisor, quotient);
|
||||
fp32_matrix3x2_multiply(dividend, 1.0f / divisor, quotient);
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_divide(const BgFP64Matrix3x2* dividend, const double divisor, BgFP64Matrix3x2* quotient)
|
||||
static inline void fp64_matrix3x2_divide(const fp64_matrix3x2_t* dividend, const double divisor, fp64_matrix3x2_t* quotient)
|
||||
{
|
||||
bg_fp64_matrix3x2_multiply(dividend, 1.0 / divisor, quotient);
|
||||
fp64_matrix3x2_multiply(dividend, 1.0 / divisor, quotient);
|
||||
}
|
||||
|
||||
// ============ Left Vector Product ============= //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_left_product(const BgFP32Vector2* vector, const BgFP32Matrix3x2* matrix, BgFP32Vector3* result)
|
||||
static inline void fp32_matrix3x2_left_product(const fp32_vector2_t* vector, const fp32_matrix3x2_t* matrix, fp32_vector3_t* result)
|
||||
{
|
||||
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
|
||||
result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
|
||||
result->x3 = vector->x1 * matrix->r1c3 + vector->x2 * matrix->r2c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_left_product(const BgFP64Vector2* vector, const BgFP64Matrix3x2* matrix, BgFP64Vector3* result)
|
||||
static inline void fp64_matrix3x2_left_product(const fp64_vector2_t* vector, const fp64_matrix3x2_t* matrix, fp64_vector3_t* result)
|
||||
{
|
||||
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
|
||||
result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
|
||||
|
@ -381,13 +381,13 @@ static inline void bg_fp64_matrix3x2_left_product(const BgFP64Vector2* vector, c
|
|||
|
||||
// ============ Right Vector Product ============ //
|
||||
|
||||
static inline void bg_fp32_matrix3x2_right_product(const BgFP32Matrix3x2* matrix, const BgFP32Vector3* vector, BgFP32Vector2* result)
|
||||
static inline void fp32_matrix3x2_right_product(const fp32_matrix3x2_t* matrix, const fp32_vector3_t* vector, fp32_vector2_t* result)
|
||||
{
|
||||
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3;
|
||||
result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix3x2_right_product(const BgFP64Matrix3x2* matrix, const BgFP64Vector3* vector, BgFP64Vector2* result)
|
||||
static inline void fp64_matrix3x2_right_product(const fp64_matrix3x2_t* matrix, const fp64_vector3_t* vector, fp64_vector2_t* result)
|
||||
{
|
||||
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3;
|
||||
result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue