Переименование типов на на общепринятый формат, отказ от суффикса _t, так как он зарезервирован POSIX
This commit is contained in:
parent
3805354611
commit
0027924f86
26 changed files with 574 additions and 571 deletions
|
@ -98,6 +98,7 @@
|
|||
<ConformanceMode>true</ConformanceMode>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -114,6 +115,7 @@
|
|||
<ConformanceMode>true</ConformanceMode>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -130,6 +132,7 @@
|
|||
<ConformanceMode>true</ConformanceMode>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#endif // _WINDOWS_
|
||||
|
||||
typedef struct {
|
||||
bgc_versor_fp32_t versor1, versor2, result;
|
||||
//matrix3x3_fp32_t matrix;
|
||||
bgc_vector3_fp32_t vector1, vector2;
|
||||
BgcVersorFP32 versor1, versor2, result;
|
||||
//BgcMatrix3x3FP32 matrix;
|
||||
BgcVector3FP32 vector1, vector2;
|
||||
} structure_fp32_t;
|
||||
|
||||
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);
|
||||
|
||||
//matrix3x3_set_to_identity_fp32(&list[i].matrix);
|
||||
//bgc_matrix3x3_set_to_identity_fp32(&list[i].matrix);
|
||||
|
||||
bgc_vector3_set_values_fp32(
|
||||
rand() * multiplier - 1.0f,
|
||||
|
@ -64,32 +64,32 @@ structure_fp32_t* make_structures(const unsigned int amount)
|
|||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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_turn_vector_fp32(&item->result, &item->vector1, &item->vector2);
|
||||
//}
|
||||
//bgc_versor_turn_vector_fp32(&item->result, &item->vector1, &item->vector2);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 },
|
||||
{ 10000.0f, -20000.0f },
|
||||
|
@ -10,7 +10,7 @@ const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1[] = {
|
|||
{ -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 },
|
||||
{ 0.002f, -0.05f },
|
||||
|
@ -66,7 +66,7 @@ int test_vector2_fp32_modulus()
|
|||
|
||||
// ===================== 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 },
|
||||
{ -6.0f, -8.0f },
|
||||
{ 10000.002f, -20000.05f },
|
||||
|
@ -78,7 +78,7 @@ int test_vector2_add_fp32()
|
|||
{
|
||||
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++) {
|
||||
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 ================== //
|
||||
|
||||
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 },
|
||||
{ 0.0f, 0.0f },
|
||||
{ 9999.998f, -19999.95f },
|
||||
|
@ -108,7 +108,7 @@ int test_vector2_subtract_fp32()
|
|||
{
|
||||
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++) {
|
||||
bgc_vector2_subtract_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef enum {
|
|||
BGC_ANGLE_UNIT_RADIANS = 1,
|
||||
BGC_ANGLE_UNIT_DEGREES = 2,
|
||||
BGC_ANGLE_UNIT_TURNS = 3
|
||||
} bgc_angle_unit_t;
|
||||
} BgcAngleUnitEnum;
|
||||
|
||||
typedef enum {
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ typedef enum {
|
|||
* (-180, 180] degrees, (-PI, PI] radians, (-0.5, 0.5] turns, (-200, 200] gradians
|
||||
*/
|
||||
BGC_ANGLE_RANGE_SIGNED = 2
|
||||
} bgc_angle_range_t;
|
||||
} BgcAngleRangeEnum;
|
||||
|
||||
// !================= Radians ==================! //
|
||||
|
||||
|
@ -76,7 +76,7 @@ inline double bgc_radians_to_turns_fp64(const double radians)
|
|||
|
||||
// ========= 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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
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 ============= //
|
||||
|
||||
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 (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;
|
||||
}
|
||||
|
||||
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 (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 ======== //
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
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 ============= //
|
||||
|
||||
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 (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;
|
||||
}
|
||||
|
||||
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 (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 ======== //
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
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 ============== //
|
||||
|
||||
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 (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;
|
||||
}
|
||||
|
||||
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 (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 ======== //
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
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 ======== //
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
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 ======== //
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
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 ============== //
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
return 360.0;
|
||||
|
@ -472,7 +472,7 @@ inline double bgc_angle_get_full_circle_fp64(const bgc_angle_unit_t unit)
|
|||
|
||||
// ============= 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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
return 180.0;
|
||||
|
@ -500,7 +500,7 @@ inline double bgc_angle_get_half_circle_fp64(const bgc_angle_unit_t unit)
|
|||
|
||||
// ============= 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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
return 90.0;
|
||||
|
@ -528,7 +528,7 @@ inline double bgc_angle_get_quater_circle_fp64(const bgc_angle_unit_t unit)
|
|||
|
||||
// ================ 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) {
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
return bgc_degrees_normalize_fp64(angle, range);
|
||||
|
|
|
@ -48,9 +48,6 @@
|
|||
</Unit>
|
||||
<Unit filename="angle.h" />
|
||||
<Unit filename="basic-geometry.h" />
|
||||
<Unit filename="basis.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="matrix2x2.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
@ -77,6 +74,9 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tangent.h" />
|
||||
<Unit filename="utilities.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="utilities.h" />
|
||||
<Unit filename="vector2.c">
|
||||
<Option compilerVar="CC" />
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="angle.c" />
|
||||
<ClCompile Include="basis.c" />
|
||||
<ClCompile Include="utilities.c" />
|
||||
<ClCompile Include="matrix2x2.c" />
|
||||
<ClCompile Include="matrix2x3.c" />
|
||||
<ClCompile Include="matrix3x2.c" />
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<ClCompile Include="angle.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="basis.c">
|
||||
<ClCompile Include="utilities.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="matrix2x2.c">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
// =================== 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->r1c2 = 0.0f;
|
||||
|
@ -15,7 +15,7 @@ inline void bgc_matrix2x2_reset_fp32(bgc_matrix2x2_fp32_t* matrix)
|
|||
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->r1c2 = 0.0;
|
||||
|
@ -25,7 +25,7 @@ inline void bgc_matrix2x2_reset_fp64(bgc_matrix2x2_fp64_t* matrix)
|
|||
|
||||
// ================== 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->r1c2 = 0.0f;
|
||||
|
@ -33,7 +33,7 @@ inline void bgc_matrix2x2_set_to_identity_fp32(bgc_matrix2x2_fp32_t* matrix)
|
|||
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->r1c2 = 0.0;
|
||||
|
@ -43,7 +43,7 @@ inline void bgc_matrix2x2_set_to_identity_fp64(bgc_matrix2x2_fp64_t* matrix)
|
|||
|
||||
// ================ 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = 0.0;
|
||||
|
@ -61,7 +61,7 @@ inline void bgc_matrix2x2_set_to_diagonal_fp64(const double d1, const double d2,
|
|||
|
||||
// ============== 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 cosine = cosf(radians);
|
||||
|
@ -73,7 +73,7 @@ inline void bgc_matrix2x2_make_rotation_fp32(const float angle, const bgc_angle_
|
|||
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 cosine = cos(radians);
|
||||
|
@ -87,7 +87,7 @@ inline void bgc_matrix2x2_make_rotation_fp64(const double angle, const bgc_angle
|
|||
|
||||
// ==================== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r1c2;
|
||||
|
@ -107,7 +107,7 @@ inline void bgc_matrix2x2_copy_fp64(const bgc_matrix2x2_fp64_t* from, bgc_matrix
|
|||
|
||||
// ==================== 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 r1c2 = matrix2->r1c2;
|
||||
|
@ -128,7 +128,7 @@ inline void bgc_matrix2x2_swap_fp32(bgc_matrix2x2_fp32_t* matrix1, bgc_matrix2x2
|
|||
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 r1c2 = matrix2->r1c2;
|
||||
|
@ -151,7 +151,7 @@ inline void bgc_matrix2x2_swap_fp64(bgc_matrix2x2_fp64_t* matrix1, bgc_matrix2x2
|
|||
|
||||
// ============= 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r1c2;
|
||||
|
@ -171,26 +171,26 @@ inline void bgc_matrix2x2_convert_fp32_to_fp64(const bgc_matrix2x2_fp32_t* from,
|
|||
|
||||
// ================ 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ================== 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);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -199,14 +199,14 @@ inline int bgc_matrix2x2_is_singular_fp64(const bgc_matrix2x2_fp64_t* matrix)
|
|||
|
||||
// =============== 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;
|
||||
matrix->r1c2 = matrix->r2c1;
|
||||
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;
|
||||
matrix->r1c2 = matrix->r2c1;
|
||||
|
@ -215,7 +215,7 @@ inline void bgc_matrix2x2_transpose_fp64(bgc_matrix2x2_fp64_t* matrix)
|
|||
|
||||
// ================= 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);
|
||||
|
||||
|
@ -240,7 +240,7 @@ inline int bgc_matrix2x2_invert_fp32(bgc_matrix2x2_fp32_t* matrix)
|
|||
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);
|
||||
|
||||
|
@ -267,7 +267,7 @@ inline int bgc_matrix2x2_invert_fp64(bgc_matrix2x2_fp64_t* matrix)
|
|||
|
||||
// =============== 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;
|
||||
|
||||
|
@ -278,7 +278,7 @@ inline void bgc_matrix2x2_set_transposed_fp32(const bgc_matrix2x2_fp32_t* from,
|
|||
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;
|
||||
|
||||
|
@ -291,7 +291,7 @@ inline void bgc_matrix2x2_set_transposed_fp64(const bgc_matrix2x2_fp64_t* from,
|
|||
|
||||
// ================ 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);
|
||||
|
||||
|
@ -316,7 +316,7 @@ inline int bgc_matrix2x2_set_inverted_fp32(const bgc_matrix2x2_fp32_t* from, bgc
|
|||
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);
|
||||
|
||||
|
@ -343,13 +343,13 @@ inline int bgc_matrix2x2_set_inverted_fp64(const bgc_matrix2x2_fp64_t* from, bgc
|
|||
|
||||
// ================= 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->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->r1c2 = c2;
|
||||
|
@ -357,13 +357,13 @@ inline void bgc_matrix2x2_set_row1_fp64(const double c1, const double c2, bgc_ma
|
|||
|
||||
// ================= 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->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->r2c2 = c2;
|
||||
|
@ -371,13 +371,13 @@ inline void bgc_matrix2x2_set_row2_fp64(const double c1, const double c2, bgc_ma
|
|||
|
||||
// ================ 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->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->r2c1 = r2;
|
||||
|
@ -385,13 +385,13 @@ inline void bgc_matrix2x2_set_column1_fp64(const double r1, const double r2, bgc
|
|||
|
||||
// ================ 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->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->r2c2 = r2;
|
||||
|
@ -399,7 +399,7 @@ inline void bgc_matrix2x2_set_column2_fp64(const double r1, const double r2, bgc
|
|||
|
||||
// ================== 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->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;
|
||||
}
|
||||
|
||||
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->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 ================= //
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
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->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 ================= //
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -459,7 +459,7 @@ inline void bgc_matrix2x2_subtract_fp64(const bgc_matrix2x2_fp64_t* minuend, con
|
|||
|
||||
// =============== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -479,19 +479,19 @@ inline void bgc_matrix2x2_multiply_fp64(const bgc_matrix2x2_fp64_t* multiplicand
|
|||
|
||||
// ================== 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// ============ 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 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;
|
||||
}
|
||||
|
||||
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 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 ============ //
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
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 x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
// =================== 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->r1c2 = 0.0f;
|
||||
|
@ -19,7 +19,7 @@ inline void bgc_matrix2x3_reset_fp32(bgc_matrix2x3_fp32_t* matrix)
|
|||
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->r1c2 = 0.0;
|
||||
|
@ -33,7 +33,7 @@ inline void bgc_matrix2x3_reset_fp64(bgc_matrix2x3_fp64_t* matrix)
|
|||
|
||||
// ==================== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r1c2;
|
||||
|
@ -59,7 +59,7 @@ inline void bgc_matrix2x3_copy_fp64(const bgc_matrix2x3_fp64_t* from, bgc_matrix
|
|||
|
||||
// ==================== 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 r1c2 = matrix2->r1c2;
|
||||
|
@ -89,7 +89,7 @@ inline void bgc_matrix2x3_swap_fp32(bgc_matrix2x3_fp32_t* matrix1, bgc_matrix2x3
|
|||
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 r1c2 = matrix2->r1c2;
|
||||
|
@ -121,7 +121,7 @@ inline void bgc_matrix2x3_swap_fp64(bgc_matrix2x3_fp64_t* matrix1, bgc_matrix2x3
|
|||
|
||||
// ============= 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r1c2;
|
||||
|
@ -147,7 +147,7 @@ inline void bgc_matrix2x3_convert_fp32_to_fp64(const bgc_matrix2x3_fp32_t* from,
|
|||
|
||||
// =============== 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->r1c2 = from->r2c1;
|
||||
|
@ -159,7 +159,7 @@ inline void bgc_matrix2x3_set_transposed_fp32(const bgc_matrix3x2_fp32_t* from,
|
|||
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->r1c2 = from->r2c1;
|
||||
|
@ -173,7 +173,7 @@ inline void bgc_matrix2x3_set_transposed_fp64(const bgc_matrix3x2_fp64_t* from,
|
|||
|
||||
// =============== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r2c1;
|
||||
|
@ -199,13 +199,13 @@ inline void bgc_matrix2x3_set_transposed_fp64_fp32(const bgc_matrix3x2_fp32_t* f
|
|||
|
||||
// ================= 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->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->r1c2 = c2;
|
||||
|
@ -213,13 +213,13 @@ inline void bgc_matrix2x3_set_row1_fp64(const double c1, const double c2, bgc_ma
|
|||
|
||||
// ================= 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->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->r2c2 = c2;
|
||||
|
@ -227,13 +227,13 @@ inline void bgc_matrix2x3_set_row2_fp64(const double c1, const double c2, bgc_ma
|
|||
|
||||
// ================= 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->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->r3c2 = c2;
|
||||
|
@ -241,14 +241,14 @@ inline void bgc_matrix2x3_set_row3_fp64(const double c1, const double c2, bgc_ma
|
|||
|
||||
// ================ 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->r2c1 = r2;
|
||||
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->r2c1 = r2;
|
||||
|
@ -257,14 +257,14 @@ inline void bgc_matrix2x3_set_column1_fp64(const double r1, const double r2, con
|
|||
|
||||
// ================ 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->r2c2 = r2;
|
||||
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->r2c2 = r2;
|
||||
|
@ -273,7 +273,7 @@ inline void bgc_matrix2x3_set_column2_fp64(const double r1, const double r2, con
|
|||
|
||||
// ================== 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->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;
|
||||
}
|
||||
|
||||
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->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 ================= //
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
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->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 ================= //
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -351,7 +351,7 @@ inline void bgc_matrix2x3_subtract_fp64(const bgc_matrix2x3_fp64_t* minuend, con
|
|||
|
||||
// =============== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -377,25 +377,25 @@ inline void bgc_matrix2x3_multiply_fp64(const bgc_matrix2x3_fp64_t* multiplicand
|
|||
|
||||
// ================== 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// ============ 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->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->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 ============ //
|
||||
|
||||
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->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * 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->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
// =================== 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->r1c2 = 0.0f;
|
||||
|
@ -18,7 +18,7 @@ inline void bgc_matrix3x2_reset_fp32(bgc_matrix3x2_fp32_t* matrix)
|
|||
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->r1c2 = 0.0;
|
||||
|
@ -31,7 +31,7 @@ inline void bgc_matrix3x2_reset_fp64(bgc_matrix3x2_fp64_t* matrix)
|
|||
|
||||
// ==================== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r1c2;
|
||||
|
@ -55,7 +55,7 @@ inline void bgc_matrix3x2_copy_fp64(const bgc_matrix3x2_fp64_t* from, bgc_matrix
|
|||
|
||||
// ==================== 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 r1c2 = matrix2->r1c2;
|
||||
|
@ -82,7 +82,7 @@ inline void bgc_matrix3x2_swap_fp32(bgc_matrix3x2_fp32_t* matrix1, bgc_matrix3x2
|
|||
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 r1c2 = matrix2->r1c2;
|
||||
|
@ -111,7 +111,7 @@ inline void bgc_matrix3x2_swap_fp64(bgc_matrix3x2_fp64_t* matrix1, bgc_matrix3x2
|
|||
|
||||
// ============= 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r1c2;
|
||||
|
@ -135,7 +135,7 @@ inline void bgc_matrix3x2_convert_fp32_to_fp64(const bgc_matrix3x2_fp32_t* from,
|
|||
|
||||
// =============== 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->r1c2 = from->r2c1;
|
||||
|
@ -146,7 +146,7 @@ inline void bgc_matrix3x2_set_transposed_fp32(const bgc_matrix2x3_fp32_t* from,
|
|||
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->r1c2 = from->r2c1;
|
||||
|
@ -159,7 +159,7 @@ inline void bgc_matrix3x2_set_transposed_fp64(const bgc_matrix2x3_fp64_t* from,
|
|||
|
||||
// =============== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r2c1;
|
||||
|
@ -183,14 +183,14 @@ inline void bgc_matrix3x2_set_transposed_fp64_fp32(const bgc_matrix2x3_fp32_t* f
|
|||
|
||||
// ================= 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->r1c2 = c2;
|
||||
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->r1c2 = c2;
|
||||
|
@ -199,14 +199,14 @@ inline void bgc_matrix3x2_set_row1_fp64(const double c1, const double c2, const
|
|||
|
||||
// ================= 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->r2c2 = c2;
|
||||
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->r2c2 = c2;
|
||||
|
@ -215,13 +215,13 @@ inline void bgc_matrix3x2_set_row2_fp64(const double c1, const double c2, const
|
|||
|
||||
// ================ 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->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->r2c1 = r2;
|
||||
|
@ -229,13 +229,13 @@ inline void bgc_matrix3x2_set_column1_fp64(const double r1, const double r2, bgc
|
|||
|
||||
// ================ 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->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->r2c2 = r2;
|
||||
|
@ -243,13 +243,13 @@ inline void bgc_matrix3x2_set_column2_fp64(const double r1, const double r2, bgc
|
|||
|
||||
// ================ 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->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->r2c3 = r2;
|
||||
|
@ -257,7 +257,7 @@ inline void bgc_matrix3x2_set_column3_fp64(const double r1, const double r2, bgc
|
|||
|
||||
// ================== 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->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;
|
||||
}
|
||||
|
||||
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->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 ================= //
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
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->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 ================= //
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -329,7 +329,7 @@ inline void bgc_matrix3x2_subtract_fp64(const bgc_matrix3x2_fp64_t* minuend, con
|
|||
|
||||
// =============== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -353,26 +353,26 @@ inline void bgc_matrix3x2_multiply_fp64(const bgc_matrix3x2_fp64_t* multiplicand
|
|||
|
||||
// ================== 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// ============ 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->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2;
|
||||
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->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 ============ //
|
||||
|
||||
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->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->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// ================= 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);
|
||||
|
||||
|
@ -39,7 +39,7 @@ int bgc_matrix3x3_invert_fp32(bgc_matrix3x3_fp32_t* matrix)
|
|||
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);
|
||||
|
||||
|
@ -78,7 +78,7 @@ int bgc_matrix3x3_invert_fp64(bgc_matrix3x3_fp64_t* matrix)
|
|||
|
||||
// ================ 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);
|
||||
|
||||
|
@ -115,7 +115,7 @@ int bgc_matrix3x3_set_inverted_fp32(const bgc_matrix3x3_fp32_t* matrix, bgc_matr
|
|||
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);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
// =================== 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->r1c2 = 0.0f;
|
||||
|
@ -21,7 +21,7 @@ inline void bgc_matrix3x3_reset_fp32(bgc_matrix3x3_fp32_t* matrix)
|
|||
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->r1c2 = 0.0;
|
||||
|
@ -38,7 +38,7 @@ inline void bgc_matrix3x3_reset_fp64(bgc_matrix3x3_fp64_t* matrix)
|
|||
|
||||
// ================== 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->r1c2 = 0.0f;
|
||||
|
@ -53,7 +53,7 @@ inline void bgc_matrix3x3_set_to_identity_fp32(bgc_matrix3x3_fp32_t* matrix)
|
|||
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->r1c2 = 0.0;
|
||||
|
@ -70,7 +70,7 @@ inline void bgc_matrix3x3_set_to_identity_fp64(bgc_matrix3x3_fp64_t* matrix)
|
|||
|
||||
// ================ 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = 0.0;
|
||||
|
@ -102,7 +102,7 @@ inline void bgc_matrix3x3_set_to_diagonal_fp64(const double d1, const double d2,
|
|||
|
||||
// ==================== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r1c2;
|
||||
|
@ -134,7 +134,7 @@ inline void bgc_matrix3x3_copy_fp64(const bgc_matrix3x3_fp64_t* from, bgc_matrix
|
|||
|
||||
// ==================== 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 r1c2 = matrix2->r1c2;
|
||||
|
@ -173,7 +173,7 @@ inline void bgc_matrix3x3_swap_fp32(bgc_matrix3x3_fp32_t* matrix1, bgc_matrix3x3
|
|||
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 r1c2 = matrix2->r1c2;
|
||||
|
@ -214,7 +214,7 @@ inline void bgc_matrix3x3_swap_fp64(bgc_matrix3x3_fp64_t* matrix1, bgc_matrix3x3
|
|||
|
||||
// ============= 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = from->r1c2;
|
||||
|
@ -246,14 +246,14 @@ inline void bgc_matrix3x3_convert_fp32_to_fp64(const bgc_matrix3x3_fp32_t* from,
|
|||
|
||||
// ================ 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)
|
||||
+ matrix->r1c2 * (matrix->r2c3 * matrix->r3c1 - matrix->r2c1 * matrix->r3c3)
|
||||
+ 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)
|
||||
+ 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 ================== //
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -278,13 +278,13 @@ inline int bgc_matrix3x3_is_singular_fp64(const bgc_matrix3x3_fp64_t* matrix)
|
|||
|
||||
// ================= 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 ================ //
|
||||
|
||||
inline void bgc_matrix3x3_transpose_fp32(bgc_matrix3x3_fp32_t* matrix)
|
||||
inline void bgc_matrix3x3_transpose_fp32(BgcMatrix3x3FP32* matrix)
|
||||
{
|
||||
float tmp = matrix->r1c2;
|
||||
matrix->r1c2 = matrix->r2c1;
|
||||
|
@ -299,7 +299,7 @@ inline void bgc_matrix3x3_transpose_fp32(bgc_matrix3x3_fp32_t* matrix)
|
|||
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;
|
||||
matrix->r1c2 = matrix->r2c1;
|
||||
|
@ -316,13 +316,13 @@ inline void bgc_matrix3x3_transpose_fp64(bgc_matrix3x3_fp64_t* matrix)
|
|||
|
||||
// ================ 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 ============== //
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
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 ================== //
|
||||
|
||||
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->r1c2 = c2;
|
||||
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->r1c2 = c2;
|
||||
|
@ -380,14 +380,14 @@ inline void bgc_matrix3x3_set_row1_fp64(const double c1, const double c2, const
|
|||
|
||||
// ================= 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->r2c2 = c2;
|
||||
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->r2c2 = c2;
|
||||
|
@ -396,14 +396,14 @@ inline void bgc_matrix3x3_set_row2_fp64(const double c1, const double c2, const
|
|||
|
||||
// ================= 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->r3c2 = c2;
|
||||
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->r3c2 = c2;
|
||||
|
@ -412,14 +412,14 @@ inline void bgc_matrix3x3_set_row3_fp64(const double c1, const double c2, const
|
|||
|
||||
// ================ 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->r2c1 = r2;
|
||||
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->r2c1 = r2;
|
||||
|
@ -428,14 +428,14 @@ inline void bgc_matrix3x3_set_column1_fp64(const double r1, const double r2, con
|
|||
|
||||
// ================ 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->r2c2 = r2;
|
||||
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->r2c2 = r2;
|
||||
|
@ -444,14 +444,14 @@ inline void bgc_matrix3x3_set_column2_fp64(const double r1, const double r2, con
|
|||
|
||||
// ================ 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->r2c3 = r2;
|
||||
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->r2c3 = r2;
|
||||
|
@ -460,7 +460,7 @@ inline void bgc_matrix3x3_set_column3_fp64(const double r1, const double r2, con
|
|||
|
||||
// ================== 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->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;
|
||||
}
|
||||
|
||||
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->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 ================= //
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
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->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 ================= //
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = minuend->r1c2 - subtrahend->r1c2;
|
||||
|
@ -556,7 +556,7 @@ inline void bgc_matrix3x3_subtract_fp64(const bgc_matrix3x3_fp64_t* minuend, con
|
|||
|
||||
// =============== 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->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;
|
||||
}
|
||||
|
||||
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->r1c2 = multiplicand->r1c2 * multiplier;
|
||||
|
@ -588,19 +588,19 @@ inline void bgc_matrix3x3_multiply_fp64(const bgc_matrix3x3_fp64_t* multiplicand
|
|||
|
||||
// ================== 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// ============ 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 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;
|
||||
}
|
||||
|
||||
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 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 ============ //
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
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 x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2 + matrix->r2c3 * vector->x3;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// ========== 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 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;
|
||||
}
|
||||
|
||||
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 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 ========= //
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
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 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 ========= //
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
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)
|
||||