Переименование типов на на общепринятый формат, отказ от суффикса _t, так как он зарезервирован POSIX

This commit is contained in:
Andrey Pokidov 2025-01-15 23:56:17 +07:00
parent 3805354611
commit 0027924f86
26 changed files with 574 additions and 571 deletions

View file

@ -98,6 +98,7 @@
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -114,6 +115,7 @@
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -130,6 +132,7 @@
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>

View file

@ -10,9 +10,9 @@
#endif // _WINDOWS_ #endif // _WINDOWS_
typedef struct { typedef struct {
bgc_versor_fp32_t versor1, versor2, result; BgcVersorFP32 versor1, versor2, result;
//matrix3x3_fp32_t matrix; //BgcMatrix3x3FP32 matrix;
bgc_vector3_fp32_t vector1, vector2; BgcVector3FP32 vector1, vector2;
} structure_fp32_t; } structure_fp32_t;
structure_fp32_t* allocate_structures(const unsigned int amount) structure_fp32_t* allocate_structures(const unsigned int amount)
@ -49,7 +49,7 @@ structure_fp32_t* make_structures(const unsigned int amount)
bgc_versor_reset_fp32(&list[i].result); bgc_versor_reset_fp32(&list[i].result);
//matrix3x3_set_to_identity_fp32(&list[i].matrix); //bgc_matrix3x3_set_to_identity_fp32(&list[i].matrix);
bgc_vector3_set_values_fp32( bgc_vector3_set_values_fp32(
rand() * multiplier - 1.0f, rand() * multiplier - 1.0f,
@ -64,32 +64,32 @@ structure_fp32_t* make_structures(const unsigned int amount)
return list; return list;
} }
void print_versor_fp32(const bgc_versor_fp32_t* versor) void print_versor_fp32(const BgcVersorFP32* versor)
{ {
printf("Versor (%f, %f, %f, %f)\n", versor->s0, versor->x1, versor->x2, versor->x3); printf("Versor (%f, %f, %f, %f)\n", versor->s0, versor->x1, versor->x2, versor->x3);
} }
void print_versor_fp64(const bgc_versor_fp64_t* versor) void print_versor_fp64(const BgcVersorFP64* versor)
{ {
printf("Versor (%lf, %lf, %lf, %lf)\n", versor->s0, versor->x1, versor->x2, versor->x3); printf("Versor (%lf, %lf, %lf, %lf)\n", versor->s0, versor->x1, versor->x2, versor->x3);
} }
void print_vector_fp32(const bgc_vector3_fp32_t* vector) void print_vector_fp32(const BgcVector3FP32* vector)
{ {
printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp32(vector)); printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp32(vector));
} }
void print_vector_fp64(const bgc_vector3_fp64_t* vector) void print_vector_fp64(const BgcVector3FP64* vector)
{ {
printf("(%lf, %lf, %lf) / %lf\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp64(vector)); printf("(%lf, %lf, %lf) / %lf\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp64(vector));
} }
void item_work(structure_fp32_t* item) void item_work(structure_fp32_t* item)
{ {
//for (int j = 0; j < 1000; j++) { for (unsigned int j = 0; j < 1000; j++) {
bgc_versor_combine_fp32(&item->versor1, &item->versor2, &item->result); bgc_versor_combine_fp32(&item->versor1, &item->versor2, &item->result);
bgc_versor_turn_vector_fp32(&item->result, &item->vector1, &item->vector2); //bgc_versor_turn_vector_fp32(&item->result, &item->vector1, &item->vector2);
//} }
} }
int main() int main()

View file

@ -2,7 +2,7 @@
const int TEST_FP32_VECTOR2_AMOUNT_1 = 5; const int TEST_FP32_VECTOR2_AMOUNT_1 = 5;
const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1[] = { const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1[] = {
{ 3.0f, 4.0f }, { 3.0f, 4.0f },
{ -3.0f, -4.0f }, { -3.0f, -4.0f },
{ 10000.0f, -20000.0f }, { 10000.0f, -20000.0f },
@ -10,7 +10,7 @@ const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1[] = {
{ -123.5f, 3.7283f } { -123.5f, 3.7283f }
}; };
const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_2[] = { const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_2[] = {
{ -3.0f, -4.0f }, { -3.0f, -4.0f },
{ -3.0f, -4.0f }, { -3.0f, -4.0f },
{ 0.002f, -0.05f }, { 0.002f, -0.05f },
@ -66,7 +66,7 @@ int test_vector2_fp32_modulus()
// ===================== Add ==================== // // ===================== Add ==================== //
const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = { const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = {
{ 0.0f, 0.0f }, { 0.0f, 0.0f },
{ -6.0f, -8.0f }, { -6.0f, -8.0f },
{ 10000.002f, -20000.05f }, { 10000.002f, -20000.05f },
@ -78,7 +78,7 @@ int test_vector2_add_fp32()
{ {
print_test_name("vector2_fp32_t add"); print_test_name("vector2_fp32_t add");
bgc_vector2_fp32_t vector; BgcVector2FP32 vector;
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) { for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
bgc_vector2_add_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector); bgc_vector2_add_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
@ -96,7 +96,7 @@ int test_vector2_add_fp32()
// ================== Subtract ================== // // ================== Subtract ================== //
const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = { const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = {
{ 6.0f, 8.0f }, { 6.0f, 8.0f },
{ 0.0f, 0.0f }, { 0.0f, 0.0f },
{ 9999.998f, -19999.95f }, { 9999.998f, -19999.95f },
@ -108,7 +108,7 @@ int test_vector2_subtract_fp32()
{ {
print_test_name("vector2_fp32_t subtract"); print_test_name("vector2_fp32_t subtract");
bgc_vector2_fp32_t vector; BgcVector2FP32 vector;
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) { for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
bgc_vector2_subtract_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector); bgc_vector2_subtract_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);

View file

@ -32,7 +32,7 @@ typedef enum {
BGC_ANGLE_UNIT_RADIANS = 1, BGC_ANGLE_UNIT_RADIANS = 1,
BGC_ANGLE_UNIT_DEGREES = 2, BGC_ANGLE_UNIT_DEGREES = 2,
BGC_ANGLE_UNIT_TURNS = 3 BGC_ANGLE_UNIT_TURNS = 3
} bgc_angle_unit_t; } BgcAngleUnitEnum;
typedef enum { typedef enum {
/** /**
@ -46,7 +46,7 @@ typedef enum {
* (-180, 180] degrees, (-PI, PI] radians, (-0.5, 0.5] turns, (-200, 200] gradians * (-180, 180] degrees, (-PI, PI] radians, (-0.5, 0.5] turns, (-200, 200] gradians
*/ */
BGC_ANGLE_RANGE_SIGNED = 2 BGC_ANGLE_RANGE_SIGNED = 2
} bgc_angle_range_t; } BgcAngleRangeEnum;
// !================= Radians ==================! // // !================= Radians ==================! //
@ -76,7 +76,7 @@ inline double bgc_radians_to_turns_fp64(const double radians)
// ========= Convert radians to any unit ======== // // ========= Convert radians to any unit ======== //
inline float bgc_radians_to_units_fp32(const float radians, const bgc_angle_unit_t to_unit) inline float bgc_radians_to_units_fp32(const float radians, const BgcAngleUnitEnum to_unit)
{ {
if (to_unit == BGC_ANGLE_UNIT_DEGREES) { if (to_unit == BGC_ANGLE_UNIT_DEGREES) {
return radians * BGC_DEGREES_IN_RADIAN_FP32; return radians * BGC_DEGREES_IN_RADIAN_FP32;
@ -89,7 +89,7 @@ inline float bgc_radians_to_units_fp32(const float radians, const bgc_angle_unit
return radians; return radians;
} }
inline double bgc_radians_to_units_fp64(const double radians, const bgc_angle_unit_t to_unit) inline double bgc_radians_to_units_fp64(const double radians, const BgcAngleUnitEnum to_unit)
{ {
if (to_unit == BGC_ANGLE_UNIT_DEGREES) { if (to_unit == BGC_ANGLE_UNIT_DEGREES) {
return radians * BGC_DEGREES_IN_RADIAN_FP64; return radians * BGC_DEGREES_IN_RADIAN_FP64;
@ -104,7 +104,7 @@ inline double bgc_radians_to_units_fp64(const double radians, const bgc_angle_un
// ============ Normalize radians ============= // // ============ Normalize radians ============= //
inline float bgc_radians_normalize_fp32(const float radians, const bgc_angle_range_t range) inline float bgc_radians_normalize_fp32(const float radians, const BgcAngleRangeEnum range)
{ {
if (range == BGC_ANGLE_RANGE_UNSIGNED) { if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0f <= radians && radians < BGC_TWO_PI_FP32) { if (0.0f <= radians && radians < BGC_TWO_PI_FP32) {
@ -128,7 +128,7 @@ inline float bgc_radians_normalize_fp32(const float radians, const bgc_angle_ran
return turns * BGC_TWO_PI_FP32; return turns * BGC_TWO_PI_FP32;
} }
inline double bgc_radians_normalize_fp64(const double radians, const bgc_angle_range_t range) inline double bgc_radians_normalize_fp64(const double radians, const BgcAngleRangeEnum range)
{ {
if (range == BGC_ANGLE_RANGE_UNSIGNED) { if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0 <= radians && radians < BGC_TWO_PI_FP64) { if (0.0 <= radians && radians < BGC_TWO_PI_FP64) {
@ -180,7 +180,7 @@ inline double fp64_degrees_to_turns(const double radians)
// ========= Convert degreess to any unit ======== // // ========= Convert degreess to any unit ======== //
inline float bgc_degrees_to_units_fp32(const float degrees, const bgc_angle_unit_t to_unit) inline float bgc_degrees_to_units_fp32(const float degrees, const BgcAngleUnitEnum to_unit)
{ {
if (to_unit == BGC_ANGLE_UNIT_RADIANS) { if (to_unit == BGC_ANGLE_UNIT_RADIANS) {
return degrees * BGC_RADIANS_IN_DEGREE_FP32; return degrees * BGC_RADIANS_IN_DEGREE_FP32;
@ -193,7 +193,7 @@ inline float bgc_degrees_to_units_fp32(const float degrees, const bgc_angle_unit
return degrees; return degrees;
} }
inline double bgc_degrees_to_units_fp64(const double degrees, const bgc_angle_unit_t to_unit) inline double bgc_degrees_to_units_fp64(const double degrees, const BgcAngleUnitEnum to_unit)
{ {
if (to_unit == BGC_ANGLE_UNIT_RADIANS) { if (to_unit == BGC_ANGLE_UNIT_RADIANS) {
return degrees * BGC_RADIANS_IN_DEGREE_FP64; return degrees * BGC_RADIANS_IN_DEGREE_FP64;
@ -208,7 +208,7 @@ inline double bgc_degrees_to_units_fp64(const double degrees, const bgc_angle_un
// ============ Normalize degrees ============= // // ============ Normalize degrees ============= //
inline float bgc_degrees_normalize_fp32(const float degrees, const bgc_angle_range_t range) inline float bgc_degrees_normalize_fp32(const float degrees, const BgcAngleRangeEnum range)
{ {
if (range == BGC_ANGLE_RANGE_UNSIGNED) { if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0f <= degrees && degrees < 360.0f) { if (0.0f <= degrees && degrees < 360.0f) {
@ -232,7 +232,7 @@ inline float bgc_degrees_normalize_fp32(const float degrees, const bgc_angle_ran
return turns * 360.0f; return turns * 360.0f;
} }
inline double bgc_degrees_normalize_fp64(const double degrees, const bgc_angle_range_t range) inline double bgc_degrees_normalize_fp64(const double degrees, const BgcAngleRangeEnum range)
{ {
if (range == BGC_ANGLE_RANGE_UNSIGNED) { if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0 <= degrees && degrees < 360.0) { if (0.0 <= degrees && degrees < 360.0) {
@ -284,7 +284,7 @@ inline double bgc_turns_to_degrees_fp64(const double turns)
// ========= Convert turns to any unit ======== // // ========= Convert turns to any unit ======== //
inline float bgc_turns_to_units_fp32(const float turns, const bgc_angle_unit_t to_unit) inline float bgc_turns_to_units_fp32(const float turns, const BgcAngleUnitEnum to_unit)
{ {
if (to_unit == BGC_ANGLE_UNIT_RADIANS) { if (to_unit == BGC_ANGLE_UNIT_RADIANS) {
return turns * BGC_TWO_PI_FP32; return turns * BGC_TWO_PI_FP32;
@ -297,7 +297,7 @@ inline float bgc_turns_to_units_fp32(const float turns, const bgc_angle_unit_t t
return turns; return turns;
} }
inline double bgc_turns_to_units_fp64(const double turns, const bgc_angle_unit_t to_unit) inline double bgc_turns_to_units_fp64(const double turns, const BgcAngleUnitEnum to_unit)
{ {
if (to_unit == BGC_ANGLE_UNIT_RADIANS) { if (to_unit == BGC_ANGLE_UNIT_RADIANS) {
return turns * BGC_TWO_PI_FP64; return turns * BGC_TWO_PI_FP64;
@ -312,7 +312,7 @@ inline double bgc_turns_to_units_fp64(const double turns, const bgc_angle_unit_t
// ============= Normalize turns ============== // // ============= Normalize turns ============== //
inline float bgc_turns_normalize_fp32(const float turns, const bgc_angle_range_t range) inline float bgc_turns_normalize_fp32(const float turns, const BgcAngleRangeEnum range)
{ {
if (range == BGC_ANGLE_RANGE_UNSIGNED) { if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0f <= turns && turns < 1.0f) { if (0.0f <= turns && turns < 1.0f) {
@ -334,7 +334,7 @@ inline float bgc_turns_normalize_fp32(const float turns, const bgc_angle_range_t
return rest; return rest;
} }
inline double bgc_turns_normalize_fp64(const double turns, const bgc_angle_range_t range) inline double bgc_turns_normalize_fp64(const double turns, const BgcAngleRangeEnum range)
{ {
if (range == BGC_ANGLE_RANGE_UNSIGNED) { if (range == BGC_ANGLE_RANGE_UNSIGNED) {
if (0.0 <= turns && turns < 1.0) { if (0.0 <= turns && turns < 1.0) {
@ -360,7 +360,7 @@ inline double bgc_turns_normalize_fp64(const double turns, const bgc_angle_range
// ========= Convert any unit to radians ======== // // ========= Convert any unit to radians ======== //
inline float bgc_angle_to_radians_fp32(const float angle, const bgc_angle_unit_t unit) inline float bgc_angle_to_radians_fp32(const float angle, const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return angle * BGC_RADIANS_IN_DEGREE_FP32; return angle * BGC_RADIANS_IN_DEGREE_FP32;
@ -373,7 +373,7 @@ inline float bgc_angle_to_radians_fp32(const float angle, const bgc_angle_unit_t
return angle; return angle;
} }
inline double bgc_angle_to_radians_fp64(const double angle, const bgc_angle_unit_t unit) inline double bgc_angle_to_radians_fp64(const double angle, const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return angle * BGC_RADIANS_IN_DEGREE_FP64; return angle * BGC_RADIANS_IN_DEGREE_FP64;
@ -388,7 +388,7 @@ inline double bgc_angle_to_radians_fp64(const double angle, const bgc_angle_unit
// ========= Convert any unit to degreess ======== // // ========= Convert any unit to degreess ======== //
inline float bgc_angle_to_degrees_fp32(const float angle, const bgc_angle_unit_t unit) inline float bgc_angle_to_degrees_fp32(const float angle, const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_RADIANS) { if (unit == BGC_ANGLE_UNIT_RADIANS) {
return angle * BGC_DEGREES_IN_RADIAN_FP32; return angle * BGC_DEGREES_IN_RADIAN_FP32;
@ -401,7 +401,7 @@ inline float bgc_angle_to_degrees_fp32(const float angle, const bgc_angle_unit_t
return angle; return angle;
} }
inline double bgc_angle_to_degrees_fp64(const double angle, const bgc_angle_unit_t unit) inline double bgc_angle_to_degrees_fp64(const double angle, const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_RADIANS) { if (unit == BGC_ANGLE_UNIT_RADIANS) {
return angle * BGC_DEGREES_IN_RADIAN_FP64; return angle * BGC_DEGREES_IN_RADIAN_FP64;
@ -416,7 +416,7 @@ inline double bgc_angle_to_degrees_fp64(const double angle, const bgc_angle_unit
// ========= Convert any unit to turns ======== // // ========= Convert any unit to turns ======== //
inline float bgc_angle_to_turns_fp32(const float angle, const bgc_angle_unit_t unit) inline float bgc_angle_to_turns_fp32(const float angle, const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_RADIANS) { if (unit == BGC_ANGLE_UNIT_RADIANS) {
return angle * BGC_TURNS_IN_RADIAN_FP32; return angle * BGC_TURNS_IN_RADIAN_FP32;
@ -429,7 +429,7 @@ inline float bgc_angle_to_turns_fp32(const float angle, const bgc_angle_unit_t u
return angle; return angle;
} }
inline double bgc_angle_to_turns_fp64(const double angle, const bgc_angle_unit_t unit) inline double bgc_angle_to_turns_fp64(const double angle, const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_RADIANS) { if (unit == BGC_ANGLE_UNIT_RADIANS) {
return angle * BGC_TURNS_IN_RADIAN_FP64; return angle * BGC_TURNS_IN_RADIAN_FP64;
@ -444,7 +444,7 @@ inline double bgc_angle_to_turns_fp64(const double angle, const bgc_angle_unit_t
// ============= Get Full Circle ============== // // ============= Get Full Circle ============== //
inline float bgc_angle_get_full_circle_fp32(const bgc_angle_unit_t unit) inline float bgc_angle_get_full_circle_fp32(const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 360.0f; return 360.0f;
@ -457,7 +457,7 @@ inline float bgc_angle_get_full_circle_fp32(const bgc_angle_unit_t unit)
return BGC_TWO_PI_FP32; return BGC_TWO_PI_FP32;
} }
inline double bgc_angle_get_full_circle_fp64(const bgc_angle_unit_t unit) inline double bgc_angle_get_full_circle_fp64(const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 360.0; return 360.0;
@ -472,7 +472,7 @@ inline double bgc_angle_get_full_circle_fp64(const bgc_angle_unit_t unit)
// ============= Get Half Circle ============== // // ============= Get Half Circle ============== //
inline float bgc_angle_get_half_circle_fp32(const bgc_angle_unit_t unit) inline float bgc_angle_get_half_circle_fp32(const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 180.0f; return 180.0f;
@ -485,7 +485,7 @@ inline float bgc_angle_get_half_circle_fp32(const bgc_angle_unit_t unit)
return BGC_PI_FP32; return BGC_PI_FP32;
} }
inline double bgc_angle_get_half_circle_fp64(const bgc_angle_unit_t unit) inline double bgc_angle_get_half_circle_fp64(const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 180.0; return 180.0;
@ -500,7 +500,7 @@ inline double bgc_angle_get_half_circle_fp64(const bgc_angle_unit_t unit)
// ============= Get Half Circle ============== // // ============= Get Half Circle ============== //
inline float bgc_angle_get_quater_circle_fp32(const bgc_angle_unit_t unit) inline float bgc_angle_get_quater_circle_fp32(const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 90.0f; return 90.0f;
@ -513,7 +513,7 @@ inline float bgc_angle_get_quater_circle_fp32(const bgc_angle_unit_t unit)
return BGC_HALF_OF_PI_FP32; return BGC_HALF_OF_PI_FP32;
} }
inline double bgc_angle_get_quater_circle_fp64(const bgc_angle_unit_t unit) inline double bgc_angle_get_quater_circle_fp64(const BgcAngleUnitEnum unit)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return 90.0; return 90.0;
@ -528,7 +528,7 @@ inline double bgc_angle_get_quater_circle_fp64(const bgc_angle_unit_t unit)
// ================ Normalize ================= // // ================ Normalize ================= //
inline float bgc_angle_normalize_fp32(const float angle, const bgc_angle_unit_t unit, const bgc_angle_range_t range) inline float bgc_angle_normalize_fp32(const float angle, const BgcAngleUnitEnum unit, const BgcAngleRangeEnum range)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return bgc_degrees_normalize_fp32(angle, range); return bgc_degrees_normalize_fp32(angle, range);
@ -541,7 +541,7 @@ inline float bgc_angle_normalize_fp32(const float angle, const bgc_angle_unit_t
return bgc_radians_normalize_fp32(angle, range); return bgc_radians_normalize_fp32(angle, range);
} }
inline double bgc_angle_normalize_fp64(const double angle, const bgc_angle_unit_t unit, const bgc_angle_range_t range) inline double bgc_angle_normalize_fp64(const double angle, const BgcAngleUnitEnum unit, const BgcAngleRangeEnum range)
{ {
if (unit == BGC_ANGLE_UNIT_DEGREES) { if (unit == BGC_ANGLE_UNIT_DEGREES) {
return bgc_degrees_normalize_fp64(angle, range); return bgc_degrees_normalize_fp64(angle, range);

View file

@ -48,9 +48,6 @@
</Unit> </Unit>
<Unit filename="angle.h" /> <Unit filename="angle.h" />
<Unit filename="basic-geometry.h" /> <Unit filename="basic-geometry.h" />
<Unit filename="basis.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrix2x2.c"> <Unit filename="matrix2x2.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>
@ -77,6 +74,9 @@
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>
<Unit filename="tangent.h" /> <Unit filename="tangent.h" />
<Unit filename="utilities.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="utilities.h" /> <Unit filename="utilities.h" />
<Unit filename="vector2.c"> <Unit filename="vector2.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />

View file

@ -29,14 +29,14 @@
<ClInclude Include="quaternion.h" /> <ClInclude Include="quaternion.h" />
<ClInclude Include="rotation3.h" /> <ClInclude Include="rotation3.h" />
<ClInclude Include="tangent.h" /> <ClInclude Include="tangent.h" />
<ClInclude Include="utilities.h" /> <ClInclude Include="utilities.h" />
<ClInclude Include="versor.h" /> <ClInclude Include="versor.h" />
<ClInclude Include="vector2.h" /> <ClInclude Include="vector2.h" />
<ClInclude Include="vector3.h" /> <ClInclude Include="vector3.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="angle.c" /> <ClCompile Include="angle.c" />
<ClCompile Include="basis.c" /> <ClCompile Include="utilities.c" />
<ClCompile Include="matrix2x2.c" /> <ClCompile Include="matrix2x2.c" />
<ClCompile Include="matrix2x3.c" /> <ClCompile Include="matrix2x3.c" />
<ClCompile Include="matrix3x2.c" /> <ClCompile Include="matrix3x2.c" />

View file

@ -62,7 +62,7 @@
<ClCompile Include="angle.c"> <ClCompile Include="angle.c">
<Filter>Исходные файлы</Filter> <Filter>Исходные файлы</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="basis.c"> <ClCompile Include="utilities.c">
<Filter>Исходные файлы</Filter> <Filter>Исходные файлы</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="matrix2x2.c"> <ClCompile Include="matrix2x2.c">

View file

@ -7,7 +7,7 @@
// =================== Reset ==================== // // =================== Reset ==================== //
inline void bgc_matrix2x2_reset_fp32(bgc_matrix2x2_fp32_t* matrix) inline void bgc_matrix2x2_reset_fp32(BgcMatrix2x2FP32* matrix)
{ {
matrix->r1c1 = 0.0f; matrix->r1c1 = 0.0f;
matrix->r1c2 = 0.0f; matrix->r1c2 = 0.0f;
@ -15,7 +15,7 @@ inline void bgc_matrix2x2_reset_fp32(bgc_matrix2x2_fp32_t* matrix)
matrix->r2c2 = 0.0f; matrix->r2c2 = 0.0f;
} }
inline void bgc_matrix2x2_reset_fp64(bgc_matrix2x2_fp64_t* matrix) inline void bgc_matrix2x2_reset_fp64(BgcMatrix2x2FP64* matrix)
{ {
matrix->r1c1 = 0.0; matrix->r1c1 = 0.0;
matrix->r1c2 = 0.0; matrix->r1c2 = 0.0;
@ -25,7 +25,7 @@ inline void bgc_matrix2x2_reset_fp64(bgc_matrix2x2_fp64_t* matrix)
// ================== Identity ================== // // ================== Identity ================== //
inline void bgc_matrix2x2_set_to_identity_fp32(bgc_matrix2x2_fp32_t* matrix) inline void bgc_matrix2x2_set_to_identity_fp32(BgcMatrix2x2FP32* matrix)
{ {
matrix->r1c1 = 1.0f; matrix->r1c1 = 1.0f;
matrix->r1c2 = 0.0f; matrix->r1c2 = 0.0f;
@ -33,7 +33,7 @@ inline void bgc_matrix2x2_set_to_identity_fp32(bgc_matrix2x2_fp32_t* matrix)
matrix->r2c2 = 1.0f; matrix->r2c2 = 1.0f;
} }
inline void bgc_matrix2x2_set_to_identity_fp64(bgc_matrix2x2_fp64_t* matrix) inline void bgc_matrix2x2_set_to_identity_fp64(BgcMatrix2x2FP64* matrix)
{ {
matrix->r1c1 = 1.0; matrix->r1c1 = 1.0;
matrix->r1c2 = 0.0; matrix->r1c2 = 0.0;
@ -43,7 +43,7 @@ inline void bgc_matrix2x2_set_to_identity_fp64(bgc_matrix2x2_fp64_t* matrix)
// ================ Make Diagonal =============== // // ================ Make Diagonal =============== //
inline void bgc_matrix2x2_set_to_diagonal_fp32(const float d1, const float d2, bgc_matrix2x2_fp32_t* matrix) inline void bgc_matrix2x2_set_to_diagonal_fp32(const float d1, const float d2, BgcMatrix2x2FP32* matrix)
{ {
matrix->r1c1 = d1; matrix->r1c1 = d1;
matrix->r1c2 = 0.0f; matrix->r1c2 = 0.0f;
@ -51,7 +51,7 @@ inline void bgc_matrix2x2_set_to_diagonal_fp32(const float d1, const float d2, b
matrix->r2c2 = d2; matrix->r2c2 = d2;
} }
inline void bgc_matrix2x2_set_to_diagonal_fp64(const double d1, const double d2, bgc_matrix2x2_fp64_t* matrix) inline void bgc_matrix2x2_set_to_diagonal_fp64(const double d1, const double d2, BgcMatrix2x2FP64* matrix)
{ {
matrix->r1c1 = d1; matrix->r1c1 = d1;
matrix->r1c2 = 0.0; matrix->r1c2 = 0.0;
@ -61,7 +61,7 @@ inline void bgc_matrix2x2_set_to_diagonal_fp64(const double d1, const double d2,
// ============== Rotation Matrix =============== // // ============== Rotation Matrix =============== //
inline void bgc_matrix2x2_make_rotation_fp32(const float angle, const bgc_angle_unit_t unit, bgc_matrix2x2_fp32_t* matrix) inline void bgc_matrix2x2_make_rotation_fp32(const float angle, const BgcAngleUnitEnum unit, BgcMatrix2x2FP32* matrix)
{ {
const float radians = bgc_angle_to_radians_fp32(angle, unit); const float radians = bgc_angle_to_radians_fp32(angle, unit);
const float cosine = cosf(radians); const float cosine = cosf(radians);
@ -73,7 +73,7 @@ inline void bgc_matrix2x2_make_rotation_fp32(const float angle, const bgc_angle_
matrix->r2c2 = cosine; matrix->r2c2 = cosine;
} }
inline void bgc_matrix2x2_make_rotation_fp64(const double angle, const bgc_angle_unit_t unit, bgc_matrix2x2_fp64_t* matrix) inline void bgc_matrix2x2_make_rotation_fp64(const double angle, const BgcAngleUnitEnum unit, BgcMatrix2x2FP64* matrix)
{ {
const double radians = bgc_angle_to_radians_fp64(angle, unit); const double radians = bgc_angle_to_radians_fp64(angle, unit);
const double cosine = cos(radians); const double cosine = cos(radians);
@ -87,7 +87,7 @@ inline void bgc_matrix2x2_make_rotation_fp64(const double angle, const bgc_angle
// ==================== Copy ==================== // // ==================== Copy ==================== //
inline void bgc_matrix2x2_copy_fp32(const bgc_matrix2x2_fp32_t* from, bgc_matrix2x2_fp32_t* to) inline void bgc_matrix2x2_copy_fp32(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP32* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -96,7 +96,7 @@ inline void bgc_matrix2x2_copy_fp32(const bgc_matrix2x2_fp32_t* from, bgc_matrix
to->r2c2 = from->r2c2; to->r2c2 = from->r2c2;
} }
inline void bgc_matrix2x2_copy_fp64(const bgc_matrix2x2_fp64_t* from, bgc_matrix2x2_fp64_t* to) inline void bgc_matrix2x2_copy_fp64(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -107,7 +107,7 @@ inline void bgc_matrix2x2_copy_fp64(const bgc_matrix2x2_fp64_t* from, bgc_matrix
// ==================== Swap ==================== // // ==================== Swap ==================== //
inline void bgc_matrix2x2_swap_fp32(bgc_matrix2x2_fp32_t* matrix1, bgc_matrix2x2_fp32_t* matrix2) inline void bgc_matrix2x2_swap_fp32(BgcMatrix2x2FP32* matrix1, BgcMatrix2x2FP32* matrix2)
{ {
const float r1c1 = matrix2->r1c1; const float r1c1 = matrix2->r1c1;
const float r1c2 = matrix2->r1c2; const float r1c2 = matrix2->r1c2;
@ -128,7 +128,7 @@ inline void bgc_matrix2x2_swap_fp32(bgc_matrix2x2_fp32_t* matrix1, bgc_matrix2x2
matrix1->r2c2 = r2c2; matrix1->r2c2 = r2c2;
} }
inline void bgc_matrix2x2_swap_fp64(bgc_matrix2x2_fp64_t* matrix1, bgc_matrix2x2_fp64_t* matrix2) inline void bgc_matrix2x2_swap_fp64(BgcMatrix2x2FP64* matrix1, BgcMatrix2x2FP64* matrix2)
{ {
const double r1c1 = matrix2->r1c1; const double r1c1 = matrix2->r1c1;
const double r1c2 = matrix2->r1c2; const double r1c2 = matrix2->r1c2;
@ -151,7 +151,7 @@ inline void bgc_matrix2x2_swap_fp64(bgc_matrix2x2_fp64_t* matrix1, bgc_matrix2x2
// ============= Copy to twin type ============== // // ============= Copy to twin type ============== //
inline void bgc_matrix2x2_convert_fp64_to_fp32(const bgc_matrix2x2_fp64_t* from, bgc_matrix2x2_fp32_t* to) inline void bgc_matrix2x2_convert_fp64_to_fp32(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP32* to)
{ {
to->r1c1 = (float)from->r1c1; to->r1c1 = (float)from->r1c1;
to->r1c2 = (float)from->r1c2; to->r1c2 = (float)from->r1c2;
@ -160,7 +160,7 @@ inline void bgc_matrix2x2_convert_fp64_to_fp32(const bgc_matrix2x2_fp64_t* from,
to->r2c2 = (float)from->r2c2; to->r2c2 = (float)from->r2c2;
} }
inline void bgc_matrix2x2_convert_fp32_to_fp64(const bgc_matrix2x2_fp32_t* from, bgc_matrix2x2_fp64_t* to) inline void bgc_matrix2x2_convert_fp32_to_fp64(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -171,26 +171,26 @@ inline void bgc_matrix2x2_convert_fp32_to_fp64(const bgc_matrix2x2_fp32_t* from,
// ================ Determinant ================= // // ================ Determinant ================= //
inline float bgc_matrix2x2_get_determinant_fp32(const bgc_matrix2x2_fp32_t* matrix) inline float bgc_matrix2x2_get_determinant_fp32(const BgcMatrix2x2FP32* matrix)
{ {
return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1; return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
} }
inline double bgc_matrix2x2_get_determinant_fp64(const bgc_matrix2x2_fp64_t* matrix) inline double bgc_matrix2x2_get_determinant_fp64(const BgcMatrix2x2FP64* matrix)
{ {
return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1; return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
} }
// ================== Singular ================== // // ================== Singular ================== //
inline int bgc_matrix2x2_is_singular_fp32(const bgc_matrix2x2_fp32_t* matrix) inline int bgc_matrix2x2_is_singular_fp32(const BgcMatrix2x2FP32* matrix)
{ {
const float determinant = bgc_matrix2x2_get_determinant_fp32(matrix); const float determinant = bgc_matrix2x2_get_determinant_fp32(matrix);
return -BGC_EPSYLON_FP32 <= determinant && determinant <= BGC_EPSYLON_FP32; return -BGC_EPSYLON_FP32 <= determinant && determinant <= BGC_EPSYLON_FP32;
} }
inline int bgc_matrix2x2_is_singular_fp64(const bgc_matrix2x2_fp64_t* matrix) inline int bgc_matrix2x2_is_singular_fp64(const BgcMatrix2x2FP64* matrix)
{ {
const double determinant = bgc_matrix2x2_get_determinant_fp64(matrix); const double determinant = bgc_matrix2x2_get_determinant_fp64(matrix);
@ -199,14 +199,14 @@ inline int bgc_matrix2x2_is_singular_fp64(const bgc_matrix2x2_fp64_t* matrix)
// =============== Transposition ================ // // =============== Transposition ================ //
inline void bgc_matrix2x2_transpose_fp32(bgc_matrix2x2_fp32_t* matrix) inline void bgc_matrix2x2_transpose_fp32(BgcMatrix2x2FP32* matrix)
{ {
const float tmp = matrix->r1c2; const float tmp = matrix->r1c2;
matrix->r1c2 = matrix->r2c1; matrix->r1c2 = matrix->r2c1;
matrix->r2c1 = tmp; matrix->r2c1 = tmp;
} }
inline void bgc_matrix2x2_transpose_fp64(bgc_matrix2x2_fp64_t* matrix) inline void bgc_matrix2x2_transpose_fp64(BgcMatrix2x2FP64* matrix)
{ {
const double tmp = matrix->r1c2; const double tmp = matrix->r1c2;
matrix->r1c2 = matrix->r2c1; matrix->r1c2 = matrix->r2c1;
@ -215,7 +215,7 @@ inline void bgc_matrix2x2_transpose_fp64(bgc_matrix2x2_fp64_t* matrix)
// ================= Inversion ================== // // ================= Inversion ================== //
inline int bgc_matrix2x2_invert_fp32(bgc_matrix2x2_fp32_t* matrix) inline int bgc_matrix2x2_invert_fp32(BgcMatrix2x2FP32* matrix)
{ {
const float determinant = bgc_matrix2x2_get_determinant_fp32(matrix); const float determinant = bgc_matrix2x2_get_determinant_fp32(matrix);
@ -240,7 +240,7 @@ inline int bgc_matrix2x2_invert_fp32(bgc_matrix2x2_fp32_t* matrix)
return 1; return 1;
} }
inline int bgc_matrix2x2_invert_fp64(bgc_matrix2x2_fp64_t* matrix) inline int bgc_matrix2x2_invert_fp64(BgcMatrix2x2FP64* matrix)
{ {
const double determinant = bgc_matrix2x2_get_determinant_fp64(matrix); const double determinant = bgc_matrix2x2_get_determinant_fp64(matrix);
@ -267,7 +267,7 @@ inline int bgc_matrix2x2_invert_fp64(bgc_matrix2x2_fp64_t* matrix)
// =============== Set Transposed =============== // // =============== Set Transposed =============== //
inline void bgc_matrix2x2_set_transposed_fp32(const bgc_matrix2x2_fp32_t* from, bgc_matrix2x2_fp32_t* to) inline void bgc_matrix2x2_set_transposed_fp32(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP32* to)
{ {
float tmp = from->r1c2; float tmp = from->r1c2;
@ -278,7 +278,7 @@ inline void bgc_matrix2x2_set_transposed_fp32(const bgc_matrix2x2_fp32_t* from,
to->r2c2 = from->r2c2; to->r2c2 = from->r2c2;
} }
inline void bgc_matrix2x2_set_transposed_fp64(const bgc_matrix2x2_fp64_t* from, bgc_matrix2x2_fp64_t* to) inline void bgc_matrix2x2_set_transposed_fp64(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP64* to)
{ {
double tmp = from->r1c2; double tmp = from->r1c2;
@ -291,7 +291,7 @@ inline void bgc_matrix2x2_set_transposed_fp64(const bgc_matrix2x2_fp64_t* from,
// ================ Set Inverted ================ // // ================ Set Inverted ================ //
inline int bgc_matrix2x2_set_inverted_fp32(const bgc_matrix2x2_fp32_t* from, bgc_matrix2x2_fp32_t* to) inline int bgc_matrix2x2_set_inverted_fp32(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP32* to)
{ {
const float determinant = bgc_matrix2x2_get_determinant_fp32(from); const float determinant = bgc_matrix2x2_get_determinant_fp32(from);
@ -316,7 +316,7 @@ inline int bgc_matrix2x2_set_inverted_fp32(const bgc_matrix2x2_fp32_t* from, bgc
return 1; return 1;
} }
inline int bgc_matrix2x2_set_inverted_fp64(const bgc_matrix2x2_fp64_t* from, bgc_matrix2x2_fp64_t* to) inline int bgc_matrix2x2_set_inverted_fp64(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP64* to)
{ {
const double determinant = bgc_matrix2x2_get_determinant_fp64(from); const double determinant = bgc_matrix2x2_get_determinant_fp64(from);
@ -343,13 +343,13 @@ inline int bgc_matrix2x2_set_inverted_fp64(const bgc_matrix2x2_fp64_t* from, bgc
// ================= Set Row 1 ================== // // ================= Set Row 1 ================== //
inline void bgc_matrix2x2_set_row1_fp32(const float c1, const float c2, bgc_matrix2x2_fp32_t* matrix) inline void bgc_matrix2x2_set_row1_fp32(const float c1, const float c2, BgcMatrix2x2FP32* matrix)
{ {
matrix->r1c1 = c1; matrix->r1c1 = c1;
matrix->r1c2 = c2; matrix->r1c2 = c2;
} }
inline void bgc_matrix2x2_set_row1_fp64(const double c1, const double c2, bgc_matrix2x2_fp64_t* matrix) inline void bgc_matrix2x2_set_row1_fp64(const double c1, const double c2, BgcMatrix2x2FP64* matrix)
{ {
matrix->r1c1 = c1; matrix->r1c1 = c1;
matrix->r1c2 = c2; matrix->r1c2 = c2;
@ -357,13 +357,13 @@ inline void bgc_matrix2x2_set_row1_fp64(const double c1, const double c2, bgc_ma
// ================= Set Row 2 ================== // // ================= Set Row 2 ================== //
inline void bgc_matrix2x2_set_row2_fp32(const float c1, const float c2, bgc_matrix2x2_fp32_t* matrix) inline void bgc_matrix2x2_set_row2_fp32(const float c1, const float c2, BgcMatrix2x2FP32* matrix)
{ {
matrix->r2c1 = c1; matrix->r2c1 = c1;
matrix->r2c2 = c2; matrix->r2c2 = c2;
} }
inline void bgc_matrix2x2_set_row2_fp64(const double c1, const double c2, bgc_matrix2x2_fp64_t* matrix) inline void bgc_matrix2x2_set_row2_fp64(const double c1, const double c2, BgcMatrix2x2FP64* matrix)
{ {
matrix->r2c1 = c1; matrix->r2c1 = c1;
matrix->r2c2 = c2; matrix->r2c2 = c2;
@ -371,13 +371,13 @@ inline void bgc_matrix2x2_set_row2_fp64(const double c1, const double c2, bgc_ma
// ================ Set Column 1 ================ // // ================ Set Column 1 ================ //
inline void bgc_matrix2x2_set_column1_fp32(const float r1, const float r2, bgc_matrix2x2_fp32_t* matrix) inline void bgc_matrix2x2_set_column1_fp32(const float r1, const float r2, BgcMatrix2x2FP32* matrix)
{ {
matrix->r1c1 = r1; matrix->r1c1 = r1;
matrix->r2c1 = r2; matrix->r2c1 = r2;
} }
inline void bgc_matrix2x2_set_column1_fp64(const double r1, const double r2, bgc_matrix2x2_fp64_t* matrix) inline void bgc_matrix2x2_set_column1_fp64(const double r1, const double r2, BgcMatrix2x2FP64* matrix)
{ {
matrix->r1c1 = r1; matrix->r1c1 = r1;
matrix->r2c1 = r2; matrix->r2c1 = r2;
@ -385,13 +385,13 @@ inline void bgc_matrix2x2_set_column1_fp64(const double r1, const double r2, bgc
// ================ Set Column 2 ================ // // ================ Set Column 2 ================ //
inline void bgc_matrix2x2_set_column2_fp32(const float r1, const float r2, bgc_matrix2x2_fp32_t* matrix) inline void bgc_matrix2x2_set_column2_fp32(const float r1, const float r2, BgcMatrix2x2FP32* matrix)
{ {
matrix->r1c2 = r1; matrix->r1c2 = r1;
matrix->r2c2 = r2; matrix->r2c2 = r2;
} }
inline void bgc_matrix2x2_set_column2_fp64(const double r1, const double r2, bgc_matrix2x2_fp64_t* matrix) inline void bgc_matrix2x2_set_column2_fp64(const double r1, const double r2, BgcMatrix2x2FP64* matrix)
{ {
matrix->r1c2 = r1; matrix->r1c2 = r1;
matrix->r2c2 = r2; matrix->r2c2 = r2;
@ -399,7 +399,7 @@ inline void bgc_matrix2x2_set_column2_fp64(const double r1, const double r2, bgc
// ================== Addition ================== // // ================== Addition ================== //
inline void bgc_matrix2x2_add_fp32(const bgc_matrix2x2_fp32_t* matrix1, const bgc_matrix2x2_fp32_t* matrix2, bgc_matrix2x2_fp32_t* sum) inline void bgc_matrix2x2_add_fp32(const BgcMatrix2x2FP32* matrix1, const BgcMatrix2x2FP32* matrix2, BgcMatrix2x2FP32* sum)
{ {
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1; sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2; sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -408,7 +408,7 @@ inline void bgc_matrix2x2_add_fp32(const bgc_matrix2x2_fp32_t* matrix1, const bg
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2; sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
} }
inline void bgc_matrix2x2_add_fp64(const bgc_matrix2x2_fp64_t* matrix1, const bgc_matrix2x2_fp64_t* matrix2, bgc_matrix2x2_fp64_t* sum) inline void bgc_matrix2x2_add_fp64(const BgcMatrix2x2FP64* matrix1, const BgcMatrix2x2FP64* matrix2, BgcMatrix2x2FP64* sum)
{ {
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1; sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2; sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -419,7 +419,7 @@ inline void bgc_matrix2x2_add_fp64(const bgc_matrix2x2_fp64_t* matrix1, const bg
// ================= Add scaled ================= // // ================= Add scaled ================= //
inline void bgc_matrix2x2_add_scaled_fp32(const bgc_matrix2x2_fp32_t* basic_matrix, const bgc_matrix2x2_fp32_t* scalable_matrix, const float scale, bgc_matrix2x2_fp32_t* sum) inline void bgc_matrix2x2_add_scaled_fp32(const BgcMatrix2x2FP32* basic_matrix, const BgcMatrix2x2FP32* scalable_matrix, const float scale, BgcMatrix2x2FP32* sum)
{ {
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale; sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale; sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -428,7 +428,7 @@ inline void bgc_matrix2x2_add_scaled_fp32(const bgc_matrix2x2_fp32_t* basic_matr
sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale; sum->r2c2 = basic_matrix->r2c2 + scalable_matrix->r2c2 * scale;
} }
inline void bgc_matrix2x2_add_scaled_fp64(const bgc_matrix2x2_fp64_t* basic_matrix, const bgc_matrix2x2_fp64_t* scalable_matrix, const double scale, bgc_matrix2x2_fp64_t* sum) inline void bgc_matrix2x2_add_scaled_fp64(const BgcMatrix2x2FP64* basic_matrix, const BgcMatrix2x2FP64* scalable_matrix, const double scale, BgcMatrix2x2FP64* sum)
{ {
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale; sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale; sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -439,7 +439,7 @@ inline void bgc_matrix2x2_add_scaled_fp64(const bgc_matrix2x2_fp64_t* basic_matr
// ================ Subtraction ================= // // ================ Subtraction ================= //
inline void bgc_matrix2x2_subtract_fp32(const bgc_matrix2x2_fp32_t* minuend, const bgc_matrix2x2_fp32_t* subtrahend, bgc_matrix2x2_fp32_t* difference) inline void bgc_matrix2x2_subtract_fp32(const BgcMatrix2x2FP32* minuend, const BgcMatrix2x2FP32* subtrahend, BgcMatrix2x2FP32* difference)
{ {
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1; difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2; difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -448,7 +448,7 @@ inline void bgc_matrix2x2_subtract_fp32(const bgc_matrix2x2_fp32_t* minuend, con
difference->r2c2 = minuend->r2c2 - subtrahend->r2c2; difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
} }
inline void bgc_matrix2x2_subtract_fp64(const bgc_matrix2x2_fp64_t* minuend, const bgc_matrix2x2_fp64_t* subtrahend, bgc_matrix2x2_fp64_t* difference) inline void bgc_matrix2x2_subtract_fp64(const BgcMatrix2x2FP64* minuend, const BgcMatrix2x2FP64* subtrahend, BgcMatrix2x2FP64* difference)
{ {
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1; difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2; difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -459,7 +459,7 @@ inline void bgc_matrix2x2_subtract_fp64(const bgc_matrix2x2_fp64_t* minuend, con
// =============== Multiplication =============== // // =============== Multiplication =============== //
inline void bgc_matrix2x2_multiply_fp32(const bgc_matrix2x2_fp32_t* multiplicand, const float multiplier, bgc_matrix2x2_fp32_t* product) inline void bgc_matrix2x2_multiply_fp32(const BgcMatrix2x2FP32* multiplicand, const float multiplier, BgcMatrix2x2FP32* product)
{ {
product->r1c1 = multiplicand->r1c1 * multiplier; product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier; product->r1c2 = multiplicand->r1c2 * multiplier;
@ -468,7 +468,7 @@ inline void bgc_matrix2x2_multiply_fp32(const bgc_matrix2x2_fp32_t* multiplicand
product->r2c2 = multiplicand->r2c2 * multiplier; product->r2c2 = multiplicand->r2c2 * multiplier;
} }
inline void bgc_matrix2x2_multiply_fp64(const bgc_matrix2x2_fp64_t* multiplicand, const double multiplier, bgc_matrix2x2_fp64_t* product) inline void bgc_matrix2x2_multiply_fp64(const BgcMatrix2x2FP64* multiplicand, const double multiplier, BgcMatrix2x2FP64* product)
{ {
product->r1c1 = multiplicand->r1c1 * multiplier; product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier; product->r1c2 = multiplicand->r1c2 * multiplier;
@ -479,19 +479,19 @@ inline void bgc_matrix2x2_multiply_fp64(const bgc_matrix2x2_fp64_t* multiplicand
// ================== Division ================== // // ================== Division ================== //
inline void bgc_matrix2x2_divide_fp32(const bgc_matrix2x2_fp32_t* dividend, const float divisor, bgc_matrix2x2_fp32_t* quotient) inline void bgc_matrix2x2_divide_fp32(const BgcMatrix2x2FP32* dividend, const float divisor, BgcMatrix2x2FP32* quotient)
{ {
bgc_matrix2x2_multiply_fp32(dividend, 1.0f / divisor, quotient); bgc_matrix2x2_multiply_fp32(dividend, 1.0f / divisor, quotient);
} }
inline void bgc_matrix2x2_divide_fp64(const bgc_matrix2x2_fp64_t* dividend, const double divisor, bgc_matrix2x2_fp64_t* quotient) inline void bgc_matrix2x2_divide_fp64(const BgcMatrix2x2FP64* dividend, const double divisor, BgcMatrix2x2FP64* quotient)
{ {
bgc_matrix2x2_multiply_fp64(dividend, 1.0 / divisor, quotient); bgc_matrix2x2_multiply_fp64(dividend, 1.0 / divisor, quotient);
} }
// ============ Left Vector Product ============= // // ============ Left Vector Product ============= //
inline void bgc_matrix2x2_left_product_fp32(const bgc_vector2_fp32_t* vector, const bgc_matrix2x2_fp32_t* matrix, bgc_vector2_fp32_t* result) inline void bgc_matrix2x2_left_product_fp32(const BgcVector2FP32* vector, const BgcMatrix2x2FP32* matrix, BgcVector2FP32* result)
{ {
const float x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1; const float x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
const float x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2; const float x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
@ -500,7 +500,7 @@ inline void bgc_matrix2x2_left_product_fp32(const bgc_vector2_fp32_t* vector, co
result->x2 = x2; result->x2 = x2;
} }
inline void bgc_matrix2x2_left_product_fp64(const bgc_vector2_fp64_t* vector, const bgc_matrix2x2_fp64_t* matrix, bgc_vector2_fp64_t* result) inline void bgc_matrix2x2_left_product_fp64(const BgcVector2FP64* vector, const BgcMatrix2x2FP64* matrix, BgcVector2FP64* result)
{ {
const double x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1; const double x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
const double x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2; const double x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
@ -511,7 +511,7 @@ inline void bgc_matrix2x2_left_product_fp64(const bgc_vector2_fp64_t* vector, co
// ============ Right Vector Product ============ // // ============ Right Vector Product ============ //
inline void bgc_matrix2x2_right_product_fp32(const bgc_matrix2x2_fp32_t* matrix, const bgc_vector2_fp32_t* vector, bgc_vector2_fp32_t* result) inline void bgc_matrix2x2_right_product_fp32(const BgcMatrix2x2FP32* matrix, const BgcVector2FP32* vector, BgcVector2FP32* result)
{ {
const float x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2; const float x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
const float x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2; const float x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
@ -520,7 +520,7 @@ inline void bgc_matrix2x2_right_product_fp32(const bgc_matrix2x2_fp32_t* matrix,
result->x2 = x2; result->x2 = x2;
} }
inline void bgc_matrix2x2_right_product_fp64(const bgc_matrix2x2_fp64_t* matrix, const bgc_vector2_fp64_t* vector, bgc_vector2_fp64_t* result) inline void bgc_matrix2x2_right_product_fp64(const BgcMatrix2x2FP64* matrix, const BgcVector2FP64* vector, BgcVector2FP64* result)
{ {
const double x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2; const double x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
const double x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2; const double x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;

View file

@ -7,7 +7,7 @@
// =================== Reset ==================== // // =================== Reset ==================== //
inline void bgc_matrix2x3_reset_fp32(bgc_matrix2x3_fp32_t* matrix) inline void bgc_matrix2x3_reset_fp32(BgcMatrix2x3FP32* matrix)
{ {
matrix->r1c1 = 0.0f; matrix->r1c1 = 0.0f;
matrix->r1c2 = 0.0f; matrix->r1c2 = 0.0f;
@ -19,7 +19,7 @@ inline void bgc_matrix2x3_reset_fp32(bgc_matrix2x3_fp32_t* matrix)
matrix->r3c2 = 0.0f; matrix->r3c2 = 0.0f;
} }
inline void bgc_matrix2x3_reset_fp64(bgc_matrix2x3_fp64_t* matrix) inline void bgc_matrix2x3_reset_fp64(BgcMatrix2x3FP64* matrix)
{ {
matrix->r1c1 = 0.0; matrix->r1c1 = 0.0;
matrix->r1c2 = 0.0; matrix->r1c2 = 0.0;
@ -33,7 +33,7 @@ inline void bgc_matrix2x3_reset_fp64(bgc_matrix2x3_fp64_t* matrix)
// ==================== Copy ==================== // // ==================== Copy ==================== //
inline void bgc_matrix2x3_copy_fp32(const bgc_matrix2x3_fp32_t* from, bgc_matrix2x3_fp32_t* to) inline void bgc_matrix2x3_copy_fp32(const BgcMatrix2x3FP32* from, BgcMatrix2x3FP32* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -45,7 +45,7 @@ inline void bgc_matrix2x3_copy_fp32(const bgc_matrix2x3_fp32_t* from, bgc_matrix
to->r3c2 = from->r3c2; to->r3c2 = from->r3c2;
} }
inline void bgc_matrix2x3_copy_fp64(const bgc_matrix2x3_fp64_t* from, bgc_matrix2x3_fp64_t* to) inline void bgc_matrix2x3_copy_fp64(const BgcMatrix2x3FP64* from, BgcMatrix2x3FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -59,7 +59,7 @@ inline void bgc_matrix2x3_copy_fp64(const bgc_matrix2x3_fp64_t* from, bgc_matrix
// ==================== Swap ==================== // // ==================== Swap ==================== //
inline void bgc_matrix2x3_swap_fp32(bgc_matrix2x3_fp32_t* matrix1, bgc_matrix2x3_fp32_t* matrix2) inline void bgc_matrix2x3_swap_fp32(BgcMatrix2x3FP32* matrix1, BgcMatrix2x3FP32* matrix2)
{ {
const float r1c1 = matrix2->r1c1; const float r1c1 = matrix2->r1c1;
const float r1c2 = matrix2->r1c2; const float r1c2 = matrix2->r1c2;
@ -89,7 +89,7 @@ inline void bgc_matrix2x3_swap_fp32(bgc_matrix2x3_fp32_t* matrix1, bgc_matrix2x3
matrix1->r3c2 = r3c2; matrix1->r3c2 = r3c2;
} }
inline void bgc_matrix2x3_swap_fp64(bgc_matrix2x3_fp64_t* matrix1, bgc_matrix2x3_fp64_t* matrix2) inline void bgc_matrix2x3_swap_fp64(BgcMatrix2x3FP64* matrix1, BgcMatrix2x3FP64* matrix2)
{ {
const double r1c1 = matrix2->r1c1; const double r1c1 = matrix2->r1c1;
const double r1c2 = matrix2->r1c2; const double r1c2 = matrix2->r1c2;
@ -121,7 +121,7 @@ inline void bgc_matrix2x3_swap_fp64(bgc_matrix2x3_fp64_t* matrix1, bgc_matrix2x3
// ============= Copy to twin type ============== // // ============= Copy to twin type ============== //
inline void bgc_matrix2x3_convert_fp64_to_fp32(const bgc_matrix2x3_fp64_t* from, bgc_matrix2x3_fp32_t* to) inline void bgc_matrix2x3_convert_fp64_to_fp32(const BgcMatrix2x3FP64* from, BgcMatrix2x3FP32* to)
{ {
to->r1c1 = (float) from->r1c1; to->r1c1 = (float) from->r1c1;
to->r1c2 = (float) from->r1c2; to->r1c2 = (float) from->r1c2;
@ -133,7 +133,7 @@ inline void bgc_matrix2x3_convert_fp64_to_fp32(const bgc_matrix2x3_fp64_t* from,
to->r3c2 = (float) from->r3c2; to->r3c2 = (float) from->r3c2;
} }
inline void bgc_matrix2x3_convert_fp32_to_fp64(const bgc_matrix2x3_fp32_t* from, bgc_matrix2x3_fp64_t* to) inline void bgc_matrix2x3_convert_fp32_to_fp64(const BgcMatrix2x3FP32* from, BgcMatrix2x3FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -147,7 +147,7 @@ inline void bgc_matrix2x3_convert_fp32_to_fp64(const bgc_matrix2x3_fp32_t* from,
// =============== Set transposed =============== // // =============== Set transposed =============== //
inline void bgc_matrix2x3_set_transposed_fp32(const bgc_matrix3x2_fp32_t* from, bgc_matrix2x3_fp32_t* to) inline void bgc_matrix2x3_set_transposed_fp32(const BgcMatrix3x2FP32* from, BgcMatrix2x3FP32* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1; to->r1c2 = from->r2c1;
@ -159,7 +159,7 @@ inline void bgc_matrix2x3_set_transposed_fp32(const bgc_matrix3x2_fp32_t* from,
to->r3c2 = from->r2c3; to->r3c2 = from->r2c3;
} }
inline void bgc_matrix2x3_set_transposed_fp64(const bgc_matrix3x2_fp64_t* from, bgc_matrix2x3_fp64_t* to) inline void bgc_matrix2x3_set_transposed_fp64(const BgcMatrix3x2FP64* from, BgcMatrix2x3FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1; to->r1c2 = from->r2c1;
@ -173,7 +173,7 @@ inline void bgc_matrix2x3_set_transposed_fp64(const bgc_matrix3x2_fp64_t* from,
// =============== Set transposed =============== // // =============== Set transposed =============== //
inline void bgc_matrix2x3_set_transposed_fp32_fp64(const bgc_matrix3x2_fp64_t* from, bgc_matrix2x3_fp32_t* to) inline void bgc_matrix2x3_set_transposed_fp32_fp64(const BgcMatrix3x2FP64* from, BgcMatrix2x3FP32* to)
{ {
to->r1c1 = (float) from->r1c1; to->r1c1 = (float) from->r1c1;
to->r1c2 = (float) from->r2c1; to->r1c2 = (float) from->r2c1;
@ -185,7 +185,7 @@ inline void bgc_matrix2x3_set_transposed_fp32_fp64(const bgc_matrix3x2_fp64_t* f
to->r3c2 = (float) from->r2c3; to->r3c2 = (float) from->r2c3;
} }
inline void bgc_matrix2x3_set_transposed_fp64_fp32(const bgc_matrix3x2_fp32_t* from, bgc_matrix2x3_fp64_t* to) inline void bgc_matrix2x3_set_transposed_fp64_fp32(const BgcMatrix3x2FP32* from, BgcMatrix2x3FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1; to->r1c2 = from->r2c1;
@ -199,13 +199,13 @@ inline void bgc_matrix2x3_set_transposed_fp64_fp32(const bgc_matrix3x2_fp32_t* f
// ================= Set Row 1 ================== // // ================= Set Row 1 ================== //
inline void bgc_matrix2x3_set_row1_fp32(const float c1, const float c2, bgc_matrix2x3_fp32_t* matrix) inline void bgc_matrix2x3_set_row1_fp32(const float c1, const float c2, BgcMatrix2x3FP32* matrix)
{ {
matrix->r1c1 = c1; matrix->r1c1 = c1;
matrix->r1c2 = c2; matrix->r1c2 = c2;
} }
inline void bgc_matrix2x3_set_row1_fp64(const double c1, const double c2, bgc_matrix2x3_fp64_t* matrix) inline void bgc_matrix2x3_set_row1_fp64(const double c1, const double c2, BgcMatrix2x3FP64* matrix)
{ {
matrix->r1c1 = c1; matrix->r1c1 = c1;
matrix->r1c2 = c2; matrix->r1c2 = c2;
@ -213,13 +213,13 @@ inline void bgc_matrix2x3_set_row1_fp64(const double c1, const double c2, bgc_ma
// ================= Set Row 2 ================== // // ================= Set Row 2 ================== //
inline void bgc_matrix2x3_set_row2_fp32(const float c1, const float c2, bgc_matrix2x3_fp32_t* matrix) inline void bgc_matrix2x3_set_row2_fp32(const float c1, const float c2, BgcMatrix2x3FP32* matrix)
{ {
matrix->r2c1 = c1; matrix->r2c1 = c1;
matrix->r2c2 = c2; matrix->r2c2 = c2;
} }
inline void bgc_matrix2x3_set_row2_fp64(const double c1, const double c2, bgc_matrix2x3_fp64_t* matrix) inline void bgc_matrix2x3_set_row2_fp64(const double c1, const double c2, BgcMatrix2x3FP64* matrix)
{ {
matrix->r2c1 = c1; matrix->r2c1 = c1;
matrix->r2c2 = c2; matrix->r2c2 = c2;
@ -227,13 +227,13 @@ inline void bgc_matrix2x3_set_row2_fp64(const double c1, const double c2, bgc_ma
// ================= Set Row 3 ================== // // ================= Set Row 3 ================== //
inline void bgc_matrix2x3_set_row3_fp32(const float c1, const float c2, bgc_matrix2x3_fp32_t* matrix) inline void bgc_matrix2x3_set_row3_fp32(const float c1, const float c2, BgcMatrix2x3FP32* matrix)
{ {
matrix->r3c1 = c1; matrix->r3c1 = c1;
matrix->r3c2 = c2; matrix->r3c2 = c2;
} }
inline void bgc_matrix2x3_set_row3_fp64(const double c1, const double c2, bgc_matrix2x3_fp64_t* matrix) inline void bgc_matrix2x3_set_row3_fp64(const double c1, const double c2, BgcMatrix2x3FP64* matrix)
{ {
matrix->r3c1 = c1; matrix->r3c1 = c1;
matrix->r3c2 = c2; matrix->r3c2 = c2;
@ -241,14 +241,14 @@ inline void bgc_matrix2x3_set_row3_fp64(const double c1, const double c2, bgc_ma
// ================ Set Column 1 ================ // // ================ Set Column 1 ================ //
inline void bgc_matrix2x3_set_column1_fp32(const float r1, const float r2, const float r3, bgc_matrix2x3_fp32_t* matrix) inline void bgc_matrix2x3_set_column1_fp32(const float r1, const float r2, const float r3, BgcMatrix2x3FP32* matrix)
{ {
matrix->r1c1 = r1; matrix->r1c1 = r1;
matrix->r2c1 = r2; matrix->r2c1 = r2;
matrix->r3c1 = r3; matrix->r3c1 = r3;
} }
inline void bgc_matrix2x3_set_column1_fp64(const double r1, const double r2, const double r3, bgc_matrix2x3_fp64_t* matrix) inline void bgc_matrix2x3_set_column1_fp64(const double r1, const double r2, const double r3, BgcMatrix2x3FP64* matrix)
{ {
matrix->r1c1 = r1; matrix->r1c1 = r1;
matrix->r2c1 = r2; matrix->r2c1 = r2;
@ -257,14 +257,14 @@ inline void bgc_matrix2x3_set_column1_fp64(const double r1, const double r2, con
// ================ Set Column 2 ================ // // ================ Set Column 2 ================ //
inline void bgc_matrix2x3_set_column2_fp32(const float r1, const float r2, const float r3, bgc_matrix2x3_fp32_t* matrix) inline void bgc_matrix2x3_set_column2_fp32(const float r1, const float r2, const float r3, BgcMatrix2x3FP32* matrix)
{ {
matrix->r1c2 = r1; matrix->r1c2 = r1;
matrix->r2c2 = r2; matrix->r2c2 = r2;
matrix->r3c2 = r3; matrix->r3c2 = r3;
} }
inline void bgc_matrix2x3_set_column2_fp64(const double r1, const double r2, const double r3, bgc_matrix2x3_fp64_t* matrix) inline void bgc_matrix2x3_set_column2_fp64(const double r1, const double r2, const double r3, BgcMatrix2x3FP64* matrix)
{ {
matrix->r1c2 = r1; matrix->r1c2 = r1;
matrix->r2c2 = r2; matrix->r2c2 = r2;
@ -273,7 +273,7 @@ inline void bgc_matrix2x3_set_column2_fp64(const double r1, const double r2, con
// ================== Addition ================== // // ================== Addition ================== //
inline void bgc_matrix2x3_add_fp32(const bgc_matrix2x3_fp32_t* matrix1, const bgc_matrix2x3_fp32_t* matrix2, bgc_matrix2x3_fp32_t* sum) inline void bgc_matrix2x3_add_fp32(const BgcMatrix2x3FP32* matrix1, const BgcMatrix2x3FP32* matrix2, BgcMatrix2x3FP32* sum)
{ {
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1; sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2; sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -285,7 +285,7 @@ inline void bgc_matrix2x3_add_fp32(const bgc_matrix2x3_fp32_t* matrix1, const bg
sum->r3c2 = matrix1->r3c2 + matrix2->r3c2; sum->r3c2 = matrix1->r3c2 + matrix2->r3c2;
} }
inline void bgc_matrix2x3_add_fp64(const bgc_matrix2x3_fp64_t* matrix1, const bgc_matrix2x3_fp64_t* matrix2, bgc_matrix2x3_fp64_t* sum) inline void bgc_matrix2x3_add_fp64(const BgcMatrix2x3FP64* matrix1, const BgcMatrix2x3FP64* matrix2, BgcMatrix2x3FP64* sum)
{ {
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1; sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2; sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -299,7 +299,7 @@ inline void bgc_matrix2x3_add_fp64(const bgc_matrix2x3_fp64_t* matrix1, const bg
// ================= Add scaled ================= // // ================= Add scaled ================= //
inline void bgc_matrix2x3_add_scaled_fp32(const bgc_matrix2x3_fp32_t* basic_matrix, const bgc_matrix2x3_fp32_t* scalable_matrix, const float scale, bgc_matrix2x3_fp32_t* sum) inline void bgc_matrix2x3_add_scaled_fp32(const BgcMatrix2x3FP32* basic_matrix, const BgcMatrix2x3FP32* scalable_matrix, const float scale, BgcMatrix2x3FP32* sum)
{ {
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale; sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale; sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -311,7 +311,7 @@ inline void bgc_matrix2x3_add_scaled_fp32(const bgc_matrix2x3_fp32_t* basic_matr
sum->r3c2 = basic_matrix->r3c2 + scalable_matrix->r3c2 * scale; sum->r3c2 = basic_matrix->r3c2 + scalable_matrix->r3c2 * scale;
} }
inline void bgc_matrix2x3_add_scaled_fp64(const bgc_matrix2x3_fp64_t* basic_matrix, const bgc_matrix2x3_fp64_t* scalable_matrix, const double scale, bgc_matrix2x3_fp64_t* sum) inline void bgc_matrix2x3_add_scaled_fp64(const BgcMatrix2x3FP64* basic_matrix, const BgcMatrix2x3FP64* scalable_matrix, const double scale, BgcMatrix2x3FP64* sum)
{ {
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale; sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale; sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -325,7 +325,7 @@ inline void bgc_matrix2x3_add_scaled_fp64(const bgc_matrix2x3_fp64_t* basic_matr
// ================ Subtraction ================= // // ================ Subtraction ================= //
inline void bgc_matrix2x3_subtract_fp32(const bgc_matrix2x3_fp32_t* minuend, const bgc_matrix2x3_fp32_t* subtrahend, bgc_matrix2x3_fp32_t* difference) inline void bgc_matrix2x3_subtract_fp32(const BgcMatrix2x3FP32* minuend, const BgcMatrix2x3FP32* subtrahend, BgcMatrix2x3FP32* difference)
{ {
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1; difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2; difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -337,7 +337,7 @@ inline void bgc_matrix2x3_subtract_fp32(const bgc_matrix2x3_fp32_t* minuend, con
difference->r3c2 = minuend->r3c2 - subtrahend->r3c2; difference->r3c2 = minuend->r3c2 - subtrahend->r3c2;
} }
inline void bgc_matrix2x3_subtract_fp64(const bgc_matrix2x3_fp64_t* minuend, const bgc_matrix2x3_fp64_t* subtrahend, bgc_matrix2x3_fp64_t* difference) inline void bgc_matrix2x3_subtract_fp64(const BgcMatrix2x3FP64* minuend, const BgcMatrix2x3FP64* subtrahend, BgcMatrix2x3FP64* difference)
{ {
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1; difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2; difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -351,7 +351,7 @@ inline void bgc_matrix2x3_subtract_fp64(const bgc_matrix2x3_fp64_t* minuend, con
// =============== Multiplication =============== // // =============== Multiplication =============== //
inline void bgc_matrix2x3_multiply_fp32(const bgc_matrix2x3_fp32_t* multiplicand, const float multiplier, bgc_matrix2x3_fp32_t* product) inline void bgc_matrix2x3_multiply_fp32(const BgcMatrix2x3FP32* multiplicand, const float multiplier, BgcMatrix2x3FP32* product)
{ {
product->r1c1 = multiplicand->r1c1 * multiplier; product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier; product->r1c2 = multiplicand->r1c2 * multiplier;
@ -363,7 +363,7 @@ inline void bgc_matrix2x3_multiply_fp32(const bgc_matrix2x3_fp32_t* multiplicand
product->r3c2 = multiplicand->r3c2 * multiplier; product->r3c2 = multiplicand->r3c2 * multiplier;
} }
inline void bgc_matrix2x3_multiply_fp64(const bgc_matrix2x3_fp64_t* multiplicand, const double multiplier, bgc_matrix2x3_fp64_t* product) inline void bgc_matrix2x3_multiply_fp64(const BgcMatrix2x3FP64* multiplicand, const double multiplier, BgcMatrix2x3FP64* product)
{ {
product->r1c1 = multiplicand->r1c1 * multiplier; product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier; product->r1c2 = multiplicand->r1c2 * multiplier;
@ -377,25 +377,25 @@ inline void bgc_matrix2x3_multiply_fp64(const bgc_matrix2x3_fp64_t* multiplicand
// ================== Division ================== // // ================== Division ================== //
inline void bgc_matrix2x3_divide_fp32(const bgc_matrix2x3_fp32_t* dividend, const float divisor, bgc_matrix2x3_fp32_t* quotient) inline void bgc_matrix2x3_divide_fp32(const BgcMatrix2x3FP32* dividend, const float divisor, BgcMatrix2x3FP32* quotient)
{ {
bgc_matrix2x3_multiply_fp32(dividend, 1.0f / divisor, quotient); bgc_matrix2x3_multiply_fp32(dividend, 1.0f / divisor, quotient);
} }
inline void bgc_matrix2x3_divide_fp64(const bgc_matrix2x3_fp64_t* dividend, const double divisor, bgc_matrix2x3_fp64_t* quotient) inline void bgc_matrix2x3_divide_fp64(const BgcMatrix2x3FP64* dividend, const double divisor, BgcMatrix2x3FP64* quotient)
{ {
bgc_matrix2x3_multiply_fp64(dividend, 1.0 / divisor, quotient); bgc_matrix2x3_multiply_fp64(dividend, 1.0 / divisor, quotient);
} }
// ============ Left Vector Product ============= // // ============ Left Vector Product ============= //
inline void bgc_matrix2x3_left_product_fp32(const bgc_vector3_fp32_t* vector, const bgc_matrix2x3_fp32_t* matrix, bgc_vector2_fp32_t* result) inline void bgc_matrix2x3_left_product_fp32(const BgcVector3FP32* vector, const BgcMatrix2x3FP32* matrix, BgcVector2FP32* result)
{ {
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1; 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; result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
} }
inline void bgc_matrix2x3_left_product_fp64(const bgc_vector3_fp64_t* vector, const bgc_matrix2x3_fp64_t* matrix, bgc_vector2_fp64_t* result) inline void bgc_matrix2x3_left_product_fp64(const BgcVector3FP64* vector, const BgcMatrix2x3FP64* matrix, BgcVector2FP64* result)
{ {
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1; 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; result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
@ -403,14 +403,14 @@ inline void bgc_matrix2x3_left_product_fp64(const bgc_vector3_fp64_t* vector, co
// ============ Right Vector Product ============ // // ============ Right Vector Product ============ //
inline void bgc_matrix2x3_right_product_fp32(const bgc_matrix2x3_fp32_t* matrix, const bgc_vector2_fp32_t* vector, bgc_vector3_fp32_t* result) inline void bgc_matrix2x3_right_product_fp32(const BgcMatrix2x3FP32* matrix, const BgcVector2FP32* vector, BgcVector3FP32* result)
{ {
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2; result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2; result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
result->x3 = matrix->r3c1 * vector->x1 + matrix->r3c2 * vector->x2; result->x3 = matrix->r3c1 * vector->x1 + matrix->r3c2 * vector->x2;
} }
inline void bgc_matrix2x3_right_product_fp64(const bgc_matrix2x3_fp64_t* matrix, const bgc_vector2_fp64_t* vector, bgc_vector3_fp64_t* result) inline void bgc_matrix2x3_right_product_fp64(const BgcMatrix2x3FP64* matrix, const BgcVector2FP64* vector, BgcVector3FP64* result)
{ {
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2; result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2; result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;

View file

@ -7,7 +7,7 @@
// =================== Reset ==================== // // =================== Reset ==================== //
inline void bgc_matrix3x2_reset_fp32(bgc_matrix3x2_fp32_t* matrix) inline void bgc_matrix3x2_reset_fp32(BgcMatrix3x2FP32* matrix)
{ {
matrix->r1c1 = 0.0f; matrix->r1c1 = 0.0f;
matrix->r1c2 = 0.0f; matrix->r1c2 = 0.0f;
@ -18,7 +18,7 @@ inline void bgc_matrix3x2_reset_fp32(bgc_matrix3x2_fp32_t* matrix)
matrix->r2c3 = 0.0f; matrix->r2c3 = 0.0f;
} }
inline void bgc_matrix3x2_reset_fp64(bgc_matrix3x2_fp64_t* matrix) inline void bgc_matrix3x2_reset_fp64(BgcMatrix3x2FP64* matrix)
{ {
matrix->r1c1 = 0.0; matrix->r1c1 = 0.0;
matrix->r1c2 = 0.0; matrix->r1c2 = 0.0;
@ -31,7 +31,7 @@ inline void bgc_matrix3x2_reset_fp64(bgc_matrix3x2_fp64_t* matrix)
// ==================== Copy ==================== // // ==================== Copy ==================== //
inline void bgc_matrix3x2_copy_fp32(const bgc_matrix3x2_fp32_t* from, bgc_matrix3x2_fp32_t* to) inline void bgc_matrix3x2_copy_fp32(const BgcMatrix3x2FP32* from, BgcMatrix3x2FP32* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -42,7 +42,7 @@ inline void bgc_matrix3x2_copy_fp32(const bgc_matrix3x2_fp32_t* from, bgc_matrix
to->r2c3 = from->r2c3; to->r2c3 = from->r2c3;
} }
inline void bgc_matrix3x2_copy_fp64(const bgc_matrix3x2_fp64_t* from, bgc_matrix3x2_fp64_t* to) inline void bgc_matrix3x2_copy_fp64(const BgcMatrix3x2FP64* from, BgcMatrix3x2FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -55,7 +55,7 @@ inline void bgc_matrix3x2_copy_fp64(const bgc_matrix3x2_fp64_t* from, bgc_matrix
// ==================== Swap ==================== // // ==================== Swap ==================== //
inline void bgc_matrix3x2_swap_fp32(bgc_matrix3x2_fp32_t* matrix1, bgc_matrix3x2_fp32_t* matrix2) inline void bgc_matrix3x2_swap_fp32(BgcMatrix3x2FP32* matrix1, BgcMatrix3x2FP32* matrix2)
{ {
const float r1c1 = matrix2->r1c1; const float r1c1 = matrix2->r1c1;
const float r1c2 = matrix2->r1c2; const float r1c2 = matrix2->r1c2;
@ -82,7 +82,7 @@ inline void bgc_matrix3x2_swap_fp32(bgc_matrix3x2_fp32_t* matrix1, bgc_matrix3x2
matrix1->r2c3 = r2c3; matrix1->r2c3 = r2c3;
} }
inline void bgc_matrix3x2_swap_fp64(bgc_matrix3x2_fp64_t* matrix1, bgc_matrix3x2_fp64_t* matrix2) inline void bgc_matrix3x2_swap_fp64(BgcMatrix3x2FP64* matrix1, BgcMatrix3x2FP64* matrix2)
{ {
const double r1c1 = matrix2->r1c1; const double r1c1 = matrix2->r1c1;
const double r1c2 = matrix2->r1c2; const double r1c2 = matrix2->r1c2;
@ -111,7 +111,7 @@ inline void bgc_matrix3x2_swap_fp64(bgc_matrix3x2_fp64_t* matrix1, bgc_matrix3x2
// ============= Set from twin type ============= // // ============= Set from twin type ============= //
inline void bgc_matrix3x2_convert_fp64_to_fp32(const bgc_matrix3x2_fp64_t* from, bgc_matrix3x2_fp32_t* to) inline void bgc_matrix3x2_convert_fp64_to_fp32(const BgcMatrix3x2FP64* from, BgcMatrix3x2FP32* to)
{ {
to->r1c1 = (float) from->r1c1; to->r1c1 = (float) from->r1c1;
to->r1c2 = (float) from->r1c2; to->r1c2 = (float) from->r1c2;
@ -122,7 +122,7 @@ inline void bgc_matrix3x2_convert_fp64_to_fp32(const bgc_matrix3x2_fp64_t* from,
to->r2c3 = (float) from->r2c3; to->r2c3 = (float) from->r2c3;
} }
inline void bgc_matrix3x2_convert_fp32_to_fp64(const bgc_matrix3x2_fp32_t* from, bgc_matrix3x2_fp64_t* to) inline void bgc_matrix3x2_convert_fp32_to_fp64(const BgcMatrix3x2FP32* from, BgcMatrix3x2FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -135,7 +135,7 @@ inline void bgc_matrix3x2_convert_fp32_to_fp64(const bgc_matrix3x2_fp32_t* from,
// =============== Set transposed =============== // // =============== Set transposed =============== //
inline void bgc_matrix3x2_set_transposed_fp32(const bgc_matrix2x3_fp32_t* from, bgc_matrix3x2_fp32_t* to) inline void bgc_matrix3x2_set_transposed_fp32(const BgcMatrix2x3FP32* from, BgcMatrix3x2FP32* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1; to->r1c2 = from->r2c1;
@ -146,7 +146,7 @@ inline void bgc_matrix3x2_set_transposed_fp32(const bgc_matrix2x3_fp32_t* from,
to->r2c3 = from->r3c2; to->r2c3 = from->r3c2;
} }
inline void bgc_matrix3x2_set_transposed_fp64(const bgc_matrix2x3_fp64_t* from, bgc_matrix3x2_fp64_t* to) inline void bgc_matrix3x2_set_transposed_fp64(const BgcMatrix2x3FP64* from, BgcMatrix3x2FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1; to->r1c2 = from->r2c1;
@ -159,7 +159,7 @@ inline void bgc_matrix3x2_set_transposed_fp64(const bgc_matrix2x3_fp64_t* from,
// =============== Set transposed =============== // // =============== Set transposed =============== //
inline void bgc_matrix3x2_set_transposed_fp32_fp64(const bgc_matrix2x3_fp64_t* from, bgc_matrix3x2_fp32_t* to) inline void bgc_matrix3x2_set_transposed_fp32_fp64(const BgcMatrix2x3FP64* from, BgcMatrix3x2FP32* to)
{ {
to->r1c1 = (float) from->r1c1; to->r1c1 = (float) from->r1c1;
to->r1c2 = (float) from->r2c1; to->r1c2 = (float) from->r2c1;
@ -170,7 +170,7 @@ inline void bgc_matrix3x2_set_transposed_fp32_fp64(const bgc_matrix2x3_fp64_t* f
to->r2c3 = (float) from->r3c2; to->r2c3 = (float) from->r3c2;
} }
inline void bgc_matrix3x2_set_transposed_fp64_fp32(const bgc_matrix2x3_fp32_t* from, bgc_matrix3x2_fp64_t* to) inline void bgc_matrix3x2_set_transposed_fp64_fp32(const BgcMatrix2x3FP32* from, BgcMatrix3x2FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1; to->r1c2 = from->r2c1;
@ -183,14 +183,14 @@ inline void bgc_matrix3x2_set_transposed_fp64_fp32(const bgc_matrix2x3_fp32_t* f
// ================= Set Row 1 ================== // // ================= Set Row 1 ================== //
inline void bgc_matrix3x2_set_row1_fp32(const float c1, const float c2, const float c3, bgc_matrix3x2_fp32_t* matrix) inline void bgc_matrix3x2_set_row1_fp32(const float c1, const float c2, const float c3, BgcMatrix3x2FP32* matrix)
{ {
matrix->r1c1 = c1; matrix->r1c1 = c1;
matrix->r1c2 = c2; matrix->r1c2 = c2;
matrix->r1c3 = c3; matrix->r1c3 = c3;
} }
inline void bgc_matrix3x2_set_row1_fp64(const double c1, const double c2, const double c3, bgc_matrix3x2_fp64_t* matrix) inline void bgc_matrix3x2_set_row1_fp64(const double c1, const double c2, const double c3, BgcMatrix3x2FP64* matrix)
{ {
matrix->r1c1 = c1; matrix->r1c1 = c1;
matrix->r1c2 = c2; matrix->r1c2 = c2;
@ -199,14 +199,14 @@ inline void bgc_matrix3x2_set_row1_fp64(const double c1, const double c2, const
// ================= Set Row 2 ================== // // ================= Set Row 2 ================== //
inline void bgc_matrix3x2_set_row2_fp32(const float c1, const float c2, const float c3, bgc_matrix3x2_fp32_t* matrix) inline void bgc_matrix3x2_set_row2_fp32(const float c1, const float c2, const float c3, BgcMatrix3x2FP32* matrix)
{ {
matrix->r2c1 = c1; matrix->r2c1 = c1;
matrix->r2c2 = c2; matrix->r2c2 = c2;
matrix->r2c3 = c3; matrix->r2c3 = c3;
} }
inline void bgc_matrix3x2_set_row2_fp64(const double c1, const double c2, const double c3, bgc_matrix3x2_fp64_t* matrix) inline void bgc_matrix3x2_set_row2_fp64(const double c1, const double c2, const double c3, BgcMatrix3x2FP64* matrix)
{ {
matrix->r2c1 = c1; matrix->r2c1 = c1;
matrix->r2c2 = c2; matrix->r2c2 = c2;
@ -215,13 +215,13 @@ inline void bgc_matrix3x2_set_row2_fp64(const double c1, const double c2, const
// ================ Set Column 1 ================ // // ================ Set Column 1 ================ //
inline void bgc_matrix3x2_set_column1_fp32(const float r1, const float r2, bgc_matrix3x2_fp32_t* matrix) inline void bgc_matrix3x2_set_column1_fp32(const float r1, const float r2, BgcMatrix3x2FP32* matrix)
{ {
matrix->r1c1 = r1; matrix->r1c1 = r1;
matrix->r2c1 = r2; matrix->r2c1 = r2;
} }
inline void bgc_matrix3x2_set_column1_fp64(const double r1, const double r2, bgc_matrix3x2_fp64_t* matrix) inline void bgc_matrix3x2_set_column1_fp64(const double r1, const double r2, BgcMatrix3x2FP64* matrix)
{ {
matrix->r1c1 = r1; matrix->r1c1 = r1;
matrix->r2c1 = r2; matrix->r2c1 = r2;
@ -229,13 +229,13 @@ inline void bgc_matrix3x2_set_column1_fp64(const double r1, const double r2, bgc
// ================ Set Column 2 ================ // // ================ Set Column 2 ================ //
inline void bgc_matrix3x2_set_column2_fp32(const float r1, const float r2, bgc_matrix3x2_fp32_t* matrix) inline void bgc_matrix3x2_set_column2_fp32(const float r1, const float r2, BgcMatrix3x2FP32* matrix)
{ {
matrix->r1c2 = r1; matrix->r1c2 = r1;
matrix->r2c2 = r2; matrix->r2c2 = r2;
} }
inline void bgc_matrix3x2_set_column2_fp64(const double r1, const double r2, bgc_matrix3x2_fp64_t* matrix) inline void bgc_matrix3x2_set_column2_fp64(const double r1, const double r2, BgcMatrix3x2FP64* matrix)
{ {
matrix->r1c2 = r1; matrix->r1c2 = r1;
matrix->r2c2 = r2; matrix->r2c2 = r2;
@ -243,13 +243,13 @@ inline void bgc_matrix3x2_set_column2_fp64(const double r1, const double r2, bgc
// ================ Set Column 3 ================ // // ================ Set Column 3 ================ //
inline void bgc_matrix3x2_set_column3_fp32(const float r1, const float r2, bgc_matrix3x2_fp32_t* matrix) inline void bgc_matrix3x2_set_column3_fp32(const float r1, const float r2, BgcMatrix3x2FP32* matrix)
{ {
matrix->r1c3 = r1; matrix->r1c3 = r1;
matrix->r2c3 = r2; matrix->r2c3 = r2;
} }
inline void bgc_matrix3x2_set_column3_fp64(const double r1, const double r2, bgc_matrix3x2_fp64_t* matrix) inline void bgc_matrix3x2_set_column3_fp64(const double r1, const double r2, BgcMatrix3x2FP64* matrix)
{ {
matrix->r1c3 = r1; matrix->r1c3 = r1;
matrix->r2c3 = r2; matrix->r2c3 = r2;
@ -257,7 +257,7 @@ inline void bgc_matrix3x2_set_column3_fp64(const double r1, const double r2, bgc
// ================== Addition ================== // // ================== Addition ================== //
inline void bgc_matrix3x2_add_fp32(const bgc_matrix3x2_fp32_t* matrix1, const bgc_matrix3x2_fp32_t* matrix2, bgc_matrix3x2_fp32_t* sum) inline void bgc_matrix3x2_add_fp32(const BgcMatrix3x2FP32* matrix1, const BgcMatrix3x2FP32* matrix2, BgcMatrix3x2FP32* sum)
{ {
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1; sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2; sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -268,7 +268,7 @@ inline void bgc_matrix3x2_add_fp32(const bgc_matrix3x2_fp32_t* matrix1, const bg
sum->r2c3 = matrix1->r2c3 + matrix2->r2c3; sum->r2c3 = matrix1->r2c3 + matrix2->r2c3;
} }
inline void bgc_matrix3x2_add_fp64(const bgc_matrix3x2_fp64_t* matrix1, const bgc_matrix3x2_fp64_t* matrix2, bgc_matrix3x2_fp64_t* sum) inline void bgc_matrix3x2_add_fp64(const BgcMatrix3x2FP64* matrix1, const BgcMatrix3x2FP64* matrix2, BgcMatrix3x2FP64* sum)
{ {
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1; sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2; sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -281,7 +281,7 @@ inline void bgc_matrix3x2_add_fp64(const bgc_matrix3x2_fp64_t* matrix1, const bg
// ================= Add scaled ================= // // ================= Add scaled ================= //
inline void bgc_matrix3x2_add_scaled_fp32(const bgc_matrix3x2_fp32_t* basic_matrix, const bgc_matrix3x2_fp32_t* scalable_matrix, const float scale, bgc_matrix3x2_fp32_t* sum) inline void bgc_matrix3x2_add_scaled_fp32(const BgcMatrix3x2FP32* basic_matrix, const BgcMatrix3x2FP32* scalable_matrix, const float scale, BgcMatrix3x2FP32* sum)
{ {
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale; sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale; sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -292,7 +292,7 @@ inline void bgc_matrix3x2_add_scaled_fp32(const bgc_matrix3x2_fp32_t* basic_matr
sum->r2c3 = basic_matrix->r2c3 + scalable_matrix->r2c3 * scale; sum->r2c3 = basic_matrix->r2c3 + scalable_matrix->r2c3 * scale;
} }
inline void bgc_matrix3x2_add_scaled_fp64(const bgc_matrix3x2_fp64_t* basic_matrix, const bgc_matrix3x2_fp64_t* scalable_matrix, const double scale, bgc_matrix3x2_fp64_t* sum) inline void bgc_matrix3x2_add_scaled_fp64(const BgcMatrix3x2FP64* basic_matrix, const BgcMatrix3x2FP64* scalable_matrix, const double scale, BgcMatrix3x2FP64* sum)
{ {
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale; sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale; sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -305,7 +305,7 @@ inline void bgc_matrix3x2_add_scaled_fp64(const bgc_matrix3x2_fp64_t* basic_matr
// ================ Subtraction ================= // // ================ Subtraction ================= //
inline void bgc_matrix3x2_subtract_fp32(const bgc_matrix3x2_fp32_t* minuend, const bgc_matrix3x2_fp32_t* subtrahend, bgc_matrix3x2_fp32_t* difference) inline void bgc_matrix3x2_subtract_fp32(const BgcMatrix3x2FP32* minuend, const BgcMatrix3x2FP32* subtrahend, BgcMatrix3x2FP32* difference)
{ {
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1; difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2; difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -316,7 +316,7 @@ inline void bgc_matrix3x2_subtract_fp32(const bgc_matrix3x2_fp32_t* minuend, con
difference->r2c3 = minuend->r2c3 - subtrahend->r2c3; difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
} }
inline void bgc_matrix3x2_subtract_fp64(const bgc_matrix3x2_fp64_t* minuend, const bgc_matrix3x2_fp64_t* subtrahend, bgc_matrix3x2_fp64_t* difference) inline void bgc_matrix3x2_subtract_fp64(const BgcMatrix3x2FP64* minuend, const BgcMatrix3x2FP64* subtrahend, BgcMatrix3x2FP64* difference)
{ {
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1; difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2; difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -329,7 +329,7 @@ inline void bgc_matrix3x2_subtract_fp64(const bgc_matrix3x2_fp64_t* minuend, con
// =============== Multiplication =============== // // =============== Multiplication =============== //
inline void bgc_matrix3x2_multiply_fp32(const bgc_matrix3x2_fp32_t* multiplicand, const float multiplier, bgc_matrix3x2_fp32_t* product) inline void bgc_matrix3x2_multiply_fp32(const BgcMatrix3x2FP32* multiplicand, const float multiplier, BgcMatrix3x2FP32* product)
{ {
product->r1c1 = multiplicand->r1c1 * multiplier; product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier; product->r1c2 = multiplicand->r1c2 * multiplier;
@ -340,7 +340,7 @@ inline void bgc_matrix3x2_multiply_fp32(const bgc_matrix3x2_fp32_t* multiplicand
product->r2c3 = multiplicand->r2c3 * multiplier; product->r2c3 = multiplicand->r2c3 * multiplier;
} }
inline void bgc_matrix3x2_multiply_fp64(const bgc_matrix3x2_fp64_t* multiplicand, const double multiplier, bgc_matrix3x2_fp64_t* product) inline void bgc_matrix3x2_multiply_fp64(const BgcMatrix3x2FP64* multiplicand, const double multiplier, BgcMatrix3x2FP64* product)
{ {
product->r1c1 = multiplicand->r1c1 * multiplier; product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier; product->r1c2 = multiplicand->r1c2 * multiplier;
@ -353,26 +353,26 @@ inline void bgc_matrix3x2_multiply_fp64(const bgc_matrix3x2_fp64_t* multiplicand
// ================== Division ================== // // ================== Division ================== //
inline void bgc_matrix3x2_divide_fp32(const bgc_matrix3x2_fp32_t* dividend, const float divisor, bgc_matrix3x2_fp32_t* quotient) inline void bgc_matrix3x2_divide_fp32(const BgcMatrix3x2FP32* dividend, const float divisor, BgcMatrix3x2FP32* quotient)
{ {
bgc_matrix3x2_multiply_fp32(dividend, 1.0f / divisor, quotient); bgc_matrix3x2_multiply_fp32(dividend, 1.0f / divisor, quotient);
} }
inline void bgc_matrix3x2_divide_fp64(const bgc_matrix3x2_fp64_t* dividend, const double divisor, bgc_matrix3x2_fp64_t* quotient) inline void bgc_matrix3x2_divide_fp64(const BgcMatrix3x2FP64* dividend, const double divisor, BgcMatrix3x2FP64* quotient)
{ {
bgc_matrix3x2_multiply_fp64(dividend, 1.0 / divisor, quotient); bgc_matrix3x2_multiply_fp64(dividend, 1.0 / divisor, quotient);
} }
// ============ Left Vector Product ============= // // ============ Left Vector Product ============= //
inline void bgc_matrix3x2_left_product_fp32(const bgc_vector2_fp32_t* vector, const bgc_matrix3x2_fp32_t* matrix, bgc_vector3_fp32_t* result) inline void bgc_matrix3x2_left_product_fp32(const BgcVector2FP32* vector, const BgcMatrix3x2FP32* matrix, BgcVector3FP32* result)
{ {
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1; result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2; result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
result->x3 = vector->x1 * matrix->r1c3 + vector->x2 * matrix->r2c3; result->x3 = vector->x1 * matrix->r1c3 + vector->x2 * matrix->r2c3;
} }
inline void bgc_matrix3x2_left_product_fp64(const bgc_vector2_fp64_t* vector, const bgc_matrix3x2_fp64_t* matrix, bgc_vector3_fp64_t* result) inline void bgc_matrix3x2_left_product_fp64(const BgcVector2FP64* vector, const BgcMatrix3x2FP64* matrix, BgcVector3FP64* result)
{ {
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1; result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1;
result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2; result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
@ -381,13 +381,13 @@ inline void bgc_matrix3x2_left_product_fp64(const bgc_vector2_fp64_t* vector, co
// ============ Right Vector Product ============ // // ============ Right Vector Product ============ //
inline void bgc_matrix3x2_right_product_fp32(const bgc_matrix3x2_fp32_t* matrix, const bgc_vector3_fp32_t* vector, bgc_vector2_fp32_t* result) inline void bgc_matrix3x2_right_product_fp32(const BgcMatrix3x2FP32* matrix, const BgcVector3FP32* vector, BgcVector2FP32* result)
{ {
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3; 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; result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
} }
inline void bgc_matrix3x2_right_product_fp64(const bgc_matrix3x2_fp64_t* matrix, const bgc_vector3_fp64_t* vector, bgc_vector2_fp64_t* result) inline void bgc_matrix3x2_right_product_fp64(const BgcMatrix3x2FP64* matrix, const BgcVector3FP64* vector, BgcVector2FP64* result)
{ {
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3; 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; result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;

View file

@ -2,7 +2,7 @@
// ================= Inversion ================== // // ================= Inversion ================== //
int bgc_matrix3x3_invert_fp32(bgc_matrix3x3_fp32_t* matrix) int bgc_matrix3x3_invert_fp32(BgcMatrix3x3FP32* matrix)
{ {
const float determinant = bgc_matrix3x3_get_determinant_fp32(matrix); const float determinant = bgc_matrix3x3_get_determinant_fp32(matrix);
@ -39,7 +39,7 @@ int bgc_matrix3x3_invert_fp32(bgc_matrix3x3_fp32_t* matrix)
return 1; return 1;
} }
int bgc_matrix3x3_invert_fp64(bgc_matrix3x3_fp64_t* matrix) int bgc_matrix3x3_invert_fp64(BgcMatrix3x3FP64* matrix)
{ {
const double determinant = bgc_matrix3x3_get_determinant_fp64(matrix); const double determinant = bgc_matrix3x3_get_determinant_fp64(matrix);
@ -78,7 +78,7 @@ int bgc_matrix3x3_invert_fp64(bgc_matrix3x3_fp64_t* matrix)
// ================ Make Inverted =============== // // ================ Make Inverted =============== //
int bgc_matrix3x3_set_inverted_fp32(const bgc_matrix3x3_fp32_t* matrix, bgc_matrix3x3_fp32_t* result) int bgc_matrix3x3_set_inverted_fp32(const BgcMatrix3x3FP32* matrix, BgcMatrix3x3FP32* result)
{ {
const float determinant = bgc_matrix3x3_get_determinant_fp32(matrix); const float determinant = bgc_matrix3x3_get_determinant_fp32(matrix);
@ -115,7 +115,7 @@ int bgc_matrix3x3_set_inverted_fp32(const bgc_matrix3x3_fp32_t* matrix, bgc_matr
return 1; return 1;
} }
int bgc_matrix3x3_set_inverted_fp64(const bgc_matrix3x3_fp64_t* matrix, bgc_matrix3x3_fp64_t* result) int bgc_matrix3x3_set_inverted_fp64(const BgcMatrix3x3FP64* matrix, BgcMatrix3x3FP64* result)
{ {
const double determinant = bgc_matrix3x3_get_determinant_fp64(matrix); const double determinant = bgc_matrix3x3_get_determinant_fp64(matrix);

View file

@ -6,7 +6,7 @@
// =================== Reset ==================== // // =================== Reset ==================== //
inline void bgc_matrix3x3_reset_fp32(bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_reset_fp32(BgcMatrix3x3FP32* matrix)
{ {
matrix->r1c1 = 0.0f; matrix->r1c1 = 0.0f;
matrix->r1c2 = 0.0f; matrix->r1c2 = 0.0f;
@ -21,7 +21,7 @@ inline void bgc_matrix3x3_reset_fp32(bgc_matrix3x3_fp32_t* matrix)
matrix->r3c3 = 0.0f; matrix->r3c3 = 0.0f;
} }
inline void bgc_matrix3x3_reset_fp64(bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_reset_fp64(BgcMatrix3x3FP64* matrix)
{ {
matrix->r1c1 = 0.0; matrix->r1c1 = 0.0;
matrix->r1c2 = 0.0; matrix->r1c2 = 0.0;
@ -38,7 +38,7 @@ inline void bgc_matrix3x3_reset_fp64(bgc_matrix3x3_fp64_t* matrix)
// ================== Identity ================== // // ================== Identity ================== //
inline void bgc_matrix3x3_set_to_identity_fp32(bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_set_to_identity_fp32(BgcMatrix3x3FP32* matrix)
{ {
matrix->r1c1 = 1.0f; matrix->r1c1 = 1.0f;
matrix->r1c2 = 0.0f; matrix->r1c2 = 0.0f;
@ -53,7 +53,7 @@ inline void bgc_matrix3x3_set_to_identity_fp32(bgc_matrix3x3_fp32_t* matrix)
matrix->r3c3 = 1.0f; matrix->r3c3 = 1.0f;
} }
inline void bgc_matrix3x3_set_to_identity_fp64(bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_set_to_identity_fp64(BgcMatrix3x3FP64* matrix)
{ {
matrix->r1c1 = 1.0; matrix->r1c1 = 1.0;
matrix->r1c2 = 0.0; matrix->r1c2 = 0.0;
@ -70,7 +70,7 @@ inline void bgc_matrix3x3_set_to_identity_fp64(bgc_matrix3x3_fp64_t* matrix)
// ================ Make Diagonal =============== // // ================ Make Diagonal =============== //
inline void bgc_matrix3x3_set_to_diagonal_fp32(const float d1, const float d2, const float d3, bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_set_to_diagonal_fp32(const float d1, const float d2, const float d3, BgcMatrix3x3FP32* matrix)
{ {
matrix->r1c1 = d1; matrix->r1c1 = d1;
matrix->r1c2 = 0.0f; matrix->r1c2 = 0.0f;
@ -85,7 +85,7 @@ inline void bgc_matrix3x3_set_to_diagonal_fp32(const float d1, const float d2, c
matrix->r3c3 = d2; matrix->r3c3 = d2;
} }
inline void bgc_matrix3x3_set_to_diagonal_fp64(const double d1, const double d2, const double d3, bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_set_to_diagonal_fp64(const double d1, const double d2, const double d3, BgcMatrix3x3FP64* matrix)
{ {
matrix->r1c1 = d1; matrix->r1c1 = d1;
matrix->r1c2 = 0.0; matrix->r1c2 = 0.0;
@ -102,7 +102,7 @@ inline void bgc_matrix3x3_set_to_diagonal_fp64(const double d1, const double d2,
// ==================== Copy ==================== // // ==================== Copy ==================== //
inline void bgc_matrix3x3_copy_fp32(const bgc_matrix3x3_fp32_t* from, bgc_matrix3x3_fp32_t* to) inline void bgc_matrix3x3_copy_fp32(const BgcMatrix3x3FP32* from, BgcMatrix3x3FP32* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -117,7 +117,7 @@ inline void bgc_matrix3x3_copy_fp32(const bgc_matrix3x3_fp32_t* from, bgc_matrix
to->r3c3 = from->r3c3; to->r3c3 = from->r3c3;
} }
inline void bgc_matrix3x3_copy_fp64(const bgc_matrix3x3_fp64_t* from, bgc_matrix3x3_fp64_t* to) inline void bgc_matrix3x3_copy_fp64(const BgcMatrix3x3FP64* from, BgcMatrix3x3FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -134,7 +134,7 @@ inline void bgc_matrix3x3_copy_fp64(const bgc_matrix3x3_fp64_t* from, bgc_matrix
// ==================== Swap ==================== // // ==================== Swap ==================== //
inline void bgc_matrix3x3_swap_fp32(bgc_matrix3x3_fp32_t* matrix1, bgc_matrix3x3_fp32_t* matrix2) inline void bgc_matrix3x3_swap_fp32(BgcMatrix3x3FP32* matrix1, BgcMatrix3x3FP32* matrix2)
{ {
const float r1c1 = matrix2->r1c1; const float r1c1 = matrix2->r1c1;
const float r1c2 = matrix2->r1c2; const float r1c2 = matrix2->r1c2;
@ -173,7 +173,7 @@ inline void bgc_matrix3x3_swap_fp32(bgc_matrix3x3_fp32_t* matrix1, bgc_matrix3x3
matrix1->r3c3 = r3c3; matrix1->r3c3 = r3c3;
} }
inline void bgc_matrix3x3_swap_fp64(bgc_matrix3x3_fp64_t* matrix1, bgc_matrix3x3_fp64_t* matrix2) inline void bgc_matrix3x3_swap_fp64(BgcMatrix3x3FP64* matrix1, BgcMatrix3x3FP64* matrix2)
{ {
const double r1c1 = matrix2->r1c1; const double r1c1 = matrix2->r1c1;
const double r1c2 = matrix2->r1c2; const double r1c2 = matrix2->r1c2;
@ -214,7 +214,7 @@ inline void bgc_matrix3x3_swap_fp64(bgc_matrix3x3_fp64_t* matrix1, bgc_matrix3x3
// ============= Set from twin type ============= // // ============= Set from twin type ============= //
inline void bgc_matrix3x3_convert_fp64_to_fp32(const bgc_matrix3x3_fp64_t* from, bgc_matrix3x3_fp32_t* to) inline void bgc_matrix3x3_convert_fp64_to_fp32(const BgcMatrix3x3FP64* from, BgcMatrix3x3FP32* to)
{ {
to->r1c1 = (float) from->r1c1; to->r1c1 = (float) from->r1c1;
to->r1c2 = (float) from->r1c2; to->r1c2 = (float) from->r1c2;
@ -229,7 +229,7 @@ inline void bgc_matrix3x3_convert_fp64_to_fp32(const bgc_matrix3x3_fp64_t* from,
to->r3c3 = (float) from->r3c3; to->r3c3 = (float) from->r3c3;
} }
inline void bgc_matrix3x3_convert_fp32_to_fp64(const bgc_matrix3x3_fp32_t* from, bgc_matrix3x3_fp64_t* to) inline void bgc_matrix3x3_convert_fp32_to_fp64(const BgcMatrix3x3FP32* from, BgcMatrix3x3FP64* to)
{ {
to->r1c1 = from->r1c1; to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2; to->r1c2 = from->r1c2;
@ -246,14 +246,14 @@ inline void bgc_matrix3x3_convert_fp32_to_fp64(const bgc_matrix3x3_fp32_t* from,
// ================ Determinant ================= // // ================ Determinant ================= //
inline float bgc_matrix3x3_get_determinant_fp32(const bgc_matrix3x3_fp32_t* matrix) inline float bgc_matrix3x3_get_determinant_fp32(const BgcMatrix3x3FP32* matrix)
{ {
return matrix->r1c1 * (matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2) return matrix->r1c1 * (matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2)
+ matrix->r1c2 * (matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3) + matrix->r1c2 * (matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3)
+ matrix->r1c3 * (matrix->r2c1 * matrix->r3c2 - matrix->r2c2 * matrix->r3c1); + matrix->r1c3 * (matrix->r2c1 * matrix->r3c2 - matrix->r2c2 * matrix->r3c1);
} }
inline double bgc_matrix3x3_get_determinant_fp64(const bgc_matrix3x3_fp64_t* matrix) inline double bgc_matrix3x3_get_determinant_fp64(const BgcMatrix3x3FP64* matrix)
{ {
return matrix->r1c1 * (matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2) return matrix->r1c1 * (matrix->r2c2 * matrix->r3c3 - matrix->r2c3 * matrix->r3c2)
+ matrix->r1c2 * (matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3) + matrix->r1c2 * (matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3)
@ -262,14 +262,14 @@ inline double bgc_matrix3x3_get_determinant_fp64(const bgc_matrix3x3_fp64_t* mat
// ================== Singular ================== // // ================== Singular ================== //
inline int bgc_matrix3x3_is_singular_fp32(const bgc_matrix3x3_fp32_t* matrix) inline int bgc_matrix3x3_is_singular_fp32(const BgcMatrix3x3FP32* matrix)
{ {
const float determinant = bgc_matrix3x3_get_determinant_fp32(matrix); const float determinant = bgc_matrix3x3_get_determinant_fp32(matrix);
return -BGC_EPSYLON_FP32 <= determinant && determinant <= BGC_EPSYLON_FP32; return -BGC_EPSYLON_FP32 <= determinant && determinant <= BGC_EPSYLON_FP32;
} }
inline int bgc_matrix3x3_is_singular_fp64(const bgc_matrix3x3_fp64_t* matrix) inline int bgc_matrix3x3_is_singular_fp64(const BgcMatrix3x3FP64* matrix)
{ {
const double determinant = bgc_matrix3x3_get_determinant_fp64(matrix); const double determinant = bgc_matrix3x3_get_determinant_fp64(matrix);
@ -278,13 +278,13 @@ inline int bgc_matrix3x3_is_singular_fp64(const bgc_matrix3x3_fp64_t* matrix)
// ================= Inversion ================== // // ================= Inversion ================== //
int bgc_matrix3x3_invert_fp32(bgc_matrix3x3_fp32_t* matrix); int bgc_matrix3x3_invert_fp32(BgcMatrix3x3FP32* matrix);
int bgc_matrix3x3_invert_fp64(bgc_matrix3x3_fp64_t* matrix); int bgc_matrix3x3_invert_fp64(BgcMatrix3x3FP64* matrix);
// =============== Transposition ================ // // =============== Transposition ================ //
inline void bgc_matrix3x3_transpose_fp32(bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_transpose_fp32(BgcMatrix3x3FP32* matrix)
{ {
float tmp = matrix->r1c2; float tmp = matrix->r1c2;
matrix->r1c2 = matrix->r2c1; matrix->r1c2 = matrix->r2c1;
@ -299,7 +299,7 @@ inline void bgc_matrix3x3_transpose_fp32(bgc_matrix3x3_fp32_t* matrix)
matrix->r3c2 = tmp; matrix->r3c2 = tmp;
} }
inline void bgc_matrix3x3_transpose_fp64(bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_transpose_fp64(BgcMatrix3x3FP64* matrix)
{ {
double tmp = matrix->r1c2; double tmp = matrix->r1c2;
matrix->r1c2 = matrix->r2c1; matrix->r1c2 = matrix->r2c1;
@ -316,13 +316,13 @@ inline void bgc_matrix3x3_transpose_fp64(bgc_matrix3x3_fp64_t* matrix)
// ================ Make Inverted =============== // // ================ Make Inverted =============== //
int bgc_matrix3x3_set_inverted_fp32(const bgc_matrix3x3_fp32_t* matrix, bgc_matrix3x3_fp32_t* result); int bgc_matrix3x3_set_inverted_fp32(const BgcMatrix3x3FP32* matrix, BgcMatrix3x3FP32* result);
int bgc_matrix3x3_set_inverted_fp64(const bgc_matrix3x3_fp64_t* matrix, bgc_matrix3x3_fp64_t* result); int bgc_matrix3x3_set_inverted_fp64(const BgcMatrix3x3FP64* matrix, BgcMatrix3x3FP64* result);
// =============== Make Transposed ============== // // =============== Make Transposed ============== //
inline void bgc_matrix3x3_set_transposed_fp32(const bgc_matrix3x3_fp32_t* matrix, bgc_matrix3x3_fp32_t* result) inline void bgc_matrix3x3_set_transposed_fp32(const BgcMatrix3x3FP32* matrix, BgcMatrix3x3FP32* result)
{ {
if (matrix == result) { if (matrix == result) {
bgc_matrix3x3_transpose_fp32(result); bgc_matrix3x3_transpose_fp32(result);
@ -342,7 +342,7 @@ inline void bgc_matrix3x3_set_transposed_fp32(const bgc_matrix3x3_fp32_t* matrix
result->r3c3 = matrix->r3c3; result->r3c3 = matrix->r3c3;
} }
inline void bgc_matrix3x3_set_transposed_fp64(const bgc_matrix3x3_fp64_t* matrix, bgc_matrix3x3_fp64_t* result) inline void bgc_matrix3x3_set_transposed_fp64(const BgcMatrix3x3FP64* matrix, BgcMatrix3x3FP64* result)
{ {
if (matrix == result) { if (matrix == result) {
bgc_matrix3x3_transpose_fp64(result); bgc_matrix3x3_transpose_fp64(result);
@ -364,14 +364,14 @@ inline void bgc_matrix3x3_set_transposed_fp64(const bgc_matrix3x3_fp64_t* matrix
// ================= Set Row 1 ================== // // ================= Set Row 1 ================== //
inline void bgc_matrix3x3_set_row1_fp32(const float c1, const float c2, const float c3, bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_set_row1_fp32(const float c1, const float c2, const float c3, BgcMatrix3x3FP32* matrix)
{ {
matrix->r1c1 = c1; matrix->r1c1 = c1;
matrix->r1c2 = c2; matrix->r1c2 = c2;
matrix->r1c3 = c3; matrix->r1c3 = c3;
} }
inline void bgc_matrix3x3_set_row1_fp64(const double c1, const double c2, const double c3, bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_set_row1_fp64(const double c1, const double c2, const double c3, BgcMatrix3x3FP64* matrix)
{ {
matrix->r1c1 = c1; matrix->r1c1 = c1;
matrix->r1c2 = c2; matrix->r1c2 = c2;
@ -380,14 +380,14 @@ inline void bgc_matrix3x3_set_row1_fp64(const double c1, const double c2, const
// ================= Set Row 2 ================== // // ================= Set Row 2 ================== //
inline void bgc_matrix3x3_set_row2_fp32(const float c1, const float c2, const float c3, bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_set_row2_fp32(const float c1, const float c2, const float c3, BgcMatrix3x3FP32* matrix)
{ {
matrix->r2c1 = c1; matrix->r2c1 = c1;
matrix->r2c2 = c2; matrix->r2c2 = c2;
matrix->r2c3 = c3; matrix->r2c3 = c3;
} }
inline void bgc_matrix3x3_set_row2_fp64(const double c1, const double c2, const double c3, bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_set_row2_fp64(const double c1, const double c2, const double c3, BgcMatrix3x3FP64* matrix)
{ {
matrix->r2c1 = c1; matrix->r2c1 = c1;
matrix->r2c2 = c2; matrix->r2c2 = c2;
@ -396,14 +396,14 @@ inline void bgc_matrix3x3_set_row2_fp64(const double c1, const double c2, const
// ================= Set Row 3 ================== // // ================= Set Row 3 ================== //
inline void bgc_matrix3x3_set_row3_fp32(const float c1, const float c2, const float c3, bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_set_row3_fp32(const float c1, const float c2, const float c3, BgcMatrix3x3FP32* matrix)
{ {
matrix->r3c1 = c1; matrix->r3c1 = c1;
matrix->r3c2 = c2; matrix->r3c2 = c2;
matrix->r3c3 = c3; matrix->r3c3 = c3;
} }
inline void bgc_matrix3x3_set_row3_fp64(const double c1, const double c2, const double c3, bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_set_row3_fp64(const double c1, const double c2, const double c3, BgcMatrix3x3FP64* matrix)
{ {
matrix->r3c1 = c1; matrix->r3c1 = c1;
matrix->r3c2 = c2; matrix->r3c2 = c2;
@ -412,14 +412,14 @@ inline void bgc_matrix3x3_set_row3_fp64(const double c1, const double c2, const
// ================ Set Column 1 ================ // // ================ Set Column 1 ================ //
inline void bgc_matrix3x3_set_column1_fp32(const float r1, const float r2, const float r3, bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_set_column1_fp32(const float r1, const float r2, const float r3, BgcMatrix3x3FP32* matrix)
{ {
matrix->r1c1 = r1; matrix->r1c1 = r1;
matrix->r2c1 = r2; matrix->r2c1 = r2;
matrix->r3c1 = r3; matrix->r3c1 = r3;
} }
inline void bgc_matrix3x3_set_column1_fp64(const double r1, const double r2, const double r3, bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_set_column1_fp64(const double r1, const double r2, const double r3, BgcMatrix3x3FP64* matrix)
{ {
matrix->r1c1 = r1; matrix->r1c1 = r1;
matrix->r2c1 = r2; matrix->r2c1 = r2;
@ -428,14 +428,14 @@ inline void bgc_matrix3x3_set_column1_fp64(const double r1, const double r2, con
// ================ Set Column 2 ================ // // ================ Set Column 2 ================ //
inline void bgc_matrix3x3_set_column2_fp32(const float r1, const float r2, const float r3, bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_set_column2_fp32(const float r1, const float r2, const float r3, BgcMatrix3x3FP32* matrix)
{ {
matrix->r1c2 = r1; matrix->r1c2 = r1;
matrix->r2c2 = r2; matrix->r2c2 = r2;
matrix->r3c2 = r3; matrix->r3c2 = r3;
} }
inline void bgc_matrix3x3_set_column2_fp64(const double r1, const double r2, const double r3, bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_set_column2_fp64(const double r1, const double r2, const double r3, BgcMatrix3x3FP64* matrix)
{ {
matrix->r1c2 = r1; matrix->r1c2 = r1;
matrix->r2c2 = r2; matrix->r2c2 = r2;
@ -444,14 +444,14 @@ inline void bgc_matrix3x3_set_column2_fp64(const double r1, const double r2, con
// ================ Set Column 3 ================ // // ================ Set Column 3 ================ //
inline void bgc_matrix3x3_set_column3_fp32(const float r1, const float r2, const float r3, bgc_matrix3x3_fp32_t* matrix) inline void bgc_matrix3x3_set_column3_fp32(const float r1, const float r2, const float r3, BgcMatrix3x3FP32* matrix)
{ {
matrix->r1c3 = r1; matrix->r1c3 = r1;
matrix->r2c3 = r2; matrix->r2c3 = r2;
matrix->r3c3 = r3; matrix->r3c3 = r3;
} }
inline void bgc_matrix3x3_set_column3_fp64(const double r1, const double r2, const double r3, bgc_matrix3x3_fp64_t* matrix) inline void bgc_matrix3x3_set_column3_fp64(const double r1, const double r2, const double r3, BgcMatrix3x3FP64* matrix)
{ {
matrix->r1c3 = r1; matrix->r1c3 = r1;
matrix->r2c3 = r2; matrix->r2c3 = r2;
@ -460,7 +460,7 @@ inline void bgc_matrix3x3_set_column3_fp64(const double r1, const double r2, con
// ================== Addition ================== // // ================== Addition ================== //
inline void bgc_matrix3x3_add_fp32(const bgc_matrix3x3_fp32_t* matrix1, const bgc_matrix3x3_fp32_t* matrix2, bgc_matrix3x3_fp32_t* sum) inline void bgc_matrix3x3_add_fp32(const BgcMatrix3x3FP32* matrix1, const BgcMatrix3x3FP32* matrix2, BgcMatrix3x3FP32* sum)
{ {
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1; sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2; sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -475,7 +475,7 @@ inline void bgc_matrix3x3_add_fp32(const bgc_matrix3x3_fp32_t* matrix1, const bg
sum->r3c3 = matrix1->r3c3 + matrix2->r3c3; sum->r3c3 = matrix1->r3c3 + matrix2->r3c3;
} }
inline void bgc_matrix3x3_add_fp64(const bgc_matrix3x3_fp64_t* matrix1, const bgc_matrix3x3_fp64_t* matrix2, bgc_matrix3x3_fp64_t* sum) inline void bgc_matrix3x3_add_fp64(const BgcMatrix3x3FP64* matrix1, const BgcMatrix3x3FP64* matrix2, BgcMatrix3x3FP64* sum)
{ {
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1; sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2; sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
@ -492,7 +492,7 @@ inline void bgc_matrix3x3_add_fp64(const bgc_matrix3x3_fp64_t* matrix1, const bg
// ================= Add scaled ================= // // ================= Add scaled ================= //
inline void bgc_matrix3x3_add_scaled_fp32(const bgc_matrix3x3_fp32_t* basic_matrix, const bgc_matrix3x3_fp32_t* scalable_matrix, const float scale, bgc_matrix3x3_fp32_t* sum) inline void bgc_matrix3x3_add_scaled_fp32(const BgcMatrix3x3FP32* basic_matrix, const BgcMatrix3x3FP32* scalable_matrix, const float scale, BgcMatrix3x3FP32* sum)
{ {
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale; sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale; sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -507,7 +507,7 @@ inline void bgc_matrix3x3_add_scaled_fp32(const bgc_matrix3x3_fp32_t* basic_matr
sum->r3c3 = basic_matrix->r3c3 + scalable_matrix->r3c3 * scale; sum->r3c3 = basic_matrix->r3c3 + scalable_matrix->r3c3 * scale;
} }
inline void bgc_matrix3x3_add_scaled_fp64(const bgc_matrix3x3_fp64_t* basic_matrix, const bgc_matrix3x3_fp64_t* scalable_matrix, const double scale, bgc_matrix3x3_fp64_t* sum) inline void bgc_matrix3x3_add_scaled_fp64(const BgcMatrix3x3FP64* basic_matrix, const BgcMatrix3x3FP64* scalable_matrix, const double scale, BgcMatrix3x3FP64* sum)
{ {
sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale; sum->r1c1 = basic_matrix->r1c1 + scalable_matrix->r1c1 * scale;
sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale; sum->r1c2 = basic_matrix->r1c2 + scalable_matrix->r1c2 * scale;
@ -524,7 +524,7 @@ inline void bgc_matrix3x3_add_scaled_fp64(const bgc_matrix3x3_fp64_t* basic_matr
// ================ Subtraction ================= // // ================ Subtraction ================= //
inline void bgc_matrix3x3_subtract_fp32(const bgc_matrix3x3_fp32_t* minuend, const bgc_matrix3x3_fp32_t* subtrahend, bgc_matrix3x3_fp32_t* difference) inline void bgc_matrix3x3_subtract_fp32(const BgcMatrix3x3FP32* minuend, const BgcMatrix3x3FP32* subtrahend, BgcMatrix3x3FP32* difference)
{ {
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1; difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2; difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -539,7 +539,7 @@ inline void bgc_matrix3x3_subtract_fp32(const bgc_matrix3x3_fp32_t* minuend, con
difference->r3c3 = minuend->r3c3 - subtrahend->r3c3; difference->r3c3 = minuend->r3c3 - subtrahend->r3c3;
} }
inline void bgc_matrix3x3_subtract_fp64(const bgc_matrix3x3_fp64_t* minuend, const bgc_matrix3x3_fp64_t* subtrahend, bgc_matrix3x3_fp64_t* difference) inline void bgc_matrix3x3_subtract_fp64(const BgcMatrix3x3FP64* minuend, const BgcMatrix3x3FP64* subtrahend, BgcMatrix3x3FP64* difference)
{ {
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1; difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2; difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
@ -556,7 +556,7 @@ inline void bgc_matrix3x3_subtract_fp64(const bgc_matrix3x3_fp64_t* minuend, con
// =============== Multiplication =============== // // =============== Multiplication =============== //
inline void bgc_matrix3x3_multiply_fp32(const bgc_matrix3x3_fp32_t* multiplicand, const float multiplier, bgc_matrix3x3_fp32_t* product) inline void bgc_matrix3x3_multiply_fp32(const BgcMatrix3x3FP32* multiplicand, const float multiplier, BgcMatrix3x3FP32* product)
{ {
product->r1c1 = multiplicand->r1c1 * multiplier; product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier; product->r1c2 = multiplicand->r1c2 * multiplier;
@ -571,7 +571,7 @@ inline void bgc_matrix3x3_multiply_fp32(const bgc_matrix3x3_fp32_t* multiplicand
product->r3c3 = multiplicand->r3c3 * multiplier; product->r3c3 = multiplicand->r3c3 * multiplier;
} }
inline void bgc_matrix3x3_multiply_fp64(const bgc_matrix3x3_fp64_t* multiplicand, const double multiplier, bgc_matrix3x3_fp64_t* product) inline void bgc_matrix3x3_multiply_fp64(const BgcMatrix3x3FP64* multiplicand, const double multiplier, BgcMatrix3x3FP64* product)
{ {
product->r1c1 = multiplicand->r1c1 * multiplier; product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier; product->r1c2 = multiplicand->r1c2 * multiplier;
@ -588,19 +588,19 @@ inline void bgc_matrix3x3_multiply_fp64(const bgc_matrix3x3_fp64_t* multiplicand
// ================== Division ================== // // ================== Division ================== //
inline void bgc_matrix3x3_divide_fp32(const bgc_matrix3x3_fp32_t* dividend, const float divisor, bgc_matrix3x3_fp32_t* quotient) inline void bgc_matrix3x3_divide_fp32(const BgcMatrix3x3FP32* dividend, const float divisor, BgcMatrix3x3FP32* quotient)
{ {
bgc_matrix3x3_multiply_fp32(dividend, 1.0f / divisor, quotient); bgc_matrix3x3_multiply_fp32(dividend, 1.0f / divisor, quotient);
} }
inline void bgc_matrix3x3_divide_fp64(const bgc_matrix3x3_fp64_t* dividend, const double divisor, bgc_matrix3x3_fp64_t* quotient) inline void bgc_matrix3x3_divide_fp64(const BgcMatrix3x3FP64* dividend, const double divisor, BgcMatrix3x3FP64* quotient)
{ {
bgc_matrix3x3_multiply_fp64(dividend, 1.0 / divisor, quotient); bgc_matrix3x3_multiply_fp64(dividend, 1.0 / divisor, quotient);
} }
// ============ Left Vector Product ============= // // ============ Left Vector Product ============= //
inline void bgc_matrix3x3_left_product_fp32(const bgc_vector3_fp32_t* vector, const bgc_matrix3x3_fp32_t* matrix, bgc_vector3_fp32_t* result) inline void bgc_matrix3x3_left_product_fp32(const BgcVector3FP32* vector, const BgcMatrix3x3FP32* matrix, BgcVector3FP32* result)
{ {
const float x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1; 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 x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
@ -611,7 +611,7 @@ inline void bgc_matrix3x3_left_product_fp32(const bgc_vector3_fp32_t* vector, co
result->x3 = x3; result->x3 = x3;
} }
inline void bgc_matrix3x3_left_product_fp64(const bgc_vector3_fp64_t* vector, const bgc_matrix3x3_fp64_t* matrix, bgc_vector3_fp64_t* result) inline void bgc_matrix3x3_left_product_fp64(const BgcVector3FP64* vector, const BgcMatrix3x3FP64* matrix, BgcVector3FP64* result)
{ {
const double x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1; 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 x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
@ -624,7 +624,7 @@ inline void bgc_matrix3x3_left_product_fp64(const bgc_vector3_fp64_t* vector, co
// ============ Right Vector Product ============ // // ============ Right Vector Product ============ //
inline void bgc_matrix3x3_right_product_fp32(const bgc_matrix3x3_fp32_t* matrix, const bgc_vector3_fp32_t* vector, bgc_vector3_fp32_t* result) inline void bgc_matrix3x3_right_product_fp32(const BgcMatrix3x3FP32* matrix, const BgcVector3FP32* vector, BgcVector3FP32* result)
{ {
const float x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3; 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 x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
@ -635,7 +635,7 @@ inline void bgc_matrix3x3_right_product_fp32(const bgc_matrix3x3_fp32_t* matrix,
result->x3 = x3; result->x3 = x3;
} }
inline void bgc_matrix3x3_right_product_fp64(const bgc_matrix3x3_fp64_t* matrix, const bgc_vector3_fp64_t* vector, bgc_vector3_fp64_t* result) inline void bgc_matrix3x3_right_product_fp64(const BgcMatrix3x3FP64* matrix, const BgcVector3FP64* vector, BgcVector3FP64* result)
{ {
const double x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2 + matrix->r1c3 * vector->x3; 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 x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;

View file

@ -2,7 +2,7 @@
// ========== Matrix Product 2x2 at 3x2 ========= // // ========== Matrix Product 2x2 at 3x2 ========= //
void bgc_matrix_product_2x2_at_3x2_fp32(const bgc_matrix2x2_fp32_t* matrix1, const bgc_matrix3x2_fp32_t* matrix2, bgc_matrix3x2_fp32_t* result) void bgc_matrix_product_2x2_at_3x2_fp32(const BgcMatrix2x2FP32* matrix1, const BgcMatrix3x2FP32* matrix2, BgcMatrix3x2FP32* result)
{ {
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1; const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2; const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -21,7 +21,7 @@ void bgc_matrix_product_2x2_at_3x2_fp32(const bgc_matrix2x2_fp32_t* matrix1, con
result->r2c3 = r2c3; result->r2c3 = r2c3;
} }
void bgc_matrix_product_2x2_at_3x2_fp64(const bgc_matrix2x2_fp64_t* matrix1, const bgc_matrix3x2_fp64_t* matrix2, bgc_matrix3x2_fp64_t* result) void bgc_matrix_product_2x2_at_3x2_fp64(const BgcMatrix2x2FP64* matrix1, const BgcMatrix3x2FP64* matrix2, BgcMatrix3x2FP64* result)
{ {
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1; const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2; const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -42,7 +42,7 @@ void bgc_matrix_product_2x2_at_3x2_fp64(const bgc_matrix2x2_fp64_t* matrix1, con
// ========== Matrix Product 2x3 at 2x2 ========= // // ========== Matrix Product 2x3 at 2x2 ========= //
void bgc_matrix_product_2x3_at_2x2_fp32(const bgc_matrix2x3_fp32_t* matrix1, const bgc_matrix2x2_fp32_t* matrix2, bgc_matrix2x3_fp32_t* result) void bgc_matrix_product_2x3_at_2x2_fp32(const BgcMatrix2x3FP32* matrix1, const BgcMatrix2x2FP32* matrix2, BgcMatrix2x3FP32* result)
{ {
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1; const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2; const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -63,7 +63,7 @@ void bgc_matrix_product_2x3_at_2x2_fp32(const bgc_matrix2x3_fp32_t* matrix1, con
result->r3c2 = r3c2; result->r3c2 = r3c2;
} }
void bgc_matrix_product_2x3_at_2x2_fp64(const bgc_matrix2x3_fp64_t* matrix1, const bgc_matrix2x2_fp64_t* matrix2, bgc_matrix2x3_fp64_t* result) void bgc_matrix_product_2x3_at_2x2_fp64(const BgcMatrix2x3FP64* matrix1, const BgcMatrix2x2FP64* matrix2, BgcMatrix2x3FP64* result)
{ {
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1; const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2; const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -86,7 +86,7 @@ void bgc_matrix_product_2x3_at_2x2_fp64(const bgc_matrix2x3_fp64_t* matrix1, con
// ========== Matrix Product 2x3 at 3x2 ========= // // ========== Matrix Product 2x3 at 3x2 ========= //
void bgc_matrix_product_2x3_at_3x2_fp32(const bgc_matrix2x3_fp32_t* matrix1, const bgc_matrix3x2_fp32_t* matrix2, bgc_matrix3x3_fp32_t* result) void bgc_matrix_product_2x3_at_3x2_fp32(const BgcMatrix2x3FP32* matrix1, const BgcMatrix3x2FP32* matrix2, BgcMatrix3x3FP32* result)
{ {
result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1; result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2; result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -101,7 +101,7 @@ void bgc_matrix_product_2x3_at_3x2_fp32(const bgc_matrix2x3_fp32_t* matrix1, con
result->r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3; result->r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3;
} }
void bgc_matrix_product_2x3_at_3x2_fp64(const bgc_matrix2x3_fp64_t* matrix1, const bgc_matrix3x2_fp64_t* matrix2, bgc_matrix3x3_fp64_t* result) void bgc_matrix_product_2x3_at_3x2_fp64(const BgcMatrix2x3FP64* matrix1, const BgcMatrix3x2FP64* matrix2, BgcMatrix3x3FP64* result)
{ {
result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1; result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2; result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -118,7 +118,7 @@ void bgc_matrix_product_2x3_at_3x2_fp64(const bgc_matrix2x3_fp64_t* matrix1, con
// ========== Matrix Product 3x2 at 2x3 ========= // // ========== Matrix Product 3x2 at 2x3 ========= //
void bgc_matrix_product_3x2_at_2x3_fp32(const bgc_matrix3x2_fp32_t* matrix1, const bgc_matrix2x3_fp32_t* matrix2, bgc_matrix2x2_fp32_t* result) void bgc_matrix_product_3x2_at_2x3_fp32(const BgcMatrix3x2FP32* matrix1, const BgcMatrix2x3FP32* matrix2, BgcMatrix2x2FP32* result)
{ {
result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1; result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2; result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -127,7 +127,7 @@ void bgc_matrix_product_3x2_at_2x3_fp32(const bgc_matrix3x2_fp32_t* matrix1, con
result->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2; result->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
} }
void bgc_matrix_product_3x2_at_2x3_fp64(const bgc_matrix3x2_fp64_t* matrix1, const bgc_matrix2x3_fp64_t* matrix2, bgc_matrix2x2_fp64_t* result) void bgc_matrix_product_3x2_at_2x3_fp64(const BgcMatrix3x2FP64* matrix1, const BgcMatrix2x3FP64* matrix2, BgcMatrix2x2FP64* result)
{ {
result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1; result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2; result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -138,7 +138,7 @@ void bgc_matrix_product_3x2_at_2x3_fp64(const bgc_matrix3x2_fp64_t* matrix1, con
// ========== Matrix Product 3x2 at 3x3 ========= // // ========== Matrix Product 3x2 at 3x3 ========= //
void bgc_matrix_product_3x2_at_3x3_fp32(const bgc_matrix3x2_fp32_t* matrix1, const bgc_matrix3x3_fp32_t* matrix2, bgc_matrix3x2_fp32_t* result) void bgc_matrix_product_3x2_at_3x3_fp32(const BgcMatrix3x2FP32* matrix1, const BgcMatrix3x3FP32* matrix2, BgcMatrix3x2FP32* result)
{ {
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1; 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 r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -157,7 +157,7 @@ void bgc_matrix_product_3x2_at_3x3_fp32(const bgc_matrix3x2_fp32_t* matrix1, con
result->r2c3 = r2c3; result->r2c3 = r2c3;
} }
void bgc_matrix_product_3x2_at_3x3_fp64(const bgc_matrix3x2_fp64_t* matrix1, const bgc_matrix3x3_fp64_t* matrix2, bgc_matrix3x2_fp64_t* result) void bgc_matrix_product_3x2_at_3x3_fp64(const BgcMatrix3x2FP64* matrix1, const BgcMatrix3x3FP64* matrix2, BgcMatrix3x2FP64* result)
{ {
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1; 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 r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -178,7 +178,7 @@ void bgc_matrix_product_3x2_at_3x3_fp64(const bgc_matrix3x2_fp64_t* matrix1, con
// ========== Matrix Product 3x3 at 2x3 ========= // // ========== Matrix Product 3x3 at 2x3 ========= //
void bgc_matrix_product_3x3_at_2x3_fp32(const bgc_matrix3x3_fp32_t* matrix1, const bgc_matrix2x3_fp32_t* matrix2, bgc_matrix2x3_fp32_t* result) void bgc_matrix_product_3x3_at_2x3_fp32(const BgcMatrix3x3FP32* matrix1, const BgcMatrix2x3FP32* matrix2, BgcMatrix2x3FP32* result)
{ {
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1; 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 r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -199,7 +199,7 @@ void bgc_matrix_product_3x3_at_2x3_fp32(const bgc_matrix3x3_fp32_t* matrix1, con
result->r3c2 = r3c2; result->r3c2 = r3c2;
} }
void bgc_matrix_product_3x3_at_2x3_fp64(const bgc_matrix3x3_fp64_t* matrix1, const bgc_matrix2x3_fp64_t* matrix2, bgc_matrix2x3_fp64_t* result) void bgc_matrix_product_3x3_at_2x3_fp64(const BgcMatrix3x3FP64* matrix1, const BgcMatrix2x3FP64* matrix2, BgcMatrix2x3FP64* result)
{ {
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1; 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 r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -222,7 +222,7 @@ void bgc_matrix_product_3x3_at_2x3_fp64(const bgc_matrix3x3_fp64_t* matrix1, con
// ========== Matrix Product 3x3 at 3x3 ========= // // ========== Matrix Product 3x3 at 3x3 ========= //
void bgc_matrix_product_3x3_at_3x3_fp32(const bgc_matrix3x3_fp32_t* matrix1, const bgc_matrix3x3_fp32_t* matrix2, bgc_matrix3x3_fp32_t* result) void bgc_matrix_product_3x3_at_3x3_fp32(const BgcMatrix3x3FP32* matrix1, const BgcMatrix3x3FP32* matrix2, BgcMatrix3x3FP32* result)
{ {
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1; 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 r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
@ -249,7 +249,7 @@ void bgc_matrix_product_3x3_at_3x3_fp32(const bgc_matrix3x3_fp32_t* matrix1, con
result->r3c3 = r3c3; result->r3c3 = r3c3;
} }
void bgc_matrix_product_3x3_at_3x3_fp64(const bgc_matrix3x3_fp64_t* matrix1, const bgc_matrix3x3_fp64_t* matrix2, bgc_matrix3x3_fp64_t* result) void bgc_matrix_product_3x3_at_3x3_fp64(const BgcMatrix3x3FP64* matrix1, const BgcMatrix3x3FP64* matrix2, BgcMatrix3x3FP64* result)
{ {
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1; 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 r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;

View file

@ -6,12 +6,12 @@
typedef struct { typedef struct {
float r1c1, r1c2; float r1c1, r1c2;
float r2c1, r2c2; float r2c1, r2c2;
} bgc_matrix2x2_fp32_t; } BgcMatrix2x2FP32;
typedef struct { typedef struct {
double r1c1, r1c2; double r1c1, r1c2;
double r2c1, r2c2; double r2c1, r2c2;
} bgc_matrix2x2_fp64_t; } BgcMatrix2x2FP64;
// ================== Matrix2x3 ================= // // ================== Matrix2x3 ================= //
@ -19,25 +19,25 @@ typedef struct {
float r1c1, r1c2; float r1c1, r1c2;
float r2c1, r2c2; float r2c1, r2c2;
float r3c1, r3c2; float r3c1, r3c2;
} bgc_matrix2x3_fp32_t; } BgcMatrix2x3FP32;
typedef struct { typedef struct {
double r1c1, r1c2; double r1c1, r1c2;
double r2c1, r2c2; double r2c1, r2c2;
double r3c1, r3c2; double r3c1, r3c2;
} bgc_matrix2x3_fp64_t; } BgcMatrix2x3FP64;
// ================== Matrix3x2 ================= // // ================== Matrix3x2 ================= //
typedef struct { typedef struct {
float r1c1, r1c2, r1c3; float r1c1, r1c2, r1c3;
float r2c1, r2c2, r2c3; float r2c1, r2c2, r2c3;
} bgc_matrix3x2_fp32_t; } BgcMatrix3x2FP32;
typedef struct { typedef struct {
double r1c1, r1c2, r1c3; double r1c1, r1c2, r1c3;
double r2c1, r2c2, r2c3; double r2c1, r2c2, r2c3;
} bgc_matrix3x2_fp64_t; } BgcMatrix3x2FP64;
// ================== Matrix3x3 ================= // // ================== Matrix3x3 ================= //
@ -45,17 +45,17 @@ typedef struct {
float r1c1, r1c2, r1c3; float r1c1, r1c2, r1c3;
float r2c1, r2c2, r2c3; float r2c1, r2c2, r2c3;
float r3c1, r3c2, r3c3; float r3c1, r3c2, r3c3;
} bgc_matrix3x3_fp32_t; } BgcMatrix3x3FP32;
typedef struct { typedef struct {
double r1c1, r1c2, r1c3; double r1c1, r1c2, r1c3;
double r2c1, r2c2, r2c3; double r2c1, r2c2, r2c3;
double r3c1, r3c2, r3c3; double r3c1, r3c2, r3c3;
} bgc_matrix3x3_fp64_t; } BgcMatrix3x3FP64;
// ========== Matrix Product 2x2 at 2x2 ========= // // ========== Matrix Product 2x2 at 2x2 ========= //
inline void bgc_matrix_product_2x2_at_2x2_fp32(const bgc_matrix2x2_fp32_t* matrix1, const bgc_matrix2x2_fp32_t* matrix2, bgc_matrix2x2_fp32_t* result) inline void bgc_matrix_product_2x2_at_2x2_fp32(const BgcMatrix2x2FP32* matrix1, const BgcMatrix2x2FP32* matrix2, BgcMatrix2x2FP32* result)
{ {
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1; const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2; const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -70,7 +70,7 @@ inline void bgc_matrix_product_2x2_at_2x2_fp32(const bgc_matrix2x2_fp32_t* matri
result->r2c2 = r2c2; result->r2c2 = r2c2;
} }
inline void bgc_matrix_product_2x2_at_2x2_fp64(const bgc_matrix2x2_fp64_t* matrix1, const bgc_matrix2x2_fp64_t* matrix2, bgc_matrix2x2_fp64_t* result) inline void bgc_matrix_product_2x2_at_2x2_fp64(const BgcMatrix2x2FP64* matrix1, const BgcMatrix2x2FP64* matrix2, BgcMatrix2x2FP64* result)
{ {
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1; const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2; const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
@ -87,44 +87,44 @@ inline void bgc_matrix_product_2x2_at_2x2_fp64(const bgc_matrix2x2_fp64_t* matri
// ========== Matrix Product 2x2 at 3x2 ========= // // ========== Matrix Product 2x2 at 3x2 ========= //
void bgc_matrix_product_2x2_at_3x2_fp32(const bgc_matrix2x2_fp32_t* matrix1, const bgc_matrix3x2_fp32_t* matrix2, bgc_matrix3x2_fp32_t* result); void bgc_matrix_product_2x2_at_3x2_fp32(const BgcMatrix2x2FP32* matrix1, const BgcMatrix3x2FP32* matrix2, BgcMatrix3x2FP32* result);
void bgc_matrix_product_2x2_at_3x2_fp64(const bgc_matrix2x2_fp64_t* matrix1, const bgc_matrix3x2_fp64_t* matrix2, bgc_matrix3x2_fp64_t* result); void bgc_matrix_product_2x2_at_3x2_fp64(const BgcMatrix2x2FP64* matrix1, const BgcMatrix3x2FP64* matrix2, BgcMatrix3x2FP64* result);
// ========== Matrix Product 2x3 at 2x2 ========= // // ========== Matrix Product 2x3 at 2x2 ========= //
void bgc_matrix_product_2x3_at_2x2_fp32(const bgc_matrix2x3_fp32_t* matrix1, const bgc_matrix2x2_fp32_t* matrix2, bgc_matrix2x3_fp32_t* result); void bgc_matrix_product_2x3_at_2x2_fp32(const BgcMatrix2x3FP32* matrix1, const BgcMatrix2x2FP32* matrix2, BgcMatrix2x3FP32* result);
void bgc_matrix_product_2x3_at_2x2_fp64(const bgc_matrix2x3_fp64_t* matrix1, const bgc_matrix2x2_fp64_t* matrix2, bgc_matrix2x3_fp64_t* result); void bgc_matrix_product_2x3_at_2x2_fp64(const BgcMatrix2x3FP64* matrix1, const BgcMatrix2x2FP64* matrix2, BgcMatrix2x3FP64* result);
// ========== Matrix Product 2x3 at 3x2 ========= // // ========== Matrix Product 2x3 at 3x2 ========= //
void bgc_matrix_product_2x3_at_3x2_fp32(const bgc_matrix2x3_fp32_t* matrix1, const bgc_matrix3x2_fp32_t* matrix2, bgc_matrix3x3_fp32_t* result); void bgc_matrix_product_2x3_at_3x2_fp32(const BgcMatrix2x3FP32* matrix1, const BgcMatrix3x2FP32* matrix2, BgcMatrix3x3FP32* result);
void bgc_matrix_product_2x3_at_3x2_fp64(const bgc_matrix2x3_fp64_t* matrix1, const bgc_matrix3x2_fp64_t* matrix2, bgc_matrix3x3_fp64_t* result); void bgc_matrix_product_2x3_at_3x2_fp64(const BgcMatrix2x3FP64* matrix1, const BgcMatrix3x2FP64* matrix2, BgcMatrix3x3FP64* result);
// ========== Matrix Product 3x2 at 2x3 ========= // // ========== Matrix Product 3x2 at 2x3 ========= //
void bgc_matrix_product_3x2_at_2x3_fp32(const bgc_matrix3x2_fp32_t* matrix1, const bgc_matrix2x3_fp32_t* matrix2, bgc_matrix2x2_fp32_t* result); void bgc_matrix_product_3x2_at_2x3_fp32(const BgcMatrix3x2FP32* matrix1, const BgcMatrix2x3FP32* matrix2, BgcMatrix2x2FP32* result);
void bgc_matrix_product_3x2_at_2x3_fp64(const bgc_matrix3x2_fp64_t* matrix1, const bgc_matrix2x3_fp64_t* matrix2, bgc_matrix2x2_fp64_t* result); void bgc_matrix_product_3x2_at_2x3_fp64(const BgcMatrix3x2FP64* matrix1, const BgcMatrix2x3FP64* matrix2, BgcMatrix2x2FP64* result);
// ========== Matrix Product 3x2 at 3x3 ========= // // ========== Matrix Product 3x2 at 3x3 ========= //
void bgc_matrix_product_3x2_at_3x3_fp32(const bgc_matrix3x2_fp32_t* matrix1, const bgc_matrix3x3_fp32_t* matrix2, bgc_matrix3x2_fp32_t* result); void bgc_matrix_product_3x2_at_3x3_fp32(const BgcMatrix3x2FP32* matrix1, const BgcMatrix3x3FP32* matrix2, BgcMatrix3x2FP32* result);
void bgc_matrix_product_3x2_at_3x3_fp64(const bgc_matrix3x2_fp64_t* matrix1, const bgc_matrix3x3_fp64_t* matrix2, bgc_matrix3x2_fp64_t* result); void bgc_matrix_product_3x2_at_3x3_fp64(const BgcMatrix3x2FP64* matrix1, const BgcMatrix3x3FP64* matrix2, BgcMatrix3x2FP64* result);
// ========== Matrix Product 3x3 at 2x3 ========= // // ========== Matrix Product 3x3 at 2x3 ========= //
void bgc_matrix_product_3x3_at_2x3_fp32(const bgc_matrix3x3_fp32_t* matrix1, const bgc_matrix2x3_fp32_t* matrix2, bgc_matrix2x3_fp32_t* result); void bgc_matrix_product_3x3_at_2x3_fp32(const BgcMatrix3x3FP32* matrix1, const BgcMatrix2x3FP32* matrix2, BgcMatrix2x3FP32* result);
void bgc_matrix_product_3x3_at_2x3_fp64(const bgc_matrix3x3_fp64_t* matrix1, const bgc_matrix2x3_fp64_t* matrix2, bgc_matrix2x3_fp64_t* result); void bgc_matrix_product_3x3_at_2x3_fp64(const BgcMatrix3x3FP64* matrix1, const BgcMatrix2x3FP64* matrix2, BgcMatrix2x3FP64* result);
// ========== Matrix Product 3x3 at 3x3 ========= // // ========== Matrix Product 3x3 at 3x3 ========= //
void bgc_matrix_product_3x3_at_3x3_fp32(const bgc_matrix3x3_fp32_t* matrix1, const bgc_matrix3x3_fp32_t* matrix2, bgc_matrix3x3_fp32_t* result); void bgc_matrix_product_3x3_at_3x3_fp32(const BgcMatrix3x3FP32* matrix1, const BgcMatrix3x3FP32* matrix2, BgcMatrix3x3FP32* result);
void bgc_matrix_product_3x3_at_3x3_fp64(const bgc_matrix3x3_fp64_t* matrix1, const bgc_matrix3x3_fp64_t* matrix2, bgc_matrix3x3_fp64_t* result); void bgc_matrix_product_3x3_at_3x3_fp64(const BgcMatrix3x3FP64* matrix1, const BgcMatrix3x3FP64* matrix2, BgcMatrix3x3FP64* result);
#endif // _BGC_MATRIX_TYPES_H_ #endif // _BGC_MATRIX_TYPES_H_

View file

@ -9,15 +9,15 @@
typedef struct { typedef struct {
float s0, x1, x2, x3; float s0, x1, x2, x3;
} bgc_quaternion_fp32_t; } BgcQuaternionFP32;
typedef struct { typedef struct {
double s0, x1, x2, x3; double s0, x1, x2, x3;
} bgc_quaternion_fp64_t; } BgcQuaternionFP64;
// ==================== Reset =================== // // ==================== Reset =================== //
inline void bgc_quaternion_reset_fp32(bgc_quaternion_fp32_t * quaternion) inline void bgc_quaternion_reset_fp32(BgcQuaternionFP32 * quaternion)
{ {
quaternion->s0 = 0.0f; quaternion->s0 = 0.0f;
quaternion->x1 = 0.0f; quaternion->x1 = 0.0f;
@ -25,7 +25,7 @@ inline void bgc_quaternion_reset_fp32(bgc_quaternion_fp32_t * quaternion)
quaternion->x3 = 0.0f; quaternion->x3 = 0.0f;
} }
inline void bgc_quaternion_reset_fp64(bgc_quaternion_fp64_t * quaternion) inline void bgc_quaternion_reset_fp64(BgcQuaternionFP64 * quaternion)
{ {
quaternion->s0 = 0.0; quaternion->s0 = 0.0;
quaternion->x1 = 0.0; quaternion->x1 = 0.0;
@ -35,7 +35,7 @@ inline void bgc_quaternion_reset_fp64(bgc_quaternion_fp64_t * quaternion)
// ================== Set Unit ================== // // ================== Set Unit ================== //
inline void bgc_quaternion_set_to_identity_fp32(bgc_quaternion_fp32_t * quaternion) inline void bgc_quaternion_set_to_identity_fp32(BgcQuaternionFP32 * quaternion)
{ {
quaternion->s0 = 1.0f; quaternion->s0 = 1.0f;
quaternion->x1 = 0.0f; quaternion->x1 = 0.0f;
@ -43,7 +43,7 @@ inline void bgc_quaternion_set_to_identity_fp32(bgc_quaternion_fp32_t * quaterni
quaternion->x3 = 0.0f; quaternion->x3 = 0.0f;
} }
inline void bgc_quaternion_set_to_identity_fp64(bgc_quaternion_fp64_t * quaternion) inline void bgc_quaternion_set_to_identity_fp64(BgcQuaternionFP64 * quaternion)
{ {
quaternion->s0 = 1.0; quaternion->s0 = 1.0;
quaternion->x1 = 0.0; quaternion->x1 = 0.0;
@ -53,7 +53,7 @@ inline void bgc_quaternion_set_to_identity_fp64(bgc_quaternion_fp64_t * quaterni
// ==================== Set ===================== // // ==================== Set ===================== //
inline void bgc_quaternion_set_values_fp32(const float s0, const float x1, const float x2, const float x3, bgc_quaternion_fp32_t * quaternion) inline void bgc_quaternion_set_values_fp32(const float s0, const float x1, const float x2, const float x3, BgcQuaternionFP32 * quaternion)
{ {
quaternion->s0 = s0; quaternion->s0 = s0;
quaternion->x1 = x1; quaternion->x1 = x1;
@ -61,7 +61,7 @@ inline void bgc_quaternion_set_values_fp32(const float s0, const float x1, const
quaternion->x3 = x3; quaternion->x3 = x3;
} }
inline void bgc_quaternion_set_values_fp64(const double s0, const double x1, const double x2, const double x3, bgc_quaternion_fp64_t * quaternion) inline void bgc_quaternion_set_values_fp64(const double s0, const double x1, const double x2, const double x3, BgcQuaternionFP64 * quaternion)
{ {
quaternion->s0 = s0; quaternion->s0 = s0;
quaternion->x1 = x1; quaternion->x1 = x1;
@ -71,7 +71,7 @@ inline void bgc_quaternion_set_values_fp64(const double s0, const double x1, con
// ==================== Copy ==================== // // ==================== Copy ==================== //
inline void bgc_quaternion_copy_fp32(const bgc_quaternion_fp32_t* from, bgc_quaternion_fp32_t* to) inline void bgc_quaternion_copy_fp32(const BgcQuaternionFP32* from, BgcQuaternionFP32* to)
{ {
to->s0 = from->s0; to->s0 = from->s0;
to->x1 = from->x1; to->x1 = from->x1;
@ -79,7 +79,7 @@ inline void bgc_quaternion_copy_fp32(const bgc_quaternion_fp32_t* from, bgc_quat
to->x3 = from->x3; to->x3 = from->x3;
} }
inline void bgc_quaternion_copy_fp64(const bgc_quaternion_fp64_t* from, bgc_quaternion_fp64_t* to) inline void bgc_quaternion_copy_fp64(const BgcQuaternionFP64* from, BgcQuaternionFP64* to)
{ {
to->s0 = from->s0; to->s0 = from->s0;
to->x1 = from->x1; to->x1 = from->x1;
@ -89,7 +89,7 @@ inline void bgc_quaternion_copy_fp64(const bgc_quaternion_fp64_t* from, bgc_quat
// ==================== Swap ==================== // // ==================== Swap ==================== //
inline void bgc_quaternion_swap_fp32(bgc_quaternion_fp32_t* quarternion1, bgc_quaternion_fp32_t* quarternion2) inline void bgc_quaternion_swap_fp32(BgcQuaternionFP32* quarternion1, BgcQuaternionFP32* quarternion2)
{ {
const float s0 = quarternion2->s0; const float s0 = quarternion2->s0;
const float x1 = quarternion2->x1; const float x1 = quarternion2->x1;
@ -107,7 +107,7 @@ inline void bgc_quaternion_swap_fp32(bgc_quaternion_fp32_t* quarternion1, bgc_qu
quarternion1->x3 = x3; quarternion1->x3 = x3;
} }
inline void bgc_quaternion_swap_fp64(bgc_quaternion_fp64_t* quarternion1, bgc_quaternion_fp64_t* quarternion2) inline void bgc_quaternion_swap_fp64(BgcQuaternionFP64* quarternion1, BgcQuaternionFP64* quarternion2)
{ {
const double s0 = quarternion2->s0; const double s0 = quarternion2->s0;
const double x1 = quarternion2->x1; const double x1 = quarternion2->x1;
@ -127,7 +127,7 @@ inline void bgc_quaternion_swap_fp64(bgc_quaternion_fp64_t* quarternion1, bgc_qu
// ============= Copy to twin type ============== // // ============= Copy to twin type ============== //
inline void bgc_quaternion_convert_fp64_to_fp32(const bgc_quaternion_fp64_t* quaternion, bgc_quaternion_fp32_t* result) inline void bgc_quaternion_convert_fp64_to_fp32(const BgcQuaternionFP64* quaternion, BgcQuaternionFP32* result)
{ {
result->s0 = (float) quaternion->s0; result->s0 = (float) quaternion->s0;
result->x1 = (float) quaternion->x1; result->x1 = (float) quaternion->x1;
@ -135,7 +135,7 @@ inline void bgc_quaternion_convert_fp64_to_fp32(const bgc_quaternion_fp64_t* qua
result->x3 = (float) quaternion->x3; result->x3 = (float) quaternion->x3;
} }
inline void bgc_quaternion_convert_fp32_to_fp64(const bgc_quaternion_fp32_t* quaternion, bgc_quaternion_fp64_t* result) inline void bgc_quaternion_convert_fp32_to_fp64(const BgcQuaternionFP32* quaternion, BgcQuaternionFP64* result)
{ {
result->s0 = quaternion->s0; result->s0 = quaternion->s0;
result->x1 = quaternion->x1; result->x1 = quaternion->x1;
@ -145,14 +145,14 @@ inline void bgc_quaternion_convert_fp32_to_fp64(const bgc_quaternion_fp32_t* qua
// ================= Inversion ================== // // ================= Inversion ================== //
inline void bgc_quaternion_conjugate_fp32(bgc_quaternion_fp32_t* quaternion) inline void bgc_quaternion_conjugate_fp32(BgcQuaternionFP32* quaternion)
{ {
quaternion->x1 = -quaternion->x1; quaternion->x1 = -quaternion->x1;
quaternion->x2 = -quaternion->x2; quaternion->x2 = -quaternion->x2;
quaternion->x3 = -quaternion->x3; quaternion->x3 = -quaternion->x3;
} }
inline void bgc_quaternion_conjugate_fp64(bgc_quaternion_fp64_t* quaternion) inline void bgc_quaternion_conjugate_fp64(BgcQuaternionFP64* quaternion)
{ {
quaternion->x1 = -quaternion->x1; quaternion->x1 = -quaternion->x1;
quaternion->x2 = -quaternion->x2; quaternion->x2 = -quaternion->x2;
@ -161,7 +161,7 @@ inline void bgc_quaternion_conjugate_fp64(bgc_quaternion_fp64_t* quaternion)
// ================ Set Conjugate =============== // // ================ Set Conjugate =============== //
inline void bgc_quaternion_set_conjugate_fp32(const bgc_quaternion_fp32_t* quaternion, bgc_quaternion_fp32_t* result) inline void bgc_quaternion_set_conjugate_fp32(const BgcQuaternionFP32* quaternion, BgcQuaternionFP32* result)
{ {
result->s0 = quaternion->s0; result->s0 = quaternion->s0;
result->x1 = -quaternion->x1; result->x1 = -quaternion->x1;
@ -169,7 +169,7 @@ inline void bgc_quaternion_set_conjugate_fp32(const bgc_quaternion_fp32_t* quate
result->x3 = -quaternion->x3; result->x3 = -quaternion->x3;
} }
inline void bgc_quaternion_set_conjugate_fp64(const bgc_quaternion_fp64_t* quaternion, bgc_quaternion_fp64_t* result) inline void bgc_quaternion_set_conjugate_fp64(const BgcQuaternionFP64* quaternion, BgcQuaternionFP64* result)
{ {
result->s0 = quaternion->s0; result->s0 = quaternion->s0;
result->x1 = -quaternion->x1; result->x1 = -quaternion->x1;
@ -179,7 +179,7 @@ inline void bgc_quaternion_set_conjugate_fp64(const bgc_quaternion_fp64_t* quate
// ================ Set Conjugate =============== // // ================ Set Conjugate =============== //
inline void bgc_quaternion_set_conjugate_fp64_to_fp32(const bgc_quaternion_fp64_t* quaternion, bgc_quaternion_fp32_t* result) inline void bgc_quaternion_set_conjugate_fp64_to_fp32(const BgcQuaternionFP64* quaternion, BgcQuaternionFP32* result)
{ {
result->s0 = (float) quaternion->s0; result->s0 = (float) quaternion->s0;
result->x1 = (float) -quaternion->x1; result->x1 = (float) -quaternion->x1;
@ -187,7 +187,7 @@ inline void bgc_quaternion_set_conjugate_fp64_to_fp32(const bgc_quaternion_fp64_
result->x3 = (float) -quaternion->x3; result->x3 = (float) -quaternion->x3;
} }
inline void bgc_quaternion_set_conjugate_fp32_to_fp64(const bgc_quaternion_fp32_t* quaternion, bgc_quaternion_fp64_t* result) inline void bgc_quaternion_set_conjugate_fp32_to_fp64(const BgcQuaternionFP32* quaternion, BgcQuaternionFP64* result)
{ {
result->s0 = quaternion->s0; result->s0 = quaternion->s0;
result->x1 = -quaternion->x1; result->x1 = -quaternion->x1;
@ -197,31 +197,31 @@ inline void bgc_quaternion_set_conjugate_fp32_to_fp64(const bgc_quaternion_fp32_
// ============= Get Square Modulus ============= // // ============= Get Square Modulus ============= //
inline float bgc_quaternion_get_square_modulus_fp32(const bgc_quaternion_fp32_t* quaternion) inline float bgc_quaternion_get_square_modulus_fp32(const BgcQuaternionFP32* quaternion)
{ {
return (quaternion->s0 * quaternion->s0 + quaternion->x1 * quaternion->x1) + (quaternion->x2 * quaternion->x2 + quaternion->x3 * quaternion->x3); return (quaternion->s0 * quaternion->s0 + quaternion->x1 * quaternion->x1) + (quaternion->x2 * quaternion->x2 + quaternion->x3 * quaternion->x3);
} }
inline double bgc_quaternion_get_square_modulus_fp64(const bgc_quaternion_fp64_t* quaternion) inline double bgc_quaternion_get_square_modulus_fp64(const BgcQuaternionFP64* quaternion)
{ {
return (quaternion->s0 * quaternion->s0 + quaternion->x1 * quaternion->x1) + (quaternion->x2 * quaternion->x2 + quaternion->x3 * quaternion->x3); return (quaternion->s0 * quaternion->s0 + quaternion->x1 * quaternion->x1) + (quaternion->x2 * quaternion->x2 + quaternion->x3 * quaternion->x3);
} }
// ================ Get Modulus ================= // // ================ Get Modulus ================= //
inline float bgc_quaternion_get_modulus_fp32(const bgc_quaternion_fp32_t* quaternion) inline float bgc_quaternion_get_modulus_fp32(const BgcQuaternionFP32* quaternion)
{ {
return sqrtf(bgc_quaternion_get_square_modulus_fp32(quaternion)); return sqrtf(bgc_quaternion_get_square_modulus_fp32(quaternion));
} }
inline double bgc_quaternion_get_modulus_fp64(const bgc_quaternion_fp64_t* quaternion) inline double bgc_quaternion_get_modulus_fp64(const BgcQuaternionFP64* quaternion)
{ {
return sqrt(bgc_quaternion_get_square_modulus_fp64(quaternion)); return sqrt(bgc_quaternion_get_square_modulus_fp64(quaternion));
} }
// =============== Normalization ================ // // =============== Normalization ================ //
inline int bgc_quaternion_normalize_fp32(bgc_quaternion_fp32_t* quaternion) inline int bgc_quaternion_normalize_fp32(BgcQuaternionFP32* quaternion)
{ {
const float square_modulus = bgc_quaternion_get_square_modulus_fp32(quaternion); const float square_modulus = bgc_quaternion_get_square_modulus_fp32(quaternion);
@ -244,7 +244,7 @@ inline int bgc_quaternion_normalize_fp32(bgc_quaternion_fp32_t* quaternion)
return 1; return 1;
} }
inline int bgc_quaternion_normalize_fp64(bgc_quaternion_fp64_t* quaternion) inline int bgc_quaternion_normalize_fp64(BgcQuaternionFP64* quaternion)
{ {
const double square_modulus = bgc_quaternion_get_square_modulus_fp64(quaternion); const double square_modulus = bgc_quaternion_get_square_modulus_fp64(quaternion);
@ -269,7 +269,7 @@ inline int bgc_quaternion_normalize_fp64(bgc_quaternion_fp64_t* quaternion)
// ============ Make Rotation Matrix ============ // // ============ Make Rotation Matrix ============ //
inline void bgc_quaternion_get_rotation_matrix_fp32(const bgc_quaternion_fp32_t* quaternion, bgc_matrix3x3_fp32_t* matrix) inline void bgc_quaternion_get_rotation_matrix_fp32(const BgcQuaternionFP32* quaternion, BgcMatrix3x3FP32* matrix)
{ {
const float s0s0 = quaternion->s0 * quaternion->s0; const float s0s0 = quaternion->s0 * quaternion->s0;
const float x1x1 = quaternion->x1 * quaternion->x1; const float x1x1 = quaternion->x1 * quaternion->x1;
@ -307,7 +307,7 @@ inline void bgc_quaternion_get_rotation_matrix_fp32(const bgc_quaternion_fp32_t*
matrix->r1c3 = corrector2 * (x1x3 + s0x2); matrix->r1c3 = corrector2 * (x1x3 + s0x2);
} }
inline void bgc_quaternion_get_rotation_matrix_fp64(const bgc_quaternion_fp64_t* quaternion, bgc_matrix3x3_fp64_t* matrix) inline void bgc_quaternion_get_rotation_matrix_fp64(const BgcQuaternionFP64* quaternion, BgcMatrix3x3FP64* matrix)
{ {
const double s0s0 = quaternion->s0 * quaternion->s0; const double s0s0 = quaternion->s0 * quaternion->s0;
const double x1x1 = quaternion->x1 * quaternion->x1; const double x1x1 = quaternion->x1 * quaternion->x1;
@ -347,7 +347,7 @@ inline void bgc_quaternion_get_rotation_matrix_fp64(const bgc_quaternion_fp64_t*
// ============ Make Reverse Matrix ============= // // ============ Make Reverse Matrix ============= //
inline void bgc_quaternion_get_reverse_matrix_fp32(const bgc_quaternion_fp32_t* quaternion, bgc_matrix3x3_fp32_t* matrix) inline void bgc_quaternion_get_reverse_matrix_fp32(const BgcQuaternionFP32* quaternion, BgcMatrix3x3FP32* matrix)
{ {
const float s0s0 = quaternion->s0 * quaternion->s0; const float s0s0 = quaternion->s0 * quaternion->s0;
const float x1x1 = quaternion->x1 * quaternion->x1; const float x1x1 = quaternion->x1 * quaternion->x1;
@ -385,7 +385,7 @@ inline void bgc_quaternion_get_reverse_matrix_fp32(const bgc_quaternion_fp32_t*
matrix->r1c3 = corrector2 * (x1x3 - s0x2); matrix->r1c3 = corrector2 * (x1x3 - s0x2);
} }
inline void bgc_quaternion_get_reverse_matrix_fp64(const bgc_quaternion_fp64_t* quaternion, bgc_matrix3x3_fp64_t* matrix) inline void bgc_quaternion_get_reverse_matrix_fp64(const BgcQuaternionFP64* quaternion, BgcMatrix3x3FP64* matrix)
{ {
const double s0s0 = quaternion->s0 * quaternion->s0; const double s0s0 = quaternion->s0 * quaternion->s0;
const double x1x1 = quaternion->x1 * quaternion->x1; const double x1x1 = quaternion->x1 * quaternion->x1;
@ -425,7 +425,7 @@ inline void bgc_quaternion_get_reverse_matrix_fp64(const bgc_quaternion_fp64_t*
// ==================== Add ===================== // // ==================== Add ===================== //
inline void bgc_quaternion_add_fp32(const bgc_quaternion_fp32_t * quaternion1, const bgc_quaternion_fp32_t * quaternion2, bgc_quaternion_fp32_t * sum) inline void bgc_quaternion_add_fp32(const BgcQuaternionFP32 * quaternion1, const BgcQuaternionFP32 * quaternion2, BgcQuaternionFP32 * sum)
{ {
sum->s0 = quaternion1->s0 + quaternion2->s0; sum->s0 = quaternion1->s0 + quaternion2->s0;
sum->x1 = quaternion1->x1 + quaternion2->x1; sum->x1 = quaternion1->x1 + quaternion2->x1;
@ -433,7 +433,7 @@ inline void bgc_quaternion_add_fp32(const bgc_quaternion_fp32_t * quaternion1, c
sum->x3 = quaternion1->x3 + quaternion2->x3; sum->x3 = quaternion1->x3 + quaternion2->x3;
} }
inline void bgc_quaternion_add_fp64(const bgc_quaternion_fp64_t * quaternion1, const bgc_quaternion_fp64_t * quaternion2, bgc_quaternion_fp64_t * sum) inline void bgc_quaternion_add_fp64(const BgcQuaternionFP64 * quaternion1, const BgcQuaternionFP64 * quaternion2, BgcQuaternionFP64 * sum)
{ {
sum->s0 = quaternion1->s0 + quaternion2->s0; sum->s0 = quaternion1->s0 + quaternion2->s0;
sum->x1 = quaternion1->x1 + quaternion2->x1; sum->x1 = quaternion1->x1 + quaternion2->x1;
@ -443,7 +443,7 @@ inline void bgc_quaternion_add_fp64(const bgc_quaternion_fp64_t * quaternion1, c
// ================= Add Scaled ================= // // ================= Add Scaled ================= //
inline void bgc_quaternion_add_scaled_fp32(const bgc_quaternion_fp32_t * basic_quaternion, const bgc_quaternion_fp32_t * scalable_quaternion, const float scale, bgc_quaternion_fp32_t * sum) inline void bgc_quaternion_add_scaled_fp32(const BgcQuaternionFP32 * basic_quaternion, const BgcQuaternionFP32 * scalable_quaternion, const float scale, BgcQuaternionFP32 * sum)
{ {
sum->s0 = basic_quaternion->s0 + scalable_quaternion->s0 * scale; sum->s0 = basic_quaternion->s0 + scalable_quaternion->s0 * scale;
sum->x1 = basic_quaternion->x1 + scalable_quaternion->x1 * scale; sum->x1 = basic_quaternion->x1 + scalable_quaternion->x1 * scale;
@ -451,7 +451,7 @@ inline void bgc_quaternion_add_scaled_fp32(const bgc_quaternion_fp32_t * basic_q
sum->x3 = basic_quaternion->x3 + scalable_quaternion->x3 * scale; sum->x3 = basic_quaternion->x3 + scalable_quaternion->x3 * scale;
} }
inline void bgc_quaternion_add_scaled_fp64(const bgc_quaternion_fp64_t * basic_quaternion, const bgc_quaternion_fp64_t * scalable_quaternion, const double scale, bgc_quaternion_fp64_t * sum) inline void bgc_quaternion_add_scaled_fp64(const BgcQuaternionFP64 * basic_quaternion, const BgcQuaternionFP64 * scalable_quaternion, const double scale, BgcQuaternionFP64 * sum)
{ {
sum->s0 = basic_quaternion->s0 + scalable_quaternion->s0 * scale; sum->s0 = basic_quaternion->s0 + scalable_quaternion->s0 * scale;
sum->x1 = basic_quaternion->x1 + scalable_quaternion->x1 * scale; sum->x1 = basic_quaternion->x1 + scalable_quaternion->x1 * scale;
@ -461,7 +461,7 @@ inline void bgc_quaternion_add_scaled_fp64(const bgc_quaternion_fp64_t * basic_q
// ================== Subtract ================== // // ================== Subtract ================== //
inline void bgc_quaternion_subtract_fp32(const bgc_quaternion_fp32_t * minuend, const bgc_quaternion_fp32_t * subtrahend, bgc_quaternion_fp32_t * difference) inline void bgc_quaternion_subtract_fp32(const BgcQuaternionFP32 * minuend, const BgcQuaternionFP32 * subtrahend, BgcQuaternionFP32 * difference)
{ {
difference->s0 = minuend->s0 - subtrahend->s0; difference->s0 = minuend->s0 - subtrahend->s0;
difference->x1 = minuend->x1 - subtrahend->x1; difference->x1 = minuend->x1 - subtrahend->x1;
@ -469,7 +469,7 @@ inline void bgc_quaternion_subtract_fp32(const bgc_quaternion_fp32_t * minuend,
difference->x3 = minuend->x3 - subtrahend->x3; difference->x3 = minuend->x3 - subtrahend->x3;
} }
inline void bgc_quaternion_subtract_fp64(const bgc_quaternion_fp64_t * minuend, const bgc_quaternion_fp64_t * subtrahend, bgc_quaternion_fp64_t * difference) inline void bgc_quaternion_subtract_fp64(const BgcQuaternionFP64 * minuend, const BgcQuaternionFP64 * subtrahend, BgcQuaternionFP64 * difference)
{ {
difference->s0 = minuend->s0 - subtrahend->s0; difference->s0 = minuend->s0 - subtrahend->s0;
difference->x1 = minuend->x1 - subtrahend->x1; difference->x1 = minuend->x1 - subtrahend->x1;
@ -479,7 +479,7 @@ inline void bgc_quaternion_subtract_fp64(const bgc_quaternion_fp64_t * minuend,
// =============== Multiplication =============== // // =============== Multiplication =============== //
inline void bgc_quaternion_multiply_fp32(const bgc_quaternion_fp32_t* multiplicand, const float multipier, bgc_quaternion_fp32_t* product) inline void bgc_quaternion_multiply_fp32(const BgcQuaternionFP32* multiplicand, const float multipier, BgcQuaternionFP32* product)
{ {
product->s0 = multiplicand->s0 * multipier; product->s0 = multiplicand->s0 * multipier;
product->x1 = multiplicand->x1 * multipier; product->x1 = multiplicand->x1 * multipier;
@ -487,7 +487,7 @@ inline void bgc_quaternion_multiply_fp32(const bgc_quaternion_fp32_t* multiplica
product->x3 = multiplicand->x3 * multipier; product->x3 = multiplicand->x3 * multipier;
} }
inline void bgc_quaternion_multiply_fp64(const bgc_quaternion_fp64_t* multiplicand, const double multipier, bgc_quaternion_fp64_t* product) inline void bgc_quaternion_multiply_fp64(const BgcQuaternionFP64* multiplicand, const double multipier, BgcQuaternionFP64* product)
{ {
product->s0 = multiplicand->s0 * multipier; product->s0 = multiplicand->s0 * multipier;
product->x1 = multiplicand->x1 * multipier; product->x1 = multiplicand->x1 * multipier;
@ -497,19 +497,19 @@ inline void bgc_quaternion_multiply_fp64(const bgc_quaternion_fp64_t* multiplica
// ================== Division ================== // // ================== Division ================== //
inline void bgc_quaternion_divide_fp32(const bgc_quaternion_fp32_t* dividend, const float divisor, bgc_quaternion_fp32_t* quotient) inline void bgc_quaternion_divide_fp32(const BgcQuaternionFP32* dividend, const float divisor, BgcQuaternionFP32* quotient)
{ {
bgc_quaternion_multiply_fp32(dividend, 1.0f / divisor, quotient); bgc_quaternion_multiply_fp32(dividend, 1.0f / divisor, quotient);
} }
inline void bgc_quaternion_divide_fp64(const bgc_quaternion_fp64_t* dividend, const double divisor, bgc_quaternion_fp64_t* quotient) inline void bgc_quaternion_divide_fp64(const BgcQuaternionFP64* dividend, const double divisor, BgcQuaternionFP64* quotient)
{ {
bgc_quaternion_multiply_fp64(dividend, 1.0 / divisor, quotient); bgc_quaternion_multiply_fp64(dividend, 1.0 / divisor, quotient);
} }
// ================== Product =================== // // ================== Product =================== //
inline void bgc_quaternion_get_product_fp32(const bgc_quaternion_fp32_t* left, const bgc_quaternion_fp32_t* right, bgc_quaternion_fp32_t* product) inline void bgc_quaternion_get_product_fp32(const BgcQuaternionFP32* left, const BgcQuaternionFP32* right, BgcQuaternionFP32* product)
{ {
const float s0 = (left->s0 * right->s0 - left->x1 * right->x1) - (left->x2 * right->x2 + left->x3 * right->x3); const float s0 = (left->s0 * right->s0 - left->x1 * right->x1) - (left->x2 * right->x2 + left->x3 * right->x3);
const float x1 = (left->x1 * right->s0 + left->s0 * right->x1) - (left->x3 * right->x2 - left->x2 * right->x3); const float x1 = (left->x1 * right->s0 + left->s0 * right->x1) - (left->x3 * right->x2 - left->x2 * right->x3);
@ -522,7 +522,7 @@ inline void bgc_quaternion_get_product_fp32(const bgc_quaternion_fp32_t* left, c
product->x3 = x3; product->x3 = x3;
} }
inline void bgc_quaternion_get_product_fp64(const bgc_quaternion_fp64_t* left, const bgc_quaternion_fp64_t* right, bgc_quaternion_fp64_t* product) inline void bgc_quaternion_get_product_fp64(const BgcQuaternionFP64* left, const BgcQuaternionFP64* right, BgcQuaternionFP64* product)
{ {
const double s0 = (left->s0 * right->s0 - left->x1 * right->x1) - (left->x2 * right->x2 + left->x3 * right->x3); const double s0 = (left->s0 * right->s0 - left->x1 * right->x1) - (left->x2 * right->x2 + left->x3 * right->x3);
const double x1 = (left->x1 * right->s0 + left->s0 * right->x1) - (left->x3 * right->x2 - left->x2 * right->x3); const double x1 = (left->x1 * right->s0 + left->s0 * right->x1) - (left->x3 * right->x2 - left->x2 * right->x3);

View file

@ -1,5 +1,5 @@
#include "rotation3.h" #include "rotation3.h"
const bgc_rotation3_fp32_t BGC_IDLE_ROTATION3_FP32 = { {0.0f, 0.0f, 0.0f}, 0.0f}; const BgcRotation3FP32 BGC_IDLE_ROTATION3_FP32 = { {0.0f, 0.0f, 0.0f}, 0.0f};
const bgc_rotation3_fp64_t BGC_IDLE_ROTATION3_FP64 = { {0.0, 0.0, 0.0}, 0.0}; const BgcRotation3FP64 BGC_IDLE_ROTATION3_FP64 = { {0.0, 0.0, 0.0}, 0.0};

View file

@ -6,22 +6,22 @@
#include "vector3.h" #include "vector3.h"
typedef struct { typedef struct {
bgc_vector3_fp32_t axis; BgcVector3FP32 axis;
float radians; float radians;
} bgc_rotation3_fp32_t; } BgcRotation3FP32;
typedef struct { typedef struct {
bgc_vector3_fp64_t axis; BgcVector3FP64 axis;
double radians; double radians;
} bgc_rotation3_fp64_t; } BgcRotation3FP64;
extern const bgc_rotation3_fp32_t BGC_IDLE_ROTATION3_FP32; extern const BgcRotation3FP32 BGC_IDLE_ROTATION3_FP32;
extern const bgc_rotation3_fp64_t BGC_IDLE_ROTATION3_FP64; extern const BgcRotation3FP64 BGC_IDLE_ROTATION3_FP64;
// =================== Reset ==================== // // =================== Reset ==================== //
inline void bgc_rotation3_reset_fp32(bgc_rotation3_fp32_t* rotation) inline void bgc_rotation3_reset_fp32(BgcRotation3FP32* rotation)
{ {
rotation->axis.x1 = 0.0f; rotation->axis.x1 = 0.0f;
rotation->axis.x2 = 0.0f; rotation->axis.x2 = 0.0f;
@ -30,7 +30,7 @@ inline void bgc_rotation3_reset_fp32(bgc_rotation3_fp32_t* rotation)
rotation->radians = 0.0f; rotation->radians = 0.0f;
} }
inline void bgc_rotation3_reset_fp64(bgc_rotation3_fp64_t* rotation) inline void bgc_rotation3_reset_fp64(BgcRotation3FP64* rotation)
{ {
rotation->axis.x1 = 0.0; rotation->axis.x1 = 0.0;
rotation->axis.x2 = 0.0; rotation->axis.x2 = 0.0;
@ -41,7 +41,7 @@ inline void bgc_rotation3_reset_fp64(bgc_rotation3_fp64_t* rotation)
// ==================== Make ==================== // // ==================== Make ==================== //
inline void bgc_rotation3_set_values_fp32(const float x1, const float x2, const float x3, const float angle, const bgc_angle_unit_t unit, bgc_rotation3_fp32_t* rotation) inline void bgc_rotation3_set_values_fp32(const float x1, const float x2, const float x3, const float angle, const BgcAngleUnitEnum unit, BgcRotation3FP32* rotation)
{ {
rotation->axis.x1 = x1; rotation->axis.x1 = x1;
rotation->axis.x2 = x2; rotation->axis.x2 = x2;
@ -56,7 +56,7 @@ inline void bgc_rotation3_set_values_fp32(const float x1, const float x2, const
} }
inline void bgc_rotation3_set_values_fp64(const double x1, const double x2, const double x3, const double angle, const bgc_angle_unit_t unit, bgc_rotation3_fp64_t* rotation) inline void bgc_rotation3_set_values_fp64(const double x1, const double x2, const double x3, const double angle, const BgcAngleUnitEnum unit, BgcRotation3FP64* rotation)
{ {
rotation->axis.x1 = x1; rotation->axis.x1 = x1;
rotation->axis.x2 = x2; rotation->axis.x2 = x2;
@ -70,7 +70,7 @@ inline void bgc_rotation3_set_values_fp64(const double x1, const double x2, cons
} }
} }
inline void bgc_rotation3_set_with_axis_fp32(const bgc_vector3_fp32_t* axis, const float angle, const bgc_angle_unit_t unit, bgc_rotation3_fp32_t* rotation) inline void bgc_rotation3_set_with_axis_fp32(const BgcVector3FP32* axis, const float angle, const BgcAngleUnitEnum unit, BgcRotation3FP32* rotation)
{ {
rotation->axis.x1 = axis->x1; rotation->axis.x1 = axis->x1;
rotation->axis.x2 = axis->x2; rotation->axis.x2 = axis->x2;
@ -84,7 +84,7 @@ inline void bgc_rotation3_set_with_axis_fp32(const bgc_vector3_fp32_t* axis, con
} }
} }
inline void bgc_rotation3_set_with_axis_fp64(const bgc_vector3_fp64_t* axis, const double angle, const bgc_angle_unit_t unit, bgc_rotation3_fp64_t* rotation) inline void bgc_rotation3_set_with_axis_fp64(const BgcVector3FP64* axis, const double angle, const BgcAngleUnitEnum unit, BgcRotation3FP64* rotation)
{ {
rotation->axis.x1 = axis->x1; rotation->axis.x1 = axis->x1;
rotation->axis.x2 = axis->x2; rotation->axis.x2 = axis->x2;

View file

@ -1,5 +1,5 @@
#include "tangent.h" #include "tangent.h"
const bgc_tangent_fp32_t BGC_IDLE_TANGENT_FP32 = { 1.0f, 0.0f }; const BgcTangentFP32 BGC_IDLE_TANGENT_FP32 = { 1.0f, 0.0f };
const bgc_tangent_fp64_t BGC_IDLE_TANGENT_FP64 = { 1.0, 0.0 }; const BgcTangentFP64 BGC_IDLE_TANGENT_FP64 = { 1.0, 0.0 };

View file

@ -13,41 +13,41 @@
typedef struct typedef struct
{ {
const float cos, sin; const float cos, sin;
} bgc_tangent_fp32_t; } BgcTangentFP32;
typedef struct typedef struct
{ {
const double cos, sin; const double cos, sin;
} bgc_tangent_fp64_t; } BgcTangentFP64;
// ================= Dark Twins ================= // // ================= Dark Twins ================= //
typedef struct { typedef struct {
float cos, sin; float cos, sin;
} _bgc_dark_twin_tangent_fp32_t; } _BgcDarkTwinTangentFP32;
typedef struct { typedef struct {
double cos, sin; double cos, sin;
} _bgc_dark_twin_tangent_fp64_t; } _BgcDarkTwinTangentFP64;
// ================= Constants ================== // // ================= Constants ================== //
extern const bgc_tangent_fp32_t BGC_IDLE_TANGENT_FP32; extern const BgcTangentFP32 BGC_IDLE_TANGENT_FP32;
extern const bgc_tangent_fp64_t BGC_IDLE_TANGENT_FP64; extern const BgcTangentFP64 BGC_IDLE_TANGENT_FP64;
// =================== Reset ==================== // // =================== Reset ==================== //
inline void bgc_tangent_reset_fp32(bgc_tangent_fp32_t* tangent) inline void bgc_tangent_reset_fp32(BgcTangentFP32* tangent)
{ {
_bgc_dark_twin_tangent_fp32_t* twin = (_bgc_dark_twin_tangent_fp32_t*)tangent; _BgcDarkTwinTangentFP32* twin = (_BgcDarkTwinTangentFP32*)tangent;
twin->cos = 1.0f; twin->cos = 1.0f;
twin->sin = 0.0f; twin->sin = 0.0f;
} }
inline void bgc_tangent_reset_fp64(bgc_tangent_fp64_t* tangent) inline void bgc_tangent_reset_fp64(BgcTangentFP64* tangent)
{ {
_bgc_dark_twin_tangent_fp64_t* twin = (_bgc_dark_twin_tangent_fp64_t*)tangent; _BgcDarkTwinTangentFP64* twin = (_BgcDarkTwinTangentFP64*)tangent;
twin->cos = 1.0; twin->cos = 1.0;
twin->sin = 0.0; twin->sin = 0.0;
@ -55,11 +55,11 @@ inline void bgc_tangent_reset_fp64(bgc_tangent_fp64_t* tangent)
// ==================== Set ===================== // // ==================== Set ===================== //
inline void bgc_tangent_set_values_fp32(const float x1, const float x2, bgc_tangent_fp32_t* tangent) inline void bgc_tangent_set_values_fp32(const float x1, const float x2, BgcTangentFP32* tangent)
{ {
const float square_module = x1 * x1 + x2 * x2; const float square_module = x1 * x1 + x2 * x2;
_bgc_dark_twin_tangent_fp32_t* twin = (_bgc_dark_twin_tangent_fp32_t*)tangent; _BgcDarkTwinTangentFP32* twin = (_BgcDarkTwinTangentFP32*)tangent;
twin->cos = x1; twin->cos = x1;
twin->sin = x2; twin->sin = x2;
@ -80,11 +80,11 @@ inline void bgc_tangent_set_values_fp32(const float x1, const float x2, bgc_tang
twin->sin = x2 * multiplier; twin->sin = x2 * multiplier;
} }
inline void bgc_tangent_set_values_fp64(const double x1, const double x2, bgc_tangent_fp64_t* tangent) inline void bgc_tangent_set_values_fp64(const double x1, const double x2, BgcTangentFP64* tangent)
{ {
const double square_module = x1 * x1 + x2 * x2; const double square_module = x1 * x1 + x2 * x2;
_bgc_dark_twin_tangent_fp64_t* twin = (_bgc_dark_twin_tangent_fp64_t*)tangent; _BgcDarkTwinTangentFP64* twin = (_BgcDarkTwinTangentFP64*)tangent;
twin->cos = x1; twin->cos = x1;
twin->sin = x2; twin->sin = x2;
@ -107,17 +107,17 @@ inline void bgc_tangent_set_values_fp64(const double x1, const double x2, bgc_ta
// ==================== Copy ==================== // // ==================== Copy ==================== //
inline void bgc_tangent_copy_fp32(const bgc_tangent_fp32_t* from, bgc_tangent_fp32_t* to) inline void bgc_tangent_copy_fp32(const BgcTangentFP32* from, BgcTangentFP32* to)
{ {
_bgc_dark_twin_tangent_fp32_t* twin = (_bgc_dark_twin_tangent_fp32_t*)to; _BgcDarkTwinTangentFP32* twin = (_BgcDarkTwinTangentFP32*)to;
twin->cos = from->cos; twin->cos = from->cos;
twin->sin = from->sin; twin->sin = from->sin;
} }
inline void bgc_tangent_copy_fp64(const bgc_tangent_fp64_t* from, bgc_tangent_fp64_t* to) inline void bgc_tangent_copy_fp64(const BgcTangentFP64* from, BgcTangentFP64* to)
{ {
_bgc_dark_twin_tangent_fp64_t* twin = (_bgc_dark_twin_tangent_fp64_t*)to; _BgcDarkTwinTangentFP64* twin = (_BgcDarkTwinTangentFP64*)to;
twin->cos = from->cos; twin->cos = from->cos;
twin->sin = from->sin; twin->sin = from->sin;
@ -125,33 +125,33 @@ inline void bgc_tangent_copy_fp64(const bgc_tangent_fp64_t* from, bgc_tangent_fp
// ==================== Swap ==================== // // ==================== Swap ==================== //
inline void bgc_tangent_swap_fp32(bgc_tangent_fp32_t* tangent1, bgc_tangent_fp32_t* tangent2) inline void bgc_tangent_swap_fp32(BgcTangentFP32* tangent1, BgcTangentFP32* tangent2)
{ {
const float cos = tangent1->cos; const float cos = tangent1->cos;
const float sin = tangent1->sin; const float sin = tangent1->sin;
_bgc_dark_twin_tangent_fp32_t* twin1 = (_bgc_dark_twin_tangent_fp32_t*)tangent1; _BgcDarkTwinTangentFP32* twin1 = (_BgcDarkTwinTangentFP32*)tangent1;
twin1->cos = tangent2->cos; twin1->cos = tangent2->cos;
twin1->sin = tangent2->sin; twin1->sin = tangent2->sin;
_bgc_dark_twin_tangent_fp32_t* twin2 = (_bgc_dark_twin_tangent_fp32_t*)tangent2; _BgcDarkTwinTangentFP32* twin2 = (_BgcDarkTwinTangentFP32*)tangent2;
twin2->cos = cos; twin2->cos = cos;
twin2->sin = sin; twin2->sin = sin;
} }
inline void bgc_tangent_swap_fp64(bgc_tangent_fp64_t* tangent1, bgc_tangent_fp64_t* tangent2) inline void bgc_tangent_swap_fp64(BgcTangentFP64* tangent1, BgcTangentFP64* tangent2)
{ {
const double cos = tangent1->cos; const double cos = tangent1->cos;
const double sin = tangent1->sin; const double sin = tangent1->sin;
_bgc_dark_twin_tangent_fp64_t* twin1 = (_bgc_dark_twin_tangent_fp64_t*)tangent1; _BgcDarkTwinTangentFP64* twin1 = (_BgcDarkTwinTangentFP64*)tangent1;
twin1->cos = tangent2->cos; twin1->cos = tangent2->cos;
twin1->sin = tangent2->sin; twin1->sin = tangent2->sin;
_bgc_dark_twin_tangent_fp64_t* twin2 = (_bgc_dark_twin_tangent_fp64_t*)tangent2; _BgcDarkTwinTangentFP64* twin2 = (_BgcDarkTwinTangentFP64*)tangent2;
twin2->cos = cos; twin2->cos = cos;
twin2->sin = sin; twin2->sin = sin;
@ -159,21 +159,21 @@ inline void bgc_tangent_swap_fp64(bgc_tangent_fp64_t* tangent1, bgc_tangent_fp64
// ================== Set Turn ================== // // ================== Set Turn ================== //
inline void bgc_tangent_set_turn_fp32(const float angle, const bgc_angle_unit_t unit, bgc_tangent_fp32_t* tangent) inline void bgc_tangent_set_turn_fp32(const float angle, const BgcAngleUnitEnum unit, BgcTangentFP32* tangent)
{ {
const float radians = bgc_angle_to_radians_fp32(angle, unit); const float radians = bgc_angle_to_radians_fp32(angle, unit);
_bgc_dark_twin_tangent_fp32_t* twin = (_bgc_dark_twin_tangent_fp32_t*)tangent; _BgcDarkTwinTangentFP32* twin = (_BgcDarkTwinTangentFP32*)tangent;
twin->cos = cosf(radians); twin->cos = cosf(radians);
twin->sin = sinf(radians); twin->sin = sinf(radians);
} }
inline void bgc_tangent_set_turn_fp64(const double angle, const bgc_angle_unit_t unit, bgc_tangent_fp64_t* tangent) inline void bgc_tangent_set_turn_fp64(const double angle, const BgcAngleUnitEnum unit, BgcTangentFP64* tangent)
{ {
const double radians = bgc_angle_to_radians_fp64(angle, unit); const double radians = bgc_angle_to_radians_fp64(angle, unit);
_bgc_dark_twin_tangent_fp64_t* twin = (_bgc_dark_twin_tangent_fp64_t*)tangent; _BgcDarkTwinTangentFP64* twin = (_BgcDarkTwinTangentFP64*)tangent;
twin->cos = cos(radians); twin->cos = cos(radians);
twin->sin = sin(radians); twin->sin = sin(radians);
@ -181,41 +181,41 @@ inline void bgc_tangent_set_turn_fp64(const double angle, const bgc_angle_unit_t
// ============= Copy to twin type ============== // // ============= Copy to twin type ============== //
inline void bgc_tangent_convert_fp64_to_fp32(const bgc_tangent_fp64_t* from, bgc_tangent_fp32_t* to) inline void bgc_tangent_convert_fp64_to_fp32(const BgcTangentFP64* from, BgcTangentFP32* to)
{ {
bgc_tangent_set_values_fp32((float)from->cos, (float)from->sin, to); bgc_tangent_set_values_fp32((float)from->cos, (float)from->sin, to);
} }
inline void bgc_tangent_convert_fp32_to_fp64(const bgc_tangent_fp32_t* from, bgc_tangent_fp64_t* to) inline void bgc_tangent_convert_fp32_to_fp64(const BgcTangentFP32* from, BgcTangentFP64* to)
{ {
bgc_tangent_set_values_fp64((double)from->cos, (double)from->sin, to); bgc_tangent_set_values_fp64((double)from->cos, (double)from->sin, to);
} }
// ================= Inversion ================== // // ================= Inversion ================== //
inline void bgc_tangent_invert_fp32(bgc_tangent_fp32_t* tangent) inline void bgc_tangent_invert_fp32(BgcTangentFP32* tangent)
{ {
((_bgc_dark_twin_tangent_fp32_t*)tangent)->sin = -tangent->sin; ((_BgcDarkTwinTangentFP32*)tangent)->sin = -tangent->sin;
} }
inline void bgc_tangent_invert_fp64(bgc_tangent_fp64_t* tangent) inline void bgc_tangent_invert_fp64(BgcTangentFP64* tangent)
{ {
((_bgc_dark_twin_tangent_fp64_t*)tangent)->sin = -tangent->sin; ((_BgcDarkTwinTangentFP64*)tangent)->sin = -tangent->sin;
} }
// ================ Set Inverted ================ // // ================ Set Inverted ================ //
inline void bgc_tangent_set_inverted_fp32(const bgc_tangent_fp32_t* tangent, bgc_tangent_fp32_t* result) inline void bgc_tangent_set_inverted_fp32(const BgcTangentFP32* tangent, BgcTangentFP32* result)
{ {
_bgc_dark_twin_tangent_fp32_t* twin = (_bgc_dark_twin_tangent_fp32_t*)result; _BgcDarkTwinTangentFP32* twin = (_BgcDarkTwinTangentFP32*)result;
twin->cos = tangent->cos; twin->cos = tangent->cos;
twin->sin = -tangent->sin; twin->sin = -tangent->sin;
} }
inline void bgc_tangent_set_inverted_fp64(const bgc_tangent_fp64_t* tangent, bgc_tangent_fp64_t* result) inline void bgc_tangent_set_inverted_fp64(const BgcTangentFP64* tangent, BgcTangentFP64* result)
{ {
_bgc_dark_twin_tangent_fp64_t* twin = (_bgc_dark_twin_tangent_fp64_t*)result; _BgcDarkTwinTangentFP64* twin = (_BgcDarkTwinTangentFP64*)result;
twin->cos = tangent->cos; twin->cos = tangent->cos;
twin->sin = -tangent->sin; twin->sin = -tangent->sin;
@ -223,7 +223,7 @@ inline void bgc_tangent_set_inverted_fp64(const bgc_tangent_fp64_t* tangent, bgc
// ============== Rotation Matrix =============== // // ============== Rotation Matrix =============== //
inline void bgc_tangent_make_rotation_matrix_fp32(const bgc_tangent_fp32_t* tangent, bgc_matrix2x2_fp32_t* matrix) inline void bgc_tangent_make_rotation_matrix_fp32(const BgcTangentFP32* tangent, BgcMatrix2x2FP32* matrix)
{ {
matrix->r1c1 = tangent->cos; matrix->r1c1 = tangent->cos;
matrix->r1c2 = -tangent->sin; matrix->r1c2 = -tangent->sin;
@ -231,7 +231,7 @@ inline void bgc_tangent_make_rotation_matrix_fp32(const bgc_tangent_fp32_t* tang
matrix->r2c2 = tangent->cos; matrix->r2c2 = tangent->cos;
} }
inline void bgc_tangent_make_rotation_matrix_fp64(const bgc_tangent_fp64_t* tangent, bgc_matrix2x2_fp64_t* matrix) inline void bgc_tangent_make_rotation_matrix_fp64(const BgcTangentFP64* tangent, BgcMatrix2x2FP64* matrix)
{ {
matrix->r1c1 = tangent->cos; matrix->r1c1 = tangent->cos;
matrix->r1c2 = -tangent->sin; matrix->r1c2 = -tangent->sin;
@ -241,7 +241,7 @@ inline void bgc_tangent_make_rotation_matrix_fp64(const bgc_tangent_fp64_t* tang
// ============== Reverse Matrix ================ // // ============== Reverse Matrix ================ //
inline void bgc_tangent_make_reverse_matrix_fp32(const bgc_tangent_fp32_t* tangent, bgc_matrix2x2_fp32_t* matrix) inline void bgc_tangent_make_reverse_matrix_fp32(const BgcTangentFP32* tangent, BgcMatrix2x2FP32* matrix)
{ {
matrix->r1c1 = tangent->cos; matrix->r1c1 = tangent->cos;
matrix->r1c2 = tangent->sin; matrix->r1c2 = tangent->sin;
@ -249,7 +249,7 @@ inline void bgc_tangent_make_reverse_matrix_fp32(const bgc_tangent_fp32_t* tange
matrix->r2c2 = tangent->cos; matrix->r2c2 = tangent->cos;
} }
inline void bgc_tangent_make_reverse_matrix_fp64(const bgc_tangent_fp64_t* tangent, bgc_matrix2x2_fp64_t* matrix) inline void bgc_tangent_make_reverse_matrix_fp64(const BgcTangentFP64* tangent, BgcMatrix2x2FP64* matrix)
{ {
matrix->r1c1 = tangent->cos; matrix->r1c1 = tangent->cos;
matrix->r1c2 = tangent->sin; matrix->r1c2 = tangent->sin;
@ -259,7 +259,7 @@ inline void bgc_tangent_make_reverse_matrix_fp64(const bgc_tangent_fp64_t* tange
// =================== Angle =================== // // =================== Angle =================== //
inline float bgc_tangent_get_angle_fp32(const bgc_tangent_fp32_t* tangent, const bgc_angle_unit_t unit) inline float bgc_tangent_get_angle_fp32(const BgcTangentFP32* tangent, const BgcAngleUnitEnum unit)
{ {
if (tangent->cos >= 1.0f - BGC_TWO_EPSYLON_FP32) { if (tangent->cos >= 1.0f - BGC_TWO_EPSYLON_FP32) {
return 0.0f; return 0.0f;
@ -280,7 +280,7 @@ inline float bgc_tangent_get_angle_fp32(const bgc_tangent_fp32_t* tangent, const
return bgc_radians_to_units_fp32(atan2f(tangent->cos, tangent->sin), unit); return bgc_radians_to_units_fp32(atan2f(tangent->cos, tangent->sin), unit);
} }
inline double bgc_tangent_get_angle_fp64(const bgc_tangent_fp64_t* tangent, const bgc_angle_unit_t unit) inline double bgc_tangent_get_angle_fp64(const BgcTangentFP64* tangent, const BgcAngleUnitEnum unit)
{ {
if (tangent->cos >= 1.0 - BGC_TWO_EPSYLON_FP64) { if (tangent->cos >= 1.0 - BGC_TWO_EPSYLON_FP64) {
return 0.0; return 0.0;
@ -303,7 +303,7 @@ inline double bgc_tangent_get_angle_fp64(const bgc_tangent_fp64_t* tangent, cons
// ================ Combination ================= // // ================ Combination ================= //
inline void bgc_tangent_combine_fp32(const bgc_tangent_fp32_t* tangent1, const bgc_tangent_fp32_t* tangent2, bgc_tangent_fp32_t* result) inline void bgc_tangent_combine_fp32(const BgcTangentFP32* tangent1, const BgcTangentFP32* tangent2, BgcTangentFP32* result)
{ {
bgc_tangent_set_values_fp32( bgc_tangent_set_values_fp32(
tangent1->cos * tangent2->cos - tangent1->sin * tangent2->sin, tangent1->cos * tangent2->cos - tangent1->sin * tangent2->sin,
@ -312,7 +312,7 @@ inline void bgc_tangent_combine_fp32(const bgc_tangent_fp32_t* tangent1, const b
); );
} }
inline void bgc_tangent_combine_fp64(const bgc_tangent_fp64_t* tangent1, const bgc_tangent_fp64_t* tangent2, bgc_tangent_fp64_t* result) inline void bgc_tangent_combine_fp64(const BgcTangentFP64* tangent1, const BgcTangentFP64* tangent2, BgcTangentFP64* result)
{ {
bgc_tangent_set_values_fp64( bgc_tangent_set_values_fp64(
tangent1->cos * tangent2->cos - tangent1->sin * tangent2->sin, tangent1->cos * tangent2->cos - tangent1->sin * tangent2->sin,
@ -323,7 +323,7 @@ inline void bgc_tangent_combine_fp64(const bgc_tangent_fp64_t* tangent1, const b
// ================ Turn Vector ================= // // ================ Turn Vector ================= //
inline void bgc_tangent_turn_vector_fp32(const bgc_tangent_fp32_t* tangent, const bgc_vector2_fp32_t* vector, bgc_vector2_fp32_t* result) inline void bgc_tangent_turn_vector_fp32(const BgcTangentFP32* tangent, const BgcVector2FP32* vector, BgcVector2FP32* result)
{ {
const float x1 = tangent->cos * vector->x1 - tangent->sin * vector->x2; const float x1 = tangent->cos * vector->x1 - tangent->sin * vector->x2;
const float x2 = tangent->sin * vector->x1 + tangent->cos * vector->x2; const float x2 = tangent->sin * vector->x1 + tangent->cos * vector->x2;
@ -332,7 +332,7 @@ inline void bgc_tangent_turn_vector_fp32(const bgc_tangent_fp32_t* tangent, cons
result->x2 = x2; result->x2 = x2;
} }
inline void bgc_tangent_turn_vector_fp64(const bgc_tangent_fp64_t* tangent, const bgc_vector2_fp64_t* vector, bgc_vector2_fp64_t* result) inline void bgc_tangent_turn_vector_fp64(const BgcTangentFP64* tangent, const BgcVector2FP64* vector, BgcVector2FP64* result)
{ {
const double x1 = tangent->cos * vector->x1 - tangent->sin * vector->x2; const double x1 = tangent->cos * vector->x1 - tangent->sin * vector->x2;
const double x2 = tangent->sin * vector->x1 + tangent->cos * vector->x2; const double x2 = tangent->sin * vector->x1 + tangent->cos * vector->x2;
@ -343,7 +343,7 @@ inline void bgc_tangent_turn_vector_fp64(const bgc_tangent_fp64_t* tangent, cons
// ============ Turn Vector Backward ============ // // ============ Turn Vector Backward ============ //
inline void bgc_tangent_turn_vector_back_fp32(const bgc_tangent_fp32_t* tangent, const bgc_vector2_fp32_t* vector, bgc_vector2_fp32_t* result) inline void bgc_tangent_turn_vector_back_fp32(const BgcTangentFP32* tangent, const BgcVector2FP32* vector, BgcVector2FP32* result)
{ {
const float x1 = tangent->sin * vector->x2 + tangent->cos * vector->x1; const float x1 = tangent->sin * vector->x2 + tangent->cos * vector->x1;
const float x2 = tangent->cos * vector->x2 - tangent->sin * vector->x1; const float x2 = tangent->cos * vector->x2 - tangent->sin * vector->x1;
@ -352,7 +352,7 @@ inline void bgc_tangent_turn_vector_back_fp32(const bgc_tangent_fp32_t* tangent,
result->x2 = x2; result->x2 = x2;
} }
inline void bgc_tangent_turn_vector_back_fp64(const bgc_tangent_fp64_t* tangent, const bgc_vector2_fp64_t* vector, bgc_vector2_fp64_t* result) inline void bgc_tangent_turn_vector_back_fp64(const BgcTangentFP64* tangent, const BgcVector2FP64* vector, BgcVector2FP64* result)
{ {
const double x1 = tangent->sin * vector->x2 + tangent->cos * vector->x1; const double x1 = tangent->sin * vector->x2 + tangent->cos * vector->x1;
const double x2 = tangent->cos * vector->x2 - tangent->sin * vector->x1; const double x2 = tangent->cos * vector->x2 - tangent->sin * vector->x1;

View file

@ -2,7 +2,7 @@
// =================== Angle ==================== // // =================== Angle ==================== //
float bgc_vector2_get_angle_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2, const bgc_angle_unit_t unit) float bgc_vector2_get_angle_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2, const BgcAngleUnitEnum unit)
{ {
if (vector1 == 0 || vector2 == 0) { if (vector1 == 0 || vector2 == 0) {
return 0.0f; return 0.0f;
@ -33,7 +33,7 @@ float bgc_vector2_get_angle_fp32(const bgc_vector2_fp32_t* vector1, const bgc_ve
return bgc_radians_to_units_fp32(acosf(cosine), unit); return bgc_radians_to_units_fp32(acosf(cosine), unit);
} }
double bgc_vector2_get_angle_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2, const bgc_angle_unit_t unit) double bgc_vector2_get_angle_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2, const BgcAngleUnitEnum unit)
{ {
if (vector1 == 0 || vector2 == 0) { if (vector1 == 0 || vector2 == 0) {
return 0.0; return 0.0;

View file

@ -9,22 +9,22 @@
typedef struct typedef struct
{ {
float x1, x2; float x1, x2;
} bgc_vector2_fp32_t; } BgcVector2FP32;
typedef struct typedef struct
{ {
double x1, x2; double x1, x2;
} bgc_vector2_fp64_t; } BgcVector2FP64;
// =================== Reset ==================== // // =================== Reset ==================== //
inline void bgc_vector2_reset_fp32(bgc_vector2_fp32_t* vector) inline void bgc_vector2_reset_fp32(BgcVector2FP32* vector)
{ {
vector->x1 = 0.0f; vector->x1 = 0.0f;
vector->x2 = 0.0f; vector->x2 = 0.0f;
} }
inline void bgc_vector2_reset_fp64(bgc_vector2_fp64_t* vector) inline void bgc_vector2_reset_fp64(BgcVector2FP64* vector)
{ {
vector->x1 = 0.0; vector->x1 = 0.0;
vector->x2 = 0.0; vector->x2 = 0.0;
@ -32,13 +32,13 @@ inline void bgc_vector2_reset_fp64(bgc_vector2_fp64_t* vector)
// ==================== Set ===================== // // ==================== Set ===================== //
inline void bgc_vector2_set_values_fp32(const float x1, const float x2, bgc_vector2_fp32_t* to) inline void bgc_vector2_set_values_fp32(const float x1, const float x2, BgcVector2FP32* to)
{ {
to->x1 = x1; to->x1 = x1;
to->x2 = x2; to->x2 = x2;
} }
inline void bgc_vector2_set_values_fp64(const double x1, const double x2, bgc_vector2_fp64_t* to) inline void bgc_vector2_set_values_fp64(const double x1, const double x2, BgcVector2FP64* to)
{ {
to->x1 = x1; to->x1 = x1;
to->x2 = x2; to->x2 = x2;
@ -46,13 +46,13 @@ inline void bgc_vector2_set_values_fp64(const double x1, const double x2, bgc_ve
// ==================== Copy ==================== // // ==================== Copy ==================== //
inline void bgc_vector2_copy_fp32(const bgc_vector2_fp32_t* from, bgc_vector2_fp32_t* to) inline void bgc_vector2_copy_fp32(const BgcVector2FP32* from, BgcVector2FP32* to)
{ {
to->x1 = from->x1; to->x1 = from->x1;
to->x2 = from->x2; to->x2 = from->x2;
} }
inline void bgc_vector2_copy_fp64(const bgc_vector2_fp64_t* from, bgc_vector2_fp64_t* to) inline void bgc_vector2_copy_fp64(const BgcVector2FP64* from, BgcVector2FP64* to)
{ {
to->x1 = from->x1; to->x1 = from->x1;
to->x2 = from->x2; to->x2 = from->x2;
@ -60,7 +60,7 @@ inline void bgc_vector2_copy_fp64(const bgc_vector2_fp64_t* from, bgc_vector2_fp
// ==================== Swap ==================== // // ==================== Swap ==================== //
inline void bgc_vector2_swap_fp32(bgc_vector2_fp32_t* vector1, bgc_vector2_fp32_t* vector2) inline void bgc_vector2_swap_fp32(BgcVector2FP32* vector1, BgcVector2FP32* vector2)
{ {
const float x1 = vector2->x1; const float x1 = vector2->x1;
const float x2 = vector2->x2; const float x2 = vector2->x2;
@ -72,7 +72,7 @@ inline void bgc_vector2_swap_fp32(bgc_vector2_fp32_t* vector1, bgc_vector2_fp32_
vector1->x2 = x2; vector1->x2 = x2;
} }
inline void bgc_vector2_swap_fp64(bgc_vector2_fp64_t* vector1, bgc_vector2_fp64_t* vector2) inline void bgc_vector2_swap_fp64(BgcVector2FP64* vector1, BgcVector2FP64* vector2)
{ {
const double x1 = vector2->x1; const double x1 = vector2->x1;
const double x2 = vector2->x2; const double x2 = vector2->x2;
@ -86,13 +86,13 @@ inline void bgc_vector2_swap_fp64(bgc_vector2_fp64_t* vector1, bgc_vector2_fp64_
// ============= Copy to twin type ============== // // ============= Copy to twin type ============== //
inline void bgc_vector2_convert_fp64_to_fp32(const bgc_vector2_fp64_t* from, bgc_vector2_fp32_t* to) inline void bgc_vector2_convert_fp64_to_fp32(const BgcVector2FP64* from, BgcVector2FP32* to)
{ {
to->x1 = (float)from->x1; to->x1 = (float)from->x1;
to->x2 = (float)from->x2; to->x2 = (float)from->x2;
} }
inline void bgc_vector2_convert_fp32_to_fp64(const bgc_vector2_fp32_t* from, bgc_vector2_fp64_t* to) inline void bgc_vector2_convert_fp32_to_fp64(const BgcVector2FP32* from, BgcVector2FP64* to)
{ {
to->x1 = from->x1; to->x1 = from->x1;
to->x2 = from->x2; to->x2 = from->x2;
@ -100,13 +100,13 @@ inline void bgc_vector2_convert_fp32_to_fp64(const bgc_vector2_fp32_t* from, bgc
// =================== Reverse ================== // // =================== Reverse ================== //
inline void bgc_vector2_set_reverse_fp32(const bgc_vector2_fp32_t* from, bgc_vector2_fp32_t* to) inline void bgc_vector2_set_reverse_fp32(const BgcVector2FP32* from, BgcVector2FP32* to)
{ {
to->x1 = -from->x1; to->x1 = -from->x1;
to->x2 = -from->x2; to->x2 = -from->x2;
} }
inline void bgc_vector2_set_reverse_fp64(const bgc_vector2_fp64_t* from, bgc_vector2_fp64_t* to) inline void bgc_vector2_set_reverse_fp64(const BgcVector2FP64* from, BgcVector2FP64* to)
{ {
to->x1 = -from->x1; to->x1 = -from->x1;
to->x2 = -from->x2; to->x2 = -from->x2;
@ -114,13 +114,13 @@ inline void bgc_vector2_set_reverse_fp64(const bgc_vector2_fp64_t* from, bgc_vec
// ============= Reverse twin type ============== // // ============= Reverse twin type ============== //
inline void bgc_vector2_set_reverse_fp64_to_fp32(const bgc_vector2_fp64_t* from, bgc_vector2_fp32_t* to) inline void bgc_vector2_set_reverse_fp64_to_fp32(const BgcVector2FP64* from, BgcVector2FP32* to)
{ {
to->x1 = (float) -from->x1; to->x1 = (float) -from->x1;
to->x2 = (float) -from->x2; to->x2 = (float) -from->x2;
} }
inline void bgc_vector2_set_reverse_fp32_to_fp64(const bgc_vector2_fp32_t* from, bgc_vector2_fp64_t* to) inline void bgc_vector2_set_reverse_fp32_to_fp64(const BgcVector2FP32* from, BgcVector2FP64* to)
{ {
to->x1 = -from->x1; to->x1 = -from->x1;
to->x2 = -from->x2; to->x2 = -from->x2;
@ -128,46 +128,46 @@ inline void bgc_vector2_set_reverse_fp32_to_fp64(const bgc_vector2_fp32_t* from,
// =================== Module =================== // // =================== Module =================== //
inline float bgc_vector2_get_square_modulus_fp32(const bgc_vector2_fp32_t* vector) inline float bgc_vector2_get_square_modulus_fp32(const BgcVector2FP32* vector)
{ {
return vector->x1 * vector->x1 + vector->x2 * vector->x2; return vector->x1 * vector->x1 + vector->x2 * vector->x2;
} }
inline double bgc_vector2_get_square_modulus_fp64(const bgc_vector2_fp64_t* vector) inline double bgc_vector2_get_square_modulus_fp64(const BgcVector2FP64* vector)
{ {
return vector->x1 * vector->x1 + vector->x2 * vector->x2; return vector->x1 * vector->x1 + vector->x2 * vector->x2;
} }
inline float bgc_vector2_get_modulus_fp32(const bgc_vector2_fp32_t* vector) inline float bgc_vector2_get_modulus_fp32(const BgcVector2FP32* vector)
{ {
return sqrtf(bgc_vector2_get_square_modulus_fp32(vector)); return sqrtf(bgc_vector2_get_square_modulus_fp32(vector));
} }
inline double bgc_vector2_get_modulus_fp64(const bgc_vector2_fp64_t* vector) inline double bgc_vector2_get_modulus_fp64(const BgcVector2FP64* vector)
{ {
return sqrt(bgc_vector2_get_square_modulus_fp64(vector)); return sqrt(bgc_vector2_get_square_modulus_fp64(vector));
} }
// ================= Comparison ================= // // ================= Comparison ================= //
inline int bgc_vector2_is_zero_fp32(const bgc_vector2_fp32_t* vector) inline int bgc_vector2_is_zero_fp32(const BgcVector2FP32* vector)
{ {
return bgc_vector2_get_square_modulus_fp32(vector) <= BGC_SQUARE_EPSYLON_FP32; return bgc_vector2_get_square_modulus_fp32(vector) <= BGC_SQUARE_EPSYLON_FP32;
} }
inline int bgc_vector2_is_zero_fp64(const bgc_vector2_fp64_t* vector) inline int bgc_vector2_is_zero_fp64(const BgcVector2FP64* vector)
{ {
return bgc_vector2_get_square_modulus_fp64(vector) <= BGC_SQUARE_EPSYLON_FP64; return bgc_vector2_get_square_modulus_fp64(vector) <= BGC_SQUARE_EPSYLON_FP64;
} }
inline int bgc_vector2_is_unit_fp32(const bgc_vector2_fp32_t* vector) inline int bgc_vector2_is_unit_fp32(const BgcVector2FP32* vector)
{ {
const float square_modulus = bgc_vector2_get_square_modulus_fp32(vector); const float square_modulus = bgc_vector2_get_square_modulus_fp32(vector);
return 1.0f - BGC_TWO_EPSYLON_FP32 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP32; return 1.0f - BGC_TWO_EPSYLON_FP32 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP32;
} }
inline int bgc_vector2_is_unit_fp64(const bgc_vector2_fp64_t* vector) inline int bgc_vector2_is_unit_fp64(const BgcVector2FP64* vector)
{ {
const double square_modulus = bgc_vector2_get_square_modulus_fp64(vector); const double square_modulus = bgc_vector2_get_square_modulus_fp64(vector);
@ -176,13 +176,13 @@ inline int bgc_vector2_is_unit_fp64(const bgc_vector2_fp64_t* vector)
// ==================== Add ===================== // // ==================== Add ===================== //
inline void bgc_vector2_add_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2, bgc_vector2_fp32_t* sum) inline void bgc_vector2_add_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2, BgcVector2FP32* sum)
{ {
sum->x1 = vector1->x1 + vector2->x1; sum->x1 = vector1->x1 + vector2->x1;
sum->x2 = vector1->x2 + vector2->x2; sum->x2 = vector1->x2 + vector2->x2;
} }
inline void bgc_vector2_add_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2, bgc_vector2_fp64_t* sum) inline void bgc_vector2_add_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2, BgcVector2FP64* sum)
{ {
sum->x1 = vector1->x1 + vector2->x1; sum->x1 = vector1->x1 + vector2->x1;
sum->x2 = vector1->x2 + vector2->x2; sum->x2 = vector1->x2 + vector2->x2;
@ -190,13 +190,13 @@ inline void bgc_vector2_add_fp64(const bgc_vector2_fp64_t* vector1, const bgc_ve
// ================ Append scaled =============== // // ================ Append scaled =============== //
inline void bgc_vector2_add_scaled_fp32(const bgc_vector2_fp32_t* basic_vector, const bgc_vector2_fp32_t* scalable_vector, const float scale, bgc_vector2_fp32_t* sum) inline void bgc_vector2_add_scaled_fp32(const BgcVector2FP32* basic_vector, const BgcVector2FP32* scalable_vector, const float scale, BgcVector2FP32* sum)
{ {
sum->x1 = basic_vector->x1 + scalable_vector->x1 * scale; sum->x1 = basic_vector->x1 + scalable_vector->x1 * scale;
sum->x2 = basic_vector->x2 + scalable_vector->x2 * scale; sum->x2 = basic_vector->x2 + scalable_vector->x2 * scale;
} }
inline void bgc_vector2_add_scaled_fp64(const bgc_vector2_fp64_t* basic_vector, const bgc_vector2_fp64_t* scalable_vector, const double scale, bgc_vector2_fp64_t* sum) inline void bgc_vector2_add_scaled_fp64(const BgcVector2FP64* basic_vector, const BgcVector2FP64* scalable_vector, const double scale, BgcVector2FP64* sum)
{ {
sum->x1 = basic_vector->x1 + scalable_vector->x1 * scale; sum->x1 = basic_vector->x1 + scalable_vector->x1 * scale;
sum->x2 = basic_vector->x2 + scalable_vector->x2 * scale; sum->x2 = basic_vector->x2 + scalable_vector->x2 * scale;
@ -204,13 +204,13 @@ inline void bgc_vector2_add_scaled_fp64(const bgc_vector2_fp64_t* basic_vector,
// ================ Subtraction ================= // // ================ Subtraction ================= //
inline void bgc_vector2_subtract_fp32(const bgc_vector2_fp32_t* minuend, const bgc_vector2_fp32_t* subtrahend, bgc_vector2_fp32_t* difference) inline void bgc_vector2_subtract_fp32(const BgcVector2FP32* minuend, const BgcVector2FP32* subtrahend, BgcVector2FP32* difference)
{ {
difference->x1 = minuend->x1 - subtrahend->x1; difference->x1 = minuend->x1 - subtrahend->x1;
difference->x2 = minuend->x2 - subtrahend->x2; difference->x2 = minuend->x2 - subtrahend->x2;
} }
inline void bgc_vector2_subtract_fp64(const bgc_vector2_fp64_t* minuend, const bgc_vector2_fp64_t* subtrahend, bgc_vector2_fp64_t* difference) inline void bgc_vector2_subtract_fp64(const BgcVector2FP64* minuend, const BgcVector2FP64* subtrahend, BgcVector2FP64* difference)
{ {
difference->x1 = minuend->x1 - subtrahend->x1; difference->x1 = minuend->x1 - subtrahend->x1;
difference->x2 = minuend->x2 - subtrahend->x2; difference->x2 = minuend->x2 - subtrahend->x2;
@ -218,13 +218,13 @@ inline void bgc_vector2_subtract_fp64(const bgc_vector2_fp64_t* minuend, const b
// =============== Multiplication =============== // // =============== Multiplication =============== //
inline void bgc_vector2_multiply_fp32(const bgc_vector2_fp32_t* multiplicand, const float multiplier, bgc_vector2_fp32_t* product) inline void bgc_vector2_multiply_fp32(const BgcVector2FP32* multiplicand, const float multiplier, BgcVector2FP32* product)
{ {
product->x1 = multiplicand->x1 * multiplier; product->x1 = multiplicand->x1 * multiplier;
product->x2 = multiplicand->x2 * multiplier; product->x2 = multiplicand->x2 * multiplier;
} }
inline void bgc_vector2_multiply_fp64(const bgc_vector2_fp64_t* multiplicand, const double multiplier, bgc_vector2_fp64_t* product) inline void bgc_vector2_multiply_fp64(const BgcVector2FP64* multiplicand, const double multiplier, BgcVector2FP64* product)
{ {
product->x1 = multiplicand->x1 * multiplier; product->x1 = multiplicand->x1 * multiplier;
product->x2 = multiplicand->x2 * multiplier; product->x2 = multiplicand->x2 * multiplier;
@ -232,25 +232,25 @@ inline void bgc_vector2_multiply_fp64(const bgc_vector2_fp64_t* multiplicand, co
// ================== Division ================== // // ================== Division ================== //
inline void bgc_vector2_divide_fp32(const bgc_vector2_fp32_t* dividend, const float divisor, bgc_vector2_fp32_t* quotient) inline void bgc_vector2_divide_fp32(const BgcVector2FP32* dividend, const float divisor, BgcVector2FP32* quotient)
{ {
bgc_vector2_multiply_fp32(dividend, 1.0f / divisor, quotient); bgc_vector2_multiply_fp32(dividend, 1.0f / divisor, quotient);
} }
inline void bgc_vector2_divide_fp64(const bgc_vector2_fp64_t* dividend, const double divisor, bgc_vector2_fp64_t* quotient) inline void bgc_vector2_divide_fp64(const BgcVector2FP64* dividend, const double divisor, BgcVector2FP64* quotient)
{ {
bgc_vector2_multiply_fp64(dividend, 1.0 / divisor, quotient); bgc_vector2_multiply_fp64(dividend, 1.0 / divisor, quotient);
} }
// ================== Average2 ================== // // ================== Average2 ================== //
inline void bgc_vector2_mean_of_two_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2, bgc_vector2_fp32_t* result) inline void bgc_vector2_mean_of_two_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2, BgcVector2FP32* result)
{ {
result->x1 = (vector1->x1 + vector2->x1) * 0.5f; result->x1 = (vector1->x1 + vector2->x1) * 0.5f;
result->x2 = (vector1->x2 + vector2->x2) * 0.5f; result->x2 = (vector1->x2 + vector2->x2) * 0.5f;
} }
inline void bgc_vector2_mean_of_two_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2, bgc_vector2_fp64_t* result) inline void bgc_vector2_mean_of_two_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2, BgcVector2FP64* result)
{ {
result->x1 = (vector1->x1 + vector2->x1) * 0.5; result->x1 = (vector1->x1 + vector2->x1) * 0.5;
result->x2 = (vector1->x2 + vector2->x2) * 0.5; result->x2 = (vector1->x2 + vector2->x2) * 0.5;
@ -258,13 +258,13 @@ inline void bgc_vector2_mean_of_two_fp64(const bgc_vector2_fp64_t* vector1, cons
// ================== Average3 ================== // // ================== Average3 ================== //
inline void bgc_vector2_mean_of_three_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2, const bgc_vector2_fp32_t* vector3, bgc_vector2_fp32_t* result) inline void bgc_vector2_mean_of_three_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2, const BgcVector2FP32* vector3, BgcVector2FP32* result)
{ {
result->x1 = (vector1->x1 + vector2->x1 + vector3->x1) * BGC_ONE_THIRD_FP32; result->x1 = (vector1->x1 + vector2->x1 + vector3->x1) * BGC_ONE_THIRD_FP32;
result->x2 = (vector1->x2 + vector2->x2 + vector3->x2) * BGC_ONE_THIRD_FP32; result->x2 = (vector1->x2 + vector2->x2 + vector3->x2) * BGC_ONE_THIRD_FP32;
} }
inline void bgc_vector2_mean_of_three_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2, const bgc_vector2_fp64_t* vector3, bgc_vector2_fp64_t* result) inline void bgc_vector2_mean_of_three_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2, const BgcVector2FP64* vector3, BgcVector2FP64* result)
{ {
result->x1 = (vector1->x1 + vector2->x1 + vector3->x1) * BGC_ONE_THIRD_FP64; result->x1 = (vector1->x1 + vector2->x1 + vector3->x1) * BGC_ONE_THIRD_FP64;
result->x2 = (vector1->x2 + vector2->x2 + vector3->x2) * BGC_ONE_THIRD_FP64; result->x2 = (vector1->x2 + vector2->x2 + vector3->x2) * BGC_ONE_THIRD_FP64;
@ -272,31 +272,31 @@ inline void bgc_vector2_mean_of_three_fp64(const bgc_vector2_fp64_t* vector1, co
// =============== Scalar Product =============== // // =============== Scalar Product =============== //
inline float bgc_vector2_scalar_product_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2) inline float bgc_vector2_scalar_product_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2)
{ {
return vector1->x1 * vector2->x1 + vector1->x2 * vector2->x2; return vector1->x1 * vector2->x1 + vector1->x2 * vector2->x2;
} }
inline double bgc_vector2_scalar_product_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2) inline double bgc_vector2_scalar_product_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2)
{ {
return vector1->x1 * vector2->x1 + vector1->x2 * vector2->x2; return vector1->x1 * vector2->x1 + vector1->x2 * vector2->x2;
} }
// =============== Cross Product ================ // // =============== Cross Product ================ //
inline float bgc_vector2_cross_product_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2) inline float bgc_vector2_cross_product_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2)
{ {
return vector1->x1 * vector2->x2 - vector1->x2 * vector2->x1; return vector1->x1 * vector2->x2 - vector1->x2 * vector2->x1;
} }
inline double bgc_vector2_cross_product_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2) inline double bgc_vector2_cross_product_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2)
{ {
return vector1->x1 * vector2->x2 - vector1->x2 * vector2->x1; return vector1->x1 * vector2->x2 - vector1->x2 * vector2->x1;
} }
// ============== Complex Product =============== // // ============== Complex Product =============== //
inline void bgc_vector2_complex_product_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2, bgc_vector2_fp32_t* result) inline void bgc_vector2_complex_product_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2, BgcVector2FP32* result)
{ {
const float x1 = vector1->x1 * vector2->x1 - vector1->x2 * vector2->x2; const float x1 = vector1->x1 * vector2->x1 - vector1->x2 * vector2->x2;
const float x2 = vector1->x1 * vector2->x2 + vector1->x2 * vector2->x1; const float x2 = vector1->x1 * vector2->x2 + vector1->x2 * vector2->x1;
@ -305,7 +305,7 @@ inline void bgc_vector2_complex_product_fp32(const bgc_vector2_fp32_t* vector1,
result->x2 = x2; result->x2 = x2;
} }
inline void bgc_vector2_complex_product_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2, bgc_vector2_fp64_t* result) inline void bgc_vector2_complex_product_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2, BgcVector2FP64* result)
{ {
const double x1 = vector1->x1 * vector2->x1 - vector1->x2 * vector2->x2; const double x1 = vector1->x1 * vector2->x1 - vector1->x2 * vector2->x2;
const double x2 = vector1->x1 * vector2->x2 + vector1->x2 * vector2->x1; const double x2 = vector1->x1 * vector2->x2 + vector1->x2 * vector2->x1;
@ -316,7 +316,7 @@ inline void bgc_vector2_complex_product_fp64(const bgc_vector2_fp64_t* vector1,
// =============== Normalization ================ // // =============== Normalization ================ //
inline int bgc_vector2_normalize_fp32(bgc_vector2_fp32_t* vector) inline int bgc_vector2_normalize_fp32(BgcVector2FP32* vector)
{ {
const float square_modulus = bgc_vector2_get_square_modulus_fp32(vector); const float square_modulus = bgc_vector2_get_square_modulus_fp32(vector);
@ -333,7 +333,7 @@ inline int bgc_vector2_normalize_fp32(bgc_vector2_fp32_t* vector)
return 1; return 1;
} }
inline int bgc_vector2_normalize_fp64(bgc_vector2_fp64_t* vector) inline int bgc_vector2_normalize_fp64(BgcVector2FP64* vector)
{ {
const double square_modulus = bgc_vector2_get_square_modulus_fp64(vector); const double square_modulus = bgc_vector2_get_square_modulus_fp64(vector);
@ -352,13 +352,13 @@ inline int bgc_vector2_normalize_fp64(bgc_vector2_fp64_t* vector)
// =============== Get Normalized =============== // // =============== Get Normalized =============== //
inline int bgc_vector2_set_normalized_fp32(const bgc_vector2_fp32_t* vector, bgc_vector2_fp32_t* result) inline int bgc_vector2_set_normalized_fp32(const BgcVector2FP32* vector, BgcVector2FP32* result)
{ {
bgc_vector2_copy_fp32(vector, result); bgc_vector2_copy_fp32(vector, result);
return bgc_vector2_normalize_fp32(result); return bgc_vector2_normalize_fp32(result);
} }
inline int bgc_vector2_set_normalized_fp64(const bgc_vector2_fp64_t* vector, bgc_vector2_fp64_t* result) inline int bgc_vector2_set_normalized_fp64(const BgcVector2FP64* vector, BgcVector2FP64* result)
{ {
bgc_vector2_copy_fp64(vector, result); bgc_vector2_copy_fp64(vector, result);
return bgc_vector2_normalize_fp64(result); return bgc_vector2_normalize_fp64(result);
@ -366,13 +366,13 @@ inline int bgc_vector2_set_normalized_fp64(const bgc_vector2_fp64_t* vector, bgc
// =================== Angle ==================== // // =================== Angle ==================== //
float bgc_vector2_get_angle_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2, const bgc_angle_unit_t unit); float bgc_vector2_get_angle_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2, const BgcAngleUnitEnum unit);
double bgc_vector2_get_angle_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2, const bgc_angle_unit_t unit); double bgc_vector2_get_angle_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2, const BgcAngleUnitEnum unit);
// =============== Square Distance ============== // // =============== Square Distance ============== //
inline float bgc_vector2_get_square_distance_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2) inline float bgc_vector2_get_square_distance_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2)
{ {
const float dx1 = (vector1->x1 - vector2->x1); const float dx1 = (vector1->x1 - vector2->x1);
const float dx2 = (vector1->x2 - vector2->x2); const float dx2 = (vector1->x2 - vector2->x2);
@ -380,7 +380,7 @@ inline float bgc_vector2_get_square_distance_fp32(const bgc_vector2_fp32_t* vect
return dx1 * dx1 + dx2 * dx2; return dx1 * dx1 + dx2 * dx2;
} }
inline double bgc_vector2_get_square_distance_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2) inline double bgc_vector2_get_square_distance_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2)
{ {
const double dx1 = (vector1->x1 - vector2->x1); const double dx1 = (vector1->x1 - vector2->x1);
const double dx2 = (vector1->x2 - vector2->x2); const double dx2 = (vector1->x2 - vector2->x2);
@ -390,19 +390,19 @@ inline double bgc_vector2_get_square_distance_fp64(const bgc_vector2_fp64_t* vec
// ================== Distance ================== // // ================== Distance ================== //
inline float bgc_vector2_get_distance_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2) inline float bgc_vector2_get_distance_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2)
{ {
return sqrtf(bgc_vector2_get_square_distance_fp32(vector1, vector2)); return sqrtf(bgc_vector2_get_square_distance_fp32(vector1, vector2));
} }
inline double bgc_vector2_get_distance_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2) inline double bgc_vector2_get_distance_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2)
{ {
return sqrt(bgc_vector2_get_square_distance_fp64(vector1, vector2)); return sqrt(bgc_vector2_get_square_distance_fp64(vector1, vector2));
} }
// ================== Are Equal ================= // // ================== Are Equal ================= //
inline int bgc_vector2_are_equal_fp32(const bgc_vector2_fp32_t* vector1, const bgc_vector2_fp32_t* vector2) inline int bgc_vector2_are_equal_fp32(const BgcVector2FP32* vector1, const BgcVector2FP32* vector2)
{ {
const float square_modulus1 = bgc_vector2_get_square_modulus_fp32(vector1); const float square_modulus1 = bgc_vector2_get_square_modulus_fp32(vector1);
const float square_modulus2 = bgc_vector2_get_square_modulus_fp32(vector2); const float square_modulus2 = bgc_vector2_get_square_modulus_fp32(vector2);
@ -420,7 +420,7 @@ inline int bgc_vector2_are_equal_fp32(const bgc_vector2_fp32_t* vector1, const b
return square_modulus3 <= (2.0f * BGC_SQUARE_EPSYLON_FP32) * square_modulus1; return square_modulus3 <= (2.0f * BGC_SQUARE_EPSYLON_FP32) * square_modulus1;
} }
inline int bgc_vector2_are_equal_fp64(const bgc_vector2_fp64_t* vector1, const bgc_vector2_fp64_t* vector2) inline int bgc_vector2_are_equal_fp64(const BgcVector2FP64* vector1, const BgcVector2FP64* vector2)
{ {
const double square_modulus1 = bgc_vector2_get_square_modulus_fp64(vector1); const double square_modulus1 = bgc_vector2_get_square_modulus_fp64(vector1);
const double square_modulus2 = bgc_vector2_get_square_modulus_fp64(vector2); const double square_modulus2 = bgc_vector2_get_square_modulus_fp64(vector2);

View file

@ -2,7 +2,7 @@
// =================== Angle ==================== // // =================== Angle ==================== //
float bgc_vector3_get_angle_fp32(const bgc_vector3_fp32_t* vector1, const bgc_vector3_fp32_t* vector2, const bgc_angle_unit_t unit) float bgc_vector3_get_angle_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, const BgcAngleUnitEnum unit)
{ {
if (vector1 == 0 || vector2 == 0) { if (vector1 == 0 || vector2 == 0) {
return 0.0f; return 0.0f;
@ -33,7 +33,7 @@ float bgc_vector3_get_angle_fp32(const bgc_vector3_fp32_t* vector1, const bgc_ve
return bgc_radians_to_units_fp32(acosf(cosine), unit); return bgc_radians_to_units_fp32(acosf(cosine), unit);
} }
double bgc_vector3_get_angle_fp64(const bgc_vector3_fp64_t* vector1, const bgc_vector3_fp64_t* vector2, const bgc_angle_unit_t unit) double bgc_vector3_get_angle_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, const BgcAngleUnitEnum unit)
{ {
if (vector1 == 0 || vector2 == 0) { if (vector1 == 0 || vector2 == 0) {
return 0.0; return 0.0;

View file

Internal server error - Personal Git Server: Beyond coding. We Forge.

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -11,23 +11,23 @@
typedef struct typedef struct
{ {
float x1, x2, x3; float x1, x2, x3;
} bgc_vector3_fp32_t; } BgcVector3FP32;
typedef struct typedef struct
{ {
double x1, x2, x3; double x1, x2, x3;
} bgc_vector3_fp64_t; } BgcVector3FP64;
// =================== Reset ==================== // // =================== Reset ==================== //
inline void bgc_vector3_reset_fp32(bgc_vector3_fp32_t* vector) inline void bgc_vector3_reset_fp32(BgcVector3FP32* vector)
{ {
vector->x1 = 0.0f; vector->x1 = 0.0f;
vector->x2 = 0.0f; vector->x2 = 0.0f;
vector->x3 = 0.0f; vector->x3 = 0.0f;
} }
inline void bgc_vector3_reset_fp64(bgc_vector3_fp64_t* vector) inline void bgc_vector3_reset_fp64(BgcVector3FP64* vector)
{ {
vector->x1 = 0.0; vector->x1 = 0.0;
vector->x2 = 0.0; vector->x2 = 0.0;
@ -36,14 +36,14 @@ inline void bgc_vector3_reset_fp64(bgc_vector3_fp64_t* vector)
// ==================== Set ===================== // // ==================== Set ===================== //
inline void bgc_vector3_set_values_fp32(const float x1, const float x2, const float x3, bgc_vector3_fp32_t* to) inline void bgc_vector3_set_values_fp32(const float x1, const float x2, const float x3, BgcVector3FP32* to)
{ {
to->x1 = x1; to->x1 = x1;
to->x2 = x2; to->x2 = x2;
to->x3 = x3; to->x3 = x3;
} }
inline void bgc_vector3_set_values_fp64(const double x1, const double x2, const double x3, bgc_vector3_fp64_t* to) inline void bgc_vector3_set_values_fp64(const double x1, const double x2, const double x3, BgcVector3FP64* to)
{ {
to->x1 = x1; to->x1 = x1;
to->x2 = x2; to->x2 = x2;
@ -52,14 +52,14 @@ inline void bgc_vector3_set_values_fp64(const double x1, const double x2, const
// ==================== Copy ==================== // // ==================== Copy ==================== //
inline void bgc_vector3_copy_fp32(const bgc_vector3_fp32_t* from, bgc_vector3_fp32_t* to) inline void bgc_vector3_copy_fp32(const BgcVector3FP32* from, BgcVector3FP32* to)
{ {
to->x1 = from->x1; to->x1 = from->x1;
to->x2 = from->x2; to->x2 = from->x2;
to->x3 = from->x3; to->x3 = from->x3;
} }
inline void bgc_vector3_copy_fp64(const bgc_vector3_fp64_t* from, bgc_vector3_fp64_t* to) inline void bgc_vector3_copy_fp64(const BgcVector3FP64* from, BgcVector3FP64* to)
{ {
to->x1 = from->x1; to->x1 = from->x1;
to->x2 = from->x2; to->x2 = from->x2;
@ -68,14 +68,14 @@ inline void bgc_vector3_copy_fp64(const bgc_vector3_fp64_t* from, bgc_vector3_fp
// ================== Convert =================== // // ================== Convert =================== //
inline void bgc_vector3_convert_fp64_to_fp32(const bgc_vector3_fp64_t* from, bgc_vector3_fp32_t* to) inline void bgc_vector3_convert_fp64_to_fp32(const BgcVector3FP64* from, BgcVector3FP32* to)
{ {
to->x1 = (float) from->x1; to->x1 = (float) from->x1;
to->x2 = (float) from->x2; to->x2 = (float) from->x2;
to->x3 = (float) from->x3; to->x3 = (float) from->x3;
} }
inline void bgc_vector3_convert_fp32_to_fp64(const bgc_vector3_fp32_t* from, bgc_vector3_fp64_t* to) inline void bgc_vector3_convert_fp32_to_fp64(const BgcVector3FP32* from, BgcVector3FP64* to)
{ {
to->x1 = from->x1; to->x1 = from->x1;
to->x2 = from->x2; to->x2 = from->x2;
@ -84,7 +84,7 @@ inline void bgc_vector3_convert_fp32_to_fp64(const bgc_vector3_fp32_t* from, bgc
// ==================== Swap ==================== // // ==================== Swap ==================== //
inline void bgc_vector3_swap_fp32(bgc_vector3_fp32_t* vector1, bgc_vector3_fp32_t* vector2) inline void bgc_vector3_swap_fp32(BgcVector3FP32* vector1, BgcVector3FP32* vector2)
{ {
const float x1 = vector2->x1; const float x1 = vector2->x1;
const float x2 = vector2->x2; const float x2 = vector2->x2;
@ -99,7 +99,7 @@ inline void bgc_vector3_swap_fp32(bgc_vector3_fp32_t* vector1, bgc_vector3_fp32_
vector1->x3 = x3; vector1->x3 = x3;
} }
inline void bgc_vector3_swap_fp64(bgc_vector3_fp64_t* vector1, bgc_vector3_fp64_t* vector2) inline void bgc_vector3_swap_fp64(BgcVector3FP64* vector1, BgcVector3FP64* vector2)
{ {
const double x1 = vector2->x1; const double x1 = vector2->x1;
const double x2 = vector2->x2; const double x2 = vector2->x2;
@ -116,14 +116,14 @@ inline void bgc_vector3_swap_fp64(bgc_vector3_fp64_t* vector1, bgc_vector3_fp64_
// ==================== Invert ================== // // ==================== Invert ================== //
inline void bgc_vector3_invert_fp32(bgc_vector3_fp32_t* vector) inline void bgc_vector3_invert_fp32(BgcVector3FP32* vector)
{ {
vector->x1 = -vector->x1; vector->x1 = -vector->x1;
vector->x2 = -vector->x2; vector->x2 = -vector->x2;
vector->x3 = -vector->x3; vector->x3 = -vector->x3;
} }
inline void bgc_vector3_invert_fp64(bgc_vector3_fp64_t* vector) inline void bgc_vector3_invert_fp64(BgcVector3FP64* vector)
{ {
vector->x1 = -vector->x1; vector->x1 = -vector->x1;
vector->x2 = -vector->x2; vector->x2 = -vector->x2;
@ -132,14 +132,14 @@ inline void bgc_vector3_invert_fp64(bgc_vector3_fp64_t* vector)
// ================ Make Inverted =============== // // ================ Make Inverted =============== //
inline void bgc_vector3_set_inverted_fp32(const bgc_vector3_fp32_t* vector, bgc_vector3_fp32_t* result) inline void bgc_vector3_set_inverted_fp32(const BgcVector3FP32* vector, BgcVector3FP32* result)
{ {
result->x1 = -vector->x1; result->x1 = -vector->x1;
result->x2 = -vector->x2; result->x2 = -vector->x2;
result->x3 = -vector->x3; result->x3 = -vector->x3;
} }
inline void bgc_vector3_set_inverted_fp64(const bgc_vector3_fp64_t* vector, bgc_vector3_fp64_t* result) inline void bgc_vector3_set_inverted_fp64(const BgcVector3FP64* vector, BgcVector3FP64* result)
{ {
result->x1 = -vector->x1; result->x1 = -vector->x1;
result->x2 = -vector->x2; result->x2 = -vector->x2;
@ -148,14 +148,14 @@ inline void bgc_vector3_set_inverted_fp64(const bgc_vector3_fp64_t* vector, bgc_
// ============== Make Inverted Twin ============ // // ============== Make Inverted Twin ============ //
inline void bgc_vector3_set_inverted_fp32_to_fp64(const bgc_vector3_fp32_t* vector, bgc_vector3_fp64_t* result) inline void bgc_vector3_set_inverted_fp32_to_fp64(const BgcVector3FP32* vector, BgcVector3FP64* result)
{ {
result->x1 = -vector->x1; result->x1 = -vector->x1;
result->x2 = -vector->x2; result->x2 = -vector->x2;
result->x3 = -vector->x3; result->x3 = -vector->x3;
} }
inline void bgc_vector3_set_inverted_fp64_to_fp32(const bgc_vector3_fp64_t* vector, bgc_vector3_fp32_t* result) inline void bgc_vector3_set_inverted_fp64_to_fp32(const BgcVector3FP64* vector, BgcVector3FP32* result)
{ {
result->x1 = (float) -vector->x1; result->x1 = (float) -vector->x1;
result->x2 = (float) -vector->x2; result->x2 = (float) -vector->x2;
@ -164,46 +164,46 @@ inline void bgc_vector3_set_inverted_fp64_to_fp32(const bgc_vector3_fp64_t* vect
// =================== Module =================== // // =================== Module =================== //
inline float bgc_vector3_get_square_modulus_fp32(const bgc_vector3_fp32_t* vector) inline float bgc_vector3_get_square_modulus_fp32(const BgcVector3FP32* vector)
{ {
return vector->x1 * vector->x1 + vector->x2 * vector->x2 + vector->x3 * vector->x3; return vector->x1 * vector->x1 + vector->x2 * vector->x2 + vector->x3 * vector->x3;
} }
inline double bgc_vector3_get_square_modulus_fp64(const bgc_vector3_fp64_t* vector) inline double bgc_vector3_get_square_modulus_fp64(const BgcVector3FP64* vector)
{ {
return vector->x1 * vector->x1 + vector->x2 * vector->x2 + vector->x3 * vector->x3; return vector->x1 * vector->x1 + vector->x2 * vector->x2 + vector->x3 * vector->x3;
} }
inline float bgc_vector3_get_modulus_fp32(const bgc_vector3_fp32_t* vector) inline float bgc_vector3_get_modulus_fp32(const BgcVector3FP32* vector)
{ {
return sqrtf(bgc_vector3_get_square_modulus_fp32(vector)); return sqrtf(bgc_vector3_get_square_modulus_fp32(vector));
} }
inline double bgc_vector3_get_modulus_fp64(const bgc_vector3_fp64_t* vector) inline double bgc_vector3_get_modulus_fp64(const BgcVector3FP64* vector)
{ {
return sqrt(bgc_vector3_get_square_modulus_fp64(vector)); return sqrt(bgc_vector3_get_square_modulus_fp64(vector));
} }
// ================= Comparison ================= // // ================= Comparison ================= //
inline int bgc_vector3_is_zero_fp32(const bgc_vector3_fp32_t* vector) inline int bgc_vector3_is_zero_fp32(const BgcVector3FP32* vector)
{ {
return bgc_vector3_get_square_modulus_fp32(vector) <= BGC_SQUARE_EPSYLON_FP32; return bgc_vector3_get_square_modulus_fp32(vector) <= BGC_SQUARE_EPSYLON_FP32;
} }
inline int bgc_vector3_is_zero_fp64(const bgc_vector3_fp64_t* vector) inline int bgc_vector3_is_zero_fp64(const BgcVector3FP64* vector)
{ {
return bgc_vector3_get_square_modulus_fp64(vector) <= BGC_SQUARE_EPSYLON_FP64; return bgc_vector3_get_square_modulus_fp64(vector) <= BGC_SQUARE_EPSYLON_FP64;
} }
inline int bgc_vector3_is_unit_fp32(const bgc_vector3_fp32_t* vector) inline int bgc_vector3_is_unit_fp32(const BgcVector3FP32* vector)
{ {
const float square_modulus = bgc_vector3_get_square_modulus_fp32(vector); const float square_modulus = bgc_vector3_get_square_modulus_fp32(vector);
return 1.0f - BGC_TWO_EPSYLON_FP32 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP32; return 1.0f - BGC_TWO_EPSYLON_FP32 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP32;
} }
inline int bgc_vector3_is_unit_fp64(const bgc_vector3_fp64_t* vector) inline int bgc_vector3_is_unit_fp64(const BgcVector3FP64* vector)
{ {
const double square_modulus = bgc_vector3_get_square_modulus_fp64(vector); const double square_modulus = bgc_vector3_get_square_modulus_fp64(vector);
@ -212,14 +212,14 @@ inline int bgc_vector3_is_unit_fp64(const bgc_vector3_fp64_t* vector)
// ==================== Add ===================== // // ==================== Add ===================== //
inline void bgc_vector3_add_fp32(const bgc_vector3_fp32_t* vector1, const bgc_vector3_fp32_t* vector2, bgc_vector3_fp32_t* sum) inline void bgc_vector3_add_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, BgcVector3FP32* sum)
{ {
sum->x1 = vector1->x1 + vector2->x1; sum->x1 = vector1->x1 + vector2->x1;
sum->x2 = vector1->x2 + vector2->x2; sum->x2 = vector1->x2 + vector2->x2;
sum->x3 = vector1->x3 + vector2->x3; sum->x3 = vector1->x3 + vector2->x3;
} }
inline void bgc_vector3_add_fp64(const bgc_vector3_fp64_t* vector1, const bgc_vector3_fp64_t* vector2, bgc_vector3_fp64_t* sum) inline void bgc_vector3_add_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, BgcVector3FP64* sum)
{ {
sum->x1 = vector1->x1 + vector2->x1; sum->x1 = vector1->x1 + vector2->x1;
sum->x2 = vector1->x2 + vector2->x2; sum->x2 = vector1->x2 + vector2->x2;
@ -228,14 +228,14 @@ inline void bgc_vector3_add_fp64(const bgc_vector3_fp64_t* vector1, const bgc_ve
// ================= Add scaled ================= // // ================= Add scaled ================= //
inline void bgc_vector3_add_scaled_fp32(const bgc_vector3_fp32_t* basic_vector, const bgc_vector3_fp32_t* scalable_vector, const float scale, bgc_vector3_fp32_t* result) inline void bgc_vector3_add_scaled_fp32(const BgcVector3FP32* basic_vector, const BgcVector3FP32* scalable_vector, const float scale, BgcVector3FP32* result)
{ {
result->x1 = basic_vector->x1 + scalable_vector->x1 * scale; result->x1 = basic_vector->x1 + scalable_vector->x1 * scale;
result->x2 = basic_vector->x2 + scalable_vector->x2 * scale; result->x2 = basic_vector->x2 + scalable_vector->x2 * scale;
result->x3 = basic_vector->x3 + scalable_vector->x3 * scale; result->x3 = basic_vector->x3 + scalable_vector->x3 * scale;
} }
inline void bgc_vector3_add_scaled_fp64(const bgc_vector3_fp64_t* basic_vector, const bgc_vector3_fp64_t* scalable_vector, const double scale, bgc_vector3_fp64_t* result) inline void bgc_vector3_add_scaled_fp64(const BgcVector3FP64* basic_vector, const BgcVector3FP64* scalable_vector, const double scale, BgcVector3FP64* result)
{ {
result->x1 = basic_vector->x1 + scalable_vector->x1 * scale; result->x1 = basic_vector->x1 + scalable_vector->x1 * scale;
result->x2 = basic_vector->x2 + scalable_vector->x2 * scale; result->x2 = basic_vector->x2 + scalable_vector->x2 * scale;
@ -244,14 +244,14 @@ inline void bgc_vector3_add_scaled_fp64(const bgc_vector3_fp64_t* basic_vector,
// ================ Subtraction ================= // // ================ Subtraction ================= //
inline void bgc_vector3_subtract_fp32(const bgc_vector3_fp32_t* minuend, const bgc_vector3_fp32_t* subtrahend, bgc_vector3_fp32_t* difference) inline void bgc_vector3_subtract_fp32(const BgcVector3FP32* minuend, const BgcVector3FP32* subtrahend, BgcVector3FP32* difference)
{ {
difference->x1 = minuend->x1 - subtrahend->x1; difference->x1 = minuend->x1 - subtrahend->x1;
difference->x2 = minuend->x2 - subtrahend->x2; difference->x2 = minuend->x2 - subtrahend->x2;
difference->x3 = minuend->x3 - subtrahend->x3; difference->x3 = minuend->x3 - subtrahend->x3;
} }
inline void bgc_vector3_subtract_fp64(const bgc_vector3_fp64_t* minuend, const bgc_vector3_fp64_t* subtrahend, bgc_vector3_fp64_t* difference) inline void bgc_vector3_subtract_fp64(const BgcVector3FP64* minuend, const BgcVector3FP64* subtrahend, BgcVector3FP64* difference)
{ {
difference->x1 = minuend->x1 - subtrahend->x1; difference->x1 = minuend->x1 - subtrahend->x1;
difference->x2 = minuend->x2 - subtrahend->x2; difference->x2 = minuend->x2 - subtrahend->x2;
@ -260,14 +260,14 @@ inline void bgc_vector3_subtract_fp64(const bgc_vector3_fp64_t* minuend, const b
// =============== Multiplication =============== // // =============== Multiplication =============== //
inline void bgc_vector3_multiply_fp32(const bgc_vector3_fp32_t* multiplicand, const float multiplier, bgc_vector3_fp32_t* product) inline void bgc_vector3_multiply_fp32(const BgcVector3FP32* multiplicand, const float multiplier, BgcVector3FP32* product)
{ {
product->x1 = multiplicand->x1 * multiplier; product->x1 = multiplicand->x1 * multiplier;
product->x2 = multiplicand->x2 * multiplier; product->x2 = multiplicand->x2 * multiplier;
product->x3 = multiplicand->x3 * multiplier; product->x3 = multiplicand->x3 * multiplier;
} }
inline void bgc_vector3_multiply_fp64(const bgc_vector3_fp64_t* multiplicand, const double multiplier, bgc_vector3_fp64_t* product) inline void bgc_vector3_multiply_fp64(const BgcVector3FP64* multiplicand, const double multiplier, BgcVector3FP64* product)
{ {
product->x1 = multiplicand->x1 * multiplier; product->x1 = multiplicand->x1 * multiplier;
product->x2 = multiplicand->x2 * multiplier; product->x2 = multiplicand->x2 * multiplier;
@ -276,26 +276,26 @@ inline void bgc_vector3_multiply_fp64(const bgc_vector3_fp64_t* multiplicand, co
// ================== Division ================== // // ================== Division ================== //
inline void bgc_vector3_divide_fp32(const bgc_vector3_fp32_t* dividend, const float divisor, bgc_vector3_fp32_t* quotient) inline void bgc_vector3_divide_fp32(const BgcVector3FP32* dividend, const float divisor, BgcVector3FP32* quotient)
{ {
bgc_vector3_multiply_fp32(dividend, 1.0f / divisor, quotient); bgc_vector3_multiply_fp32(dividend, 1.0f / divisor, quotient);
} }
inline void bgc_vector3_divide_fp64(const bgc_vector3_fp64_t* dividend, const double divisor, bgc_vector3_fp64_t* quotient) inline void bgc_vector3_divide_fp64(const BgcVector3FP64* dividend, const double divisor, BgcVector3FP64* quotient)
{ {
bgc_vector3_multiply_fp64(dividend, 1.0 / divisor, quotient); bgc_vector3_multiply_fp64(dividend, 1.0 / divisor, quotient);
} }
// ================== Average2 ================== // // ================== Average2 ================== //
inline void bgc_vector3_mean_of_two_fp32(const bgc_vector3_fp32_t* vector1, const bgc_vector3_fp32_t* vector2, bgc_vector3_fp32_t* result) inline void bgc_vector3_mean_of_two_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, BgcVector3FP32* result)
{ {
result->x1 = (vector1->x1 + vector2->x1) * 0.5f; result->x1 = (vector1->x1 + vector2->x1) * 0.5f;
result->x2 = (vector1->x2 + vector2->x2) * 0.5f; result->x2 = (vector1->x2 + vector2->x2) * 0.5f;
result->x3 = (vector1->x3 + vector2->x3) * 0.5f; result->x3 = (vector1->x3 + vector2->x3) * 0.5f;
} }
inline void bgc_vector3_mean_of_two_fp64(const bgc_vector3_fp64_t* vector1, const bgc_vector3_fp64_t* vector2, bgc_vector3_fp64_t* result) inline void bgc_vector3_mean_of_two_fp64(const BgcVector3FP64* vector1, const BgcVector3FP64* vector2, BgcVector3FP64* result)
{ {
result->x1 = (vector1->x1 + vector2->x1) * 0.5; result->x1 = (vector1->x1 + vector2->x1) * 0.5;
result->x2 = (vector1->x2 + vector2->x2) * 0.5; result->x2 = (vector1->x2 + vector2->x2) * 0.5;
@ -304,14 +304,14 @@ inline void bgc_vector3_mean_of_two_fp64(const bgc_vector3_fp64_t* vector1, cons
// ================== Average3 ================== // // ================== Average3 ================== //
inline void bgc_vector3_mean_of_three_fp32(const bgc_vector3_fp32_t* vector1, const bgc_vector3_fp32_t* vector2, const bgc_vector3_fp32_t* vector3, bgc_vector3_fp32_t* result) inline void bgc_vector3_mean_of_three_fp32(const BgcVector3FP32* vector1, const BgcVector3FP32* vector2, const BgcVector3FP32* vector3, BgcVector3FP32* result)
{ {
result->x1 = (vector1->x1 + vector2->x1 + vector3->x1) * BGC_ONE_THIRD_FP32; result->x1 = (vector1->x1 + vector2->x1 + vector3->x1) * BGC_ONE_THIRD_FP32;
result->x2 = (vector1->x2 + vector2->x2 + vector3->x2) * BGC_ONE_THIRD_FP32; result->x2 = (vector1->x2 + vector2->x2 + vector3->x2) * BGC_ONE_THIRD_FP32;
result->x3 = (vector1->x3 + vector2->x3 + vector3->x3) * BGC_ONE_THIRD_FP32; result->x3 = (vector1->x3 + vector2->x3 + vector3->x3) * BGC_ONE_THIRD_FP32;
} }