Переименование типов в соответствии со стилем 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_MATRIX2X3_H_
|
||||
#define _GEOMETRY_MATRIX2X3_H_
|
||||
#ifndef _BASIC_GEOMETRY_MATRIX2X3_H_
|
||||
#define _BASIC_GEOMETRY_MATRIX2X3_H_
|
||||
|
||||
#include "vector2.h"
|
||||
#include "vector3.h"
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_reset(BgFP32Matrix2x3* matrix)
|
||||
static inline void fp32_matrix2x3_reset(fp32_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0f;
|
||||
matrix->r1c2 = 0.0f;
|
||||
|
|
@ -19,7 +19,7 @@ static inline void bg_fp32_matrix2x3_reset(BgFP32Matrix2x3* matrix)
|
|||
matrix->r3c2 = 0.0f;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_reset(BgFP64Matrix2x3* matrix)
|
||||
static inline void fp64_matrix2x3_reset(fp64_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = 0.0;
|
||||
matrix->r1c2 = 0.0;
|
||||
|
|
@ -33,7 +33,7 @@ static inline void bg_fp64_matrix2x3_reset(BgFP64Matrix2x3* matrix)
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_copy(const BgFP32Matrix2x3* from, BgFP32Matrix2x3* to)
|
||||
static inline void fp32_matrix2x3_copy(const fp32_matrix2x3_t* from, fp32_matrix2x3_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
|
@ -45,7 +45,7 @@ static inline void bg_fp32_matrix2x3_copy(const BgFP32Matrix2x3* from, BgFP32Mat
|
|||
to->r3c2 = from->r3c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_copy(const BgFP64Matrix2x3* from, BgFP64Matrix2x3* to)
|
||||
static inline void fp64_matrix2x3_copy(const fp64_matrix2x3_t* from, fp64_matrix2x3_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
|
@ -59,7 +59,7 @@ static inline void bg_fp64_matrix2x3_copy(const BgFP64Matrix2x3* from, BgFP64Mat
|
|||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_swap(BgFP32Matrix2x3* matrix1, BgFP32Matrix2x3* matrix2)
|
||||
static inline void fp32_matrix2x3_swap(fp32_matrix2x3_t* matrix1, fp32_matrix2x3_t* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix2->r1c1;
|
||||
const float r1c2 = matrix2->r1c2;
|
||||
|
|
@ -89,7 +89,7 @@ static inline void bg_fp32_matrix2x3_swap(BgFP32Matrix2x3* matrix1, BgFP32Matrix
|
|||
matrix1->r3c2 = r3c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_swap(BgFP64Matrix2x3* matrix1, BgFP64Matrix2x3* matrix2)
|
||||
static inline void fp64_matrix2x3_swap(fp64_matrix2x3_t* matrix1, fp64_matrix2x3_t* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix2->r1c1;
|
||||
const double r1c2 = matrix2->r1c2;
|
||||
|
|
@ -121,7 +121,7 @@ static inline void bg_fp64_matrix2x3_swap(BgFP64Matrix2x3* matrix1, BgFP64Matrix
|
|||
|
||||
// ============= Copy to twin type ============== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_set_from_fp64(const BgFP64Matrix2x3* from, BgFP32Matrix2x3* to)
|
||||
static inline void fp32_matrix2x3_set_from_fp64(const fp64_matrix2x3_t* from, fp32_matrix2x3_t* to)
|
||||
{
|
||||
to->r1c1 = (float) from->r1c1;
|
||||
to->r1c2 = (float) from->r1c2;
|
||||
|
|
@ -133,7 +133,7 @@ static inline void bg_fp32_matrix2x3_set_from_fp64(const BgFP64Matrix2x3* from,
|
|||
to->r3c2 = (float) from->r3c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_set_from_fp32(const BgFP32Matrix2x3* from, BgFP64Matrix2x3* to)
|
||||
static inline void fp64_matrix2x3_set_from_fp32(const fp32_matrix2x3_t* from, fp64_matrix2x3_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r1c2;
|
||||
|
|
@ -147,7 +147,7 @@ static inline void bg_fp64_matrix2x3_set_from_fp32(const BgFP32Matrix2x3* from,
|
|||
|
||||
// =============== Set transposed =============== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_set_transposed(const BgFP32Matrix3x2* from, BgFP32Matrix2x3* to)
|
||||
static inline void fp32_matrix2x3_set_transposed(const fp32_matrix3x2_t* from, fp32_matrix2x3_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r2c1;
|
||||
|
|
@ -159,7 +159,7 @@ static inline void bg_fp32_matrix2x3_set_transposed(const BgFP32Matrix3x2* from,
|
|||
to->r3c2 = from->r2c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_set_transposed(const BgFP64Matrix3x2* from, BgFP64Matrix2x3* to)
|
||||
static inline void fp64_matrix2x3_set_transposed(const fp64_matrix3x2_t* from, fp64_matrix2x3_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r2c1;
|
||||
|
|
@ -173,7 +173,7 @@ static inline void bg_fp64_matrix2x3_set_transposed(const BgFP64Matrix3x2* from,
|
|||
|
||||
// =============== Set transposed =============== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_set_transposed_fp64(const BgFP64Matrix3x2* from, BgFP32Matrix2x3* to)
|
||||
static inline void fp32_matrix2x3_set_transposed_fp64(const fp64_matrix3x2_t* from, fp32_matrix2x3_t* to)
|
||||
{
|
||||
to->r1c1 = (float) from->r1c1;
|
||||
to->r1c2 = (float) from->r2c1;
|
||||
|
|
@ -185,7 +185,7 @@ static inline void bg_fp32_matrix2x3_set_transposed_fp64(const BgFP64Matrix3x2*
|
|||
to->r3c2 = (float) from->r2c3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_set_transposed_fp32(const BgFP32Matrix3x2* from, BgFP64Matrix2x3* to)
|
||||
static inline void fp64_matrix2x3_set_transposed_fp32(const fp32_matrix3x2_t* from, fp64_matrix2x3_t* to)
|
||||
{
|
||||
to->r1c1 = from->r1c1;
|
||||
to->r1c2 = from->r2c1;
|
||||
|
|
@ -199,13 +199,13 @@ static inline void bg_fp64_matrix2x3_set_transposed_fp32(const BgFP32Matrix3x2*
|
|||
|
||||
// ================= Set Row 1 ================== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_set_row1(const float c1, const float c2, BgFP32Matrix2x3* matrix)
|
||||
static inline void fp32_matrix2x3_set_row1(const float c1, const float c2, fp32_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_set_row1(const double c1, const double c2, BgFP64Matrix2x3* matrix)
|
||||
static inline void fp64_matrix2x3_set_row1(const double c1, const double c2, fp64_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = c1;
|
||||
matrix->r1c2 = c2;
|
||||
|
|
@ -213,13 +213,13 @@ static inline void bg_fp64_matrix2x3_set_row1(const double c1, const double c2,
|
|||
|
||||
// ================= Set Row 2 ================== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_set_row2(const float c1, const float c2, BgFP32Matrix2x3* matrix)
|
||||
static inline void fp32_matrix2x3_set_row2(const float c1, const float c2, fp32_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_set_row2(const double c1, const double c2, BgFP64Matrix2x3* matrix)
|
||||
static inline void fp64_matrix2x3_set_row2(const double c1, const double c2, fp64_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r2c1 = c1;
|
||||
matrix->r2c2 = c2;
|
||||
|
|
@ -227,13 +227,13 @@ static inline void bg_fp64_matrix2x3_set_row2(const double c1, const double c2,
|
|||
|
||||
// ================= Set Row 3 ================== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_set_row3(const float c1, const float c2, BgFP32Matrix2x3* matrix)
|
||||
static inline void fp32_matrix2x3_set_row3(const float c1, const float c2, fp32_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r3c1 = c1;
|
||||
matrix->r3c2 = c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_set_row3(const double c1, const double c2, BgFP64Matrix2x3* matrix)
|
||||
static inline void fp64_matrix2x3_set_row3(const double c1, const double c2, fp64_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r3c1 = c1;
|
||||
matrix->r3c2 = c2;
|
||||
|
|
@ -241,14 +241,14 @@ static inline void bg_fp64_matrix2x3_set_row3(const double c1, const double c2,
|
|||
|
||||
// ================ Set Column 1 ================ //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_set_column1(const float r1, const float r2, const float r3, BgFP32Matrix2x3* matrix)
|
||||
static inline void fp32_matrix2x3_set_column1(const float r1, const float r2, const float r3, fp32_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
matrix->r3c1 = r3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_set_column1(const double r1, const double r2, const double r3, BgFP64Matrix2x3* matrix)
|
||||
static inline void fp64_matrix2x3_set_column1(const double r1, const double r2, const double r3, fp64_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r1c1 = r1;
|
||||
matrix->r2c1 = r2;
|
||||
|
|
@ -257,14 +257,14 @@ static inline void bg_fp64_matrix2x3_set_column1(const double r1, const double r
|
|||
|
||||
// ================ Set Column 2 ================ //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_set_column2(const float r1, const float r2, const float r3, BgFP32Matrix2x3* matrix)
|
||||
static inline void fp32_matrix2x3_set_column2(const float r1, const float r2, const float r3, fp32_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
matrix->r3c2 = r3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_set_column2(const double r1, const double r2, const double r3, BgFP64Matrix2x3* matrix)
|
||||
static inline void fp64_matrix2x3_set_column2(const double r1, const double r2, const double r3, fp64_matrix2x3_t* matrix)
|
||||
{
|
||||
matrix->r1c2 = r1;
|
||||
matrix->r2c2 = r2;
|
||||
|
|
@ -273,7 +273,7 @@ static inline void bg_fp64_matrix2x3_set_column2(const double r1, const double r
|
|||
|
||||
// ================ Append scaled =============== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_append_scaled(BgFP32Matrix2x3* basic_vector, const BgFP32Matrix2x3* scalable_vector, const float scale)
|
||||
static inline void fp32_matrix2x3_append_scaled(fp32_matrix2x3_t* basic_vector, const fp32_matrix2x3_t* scalable_vector, const float scale)
|
||||
{
|
||||
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||
|
|
@ -285,7 +285,7 @@ static inline void bg_fp32_matrix2x3_append_scaled(BgFP32Matrix2x3* basic_vector
|
|||
basic_vector->r3c2 += scalable_vector->r3c2 * scale;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_append_scaled(BgFP64Matrix2x3* basic_vector, const BgFP64Matrix2x3* scalable_vector, const double scale)
|
||||
static inline void fp64_matrix2x3_append_scaled(fp64_matrix2x3_t* basic_vector, const fp64_matrix2x3_t* scalable_vector, const double scale)
|
||||
{
|
||||
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||
|
|
@ -299,7 +299,7 @@ static inline void bg_fp64_matrix2x3_append_scaled(BgFP64Matrix2x3* basic_vector
|
|||
|
||||
// ================== Addition ================== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_add(const BgFP32Matrix2x3* matrix1, const BgFP32Matrix2x3* matrix2, BgFP32Matrix2x3* sum)
|
||||
static inline void fp32_matrix2x3_add(const fp32_matrix2x3_t* matrix1, const fp32_matrix2x3_t* matrix2, fp32_matrix2x3_t* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
|
@ -311,7 +311,7 @@ static inline void bg_fp32_matrix2x3_add(const BgFP32Matrix2x3* matrix1, const B
|
|||
sum->r3c2 = matrix1->r3c2 + matrix2->r3c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_add(const BgFP64Matrix2x3* matrix1, const BgFP64Matrix2x3* matrix2, BgFP64Matrix2x3* sum)
|
||||
static inline void fp64_matrix2x3_add(const fp64_matrix2x3_t* matrix1, const fp64_matrix2x3_t* matrix2, fp64_matrix2x3_t* sum)
|
||||
{
|
||||
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
|
||||
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
|
||||
|
|
@ -325,7 +325,7 @@ static inline void bg_fp64_matrix2x3_add(const BgFP64Matrix2x3* matrix1, const B
|
|||
|
||||
// ================ Subtraction ================= //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_subtract(const BgFP32Matrix2x3* minuend, const BgFP32Matrix2x3* subtrahend, BgFP32Matrix2x3* difference)
|
||||
static inline void fp32_matrix2x3_subtract(const fp32_matrix2x3_t* minuend, const fp32_matrix2x3_t* subtrahend, fp32_matrix2x3_t* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
|
@ -337,7 +337,7 @@ static inline void bg_fp32_matrix2x3_subtract(const BgFP32Matrix2x3* minuend, co
|
|||
difference->r3c2 = minuend->r3c2 - subtrahend->r3c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_subtract(const BgFP64Matrix2x3* minuend, const BgFP64Matrix2x3* subtrahend, BgFP64Matrix2x3* difference)
|
||||
static inline void fp64_matrix2x3_subtract(const fp64_matrix2x3_t* minuend, const fp64_matrix2x3_t* subtrahend, fp64_matrix2x3_t* difference)
|
||||
{
|
||||
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
|
||||
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
|
@ -351,7 +351,7 @@ static inline void bg_fp64_matrix2x3_subtract(const BgFP64Matrix2x3* minuend, co
|
|||
|
||||
// =============== Multiplication =============== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_multiply(const BgFP32Matrix2x3* multiplicand, const float multiplier, BgFP32Matrix2x3* product)
|
||||
static inline void fp32_matrix2x3_multiply(const fp32_matrix2x3_t* multiplicand, const float multiplier, fp32_matrix2x3_t* product)
|
||||
{
|
||||
product->r1c1 = multiplicand->r1c1 * multiplier;
|
||||
product->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
|
@ -363,7 +363,7 @@ static inline void bg_fp32_matrix2x3_multiply(const BgFP32Matrix2x3* multiplican
|
|||
product->r3c2 = multiplicand->r3c2 * multiplier;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_multiply(const BgFP64Matrix2x3* multiplicand, const double multiplier, BgFP64Matrix2x3* product)
|
||||
static inline void fp64_matrix2x3_multiply(const fp64_matrix2x3_t* multiplicand, const double multiplier, fp64_matrix2x3_t* product)
|
||||
{
|
||||
product->r1c1 = multiplicand->r1c1 * multiplier;
|
||||
product->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
|
@ -377,25 +377,25 @@ static inline void bg_fp64_matrix2x3_multiply(const BgFP64Matrix2x3* multiplican
|
|||
|
||||
// ================== Division ================== //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_divide(const BgFP32Matrix2x3* dividend, const float divisor, BgFP32Matrix2x3* quotient)
|
||||
static inline void fp32_matrix2x3_divide(const fp32_matrix2x3_t* dividend, const float divisor, fp32_matrix2x3_t* quotient)
|
||||
{
|
||||
bg_fp32_matrix2x3_multiply(dividend, 1.0f / divisor, quotient);
|
||||
fp32_matrix2x3_multiply(dividend, 1.0f / divisor, quotient);
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_divide(const BgFP64Matrix2x3* dividend, const double divisor, BgFP64Matrix2x3* quotient)
|
||||
static inline void fp64_matrix2x3_divide(const fp64_matrix2x3_t* dividend, const double divisor, fp64_matrix2x3_t* quotient)
|
||||
{
|
||||
bg_fp64_matrix2x3_multiply(dividend, 1.0 / divisor, quotient);
|
||||
fp64_matrix2x3_multiply(dividend, 1.0 / divisor, quotient);
|
||||
}
|
||||
|
||||
// ============ Left Vector Product ============= //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_left_product(const BgFP32Vector3* vector, const BgFP32Matrix2x3* matrix, BgFP32Vector2* result)
|
||||
static inline void fp32_matrix2x3_left_product(const fp32_vector3_t* vector, const fp32_matrix2x3_t* matrix, fp32_vector2_t* result)
|
||||
{
|
||||
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1;
|
||||
result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_left_product(const BgFP64Vector3* vector, const BgFP64Matrix2x3* matrix, BgFP64Vector2* result)
|
||||
static inline void fp64_matrix2x3_left_product(const fp64_vector3_t* vector, const fp64_matrix2x3_t* matrix, fp64_vector2_t* result)
|
||||
{
|
||||
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1;
|
||||
result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
|
||||
|
|
@ -403,14 +403,14 @@ static inline void bg_fp64_matrix2x3_left_product(const BgFP64Vector3* vector, c
|
|||
|
||||
// ============ Right Vector Product ============ //
|
||||
|
||||
static inline void bg_fp32_matrix2x3_right_product(const BgFP32Matrix2x3* matrix, const BgFP32Vector2* vector, BgFP32Vector3* result)
|
||||
static inline void fp32_matrix2x3_right_product(const fp32_matrix2x3_t* matrix, const fp32_vector2_t* vector, fp32_vector3_t* result)
|
||||
{
|
||||
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
|
||||
result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
|
||||
result->x3 = matrix->r3c1 * vector->x1 + matrix->r3c2 * vector->x2;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_matrix2x3_right_product(const BgFP64Matrix2x3* matrix, const BgFP64Vector2* vector, BgFP64Vector3* result)
|
||||
static inline void fp64_matrix2x3_right_product(const fp64_matrix2x3_t* matrix, const fp64_vector2_t* vector, fp64_vector3_t* result)
|
||||
{
|
||||
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
|
||||
result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue