Переход на парадигму Destination first в порядке параметров функий
This commit is contained in:
parent
f7e41645fe
commit
03627f4401
41 changed files with 1570 additions and 1978 deletions
|
|
@ -62,7 +62,7 @@ void _bgc_fp32_versor_normalize(BGC_FP32_Versor* twin);
|
|||
|
||||
void _bgc_fp64_versor_normalize(BGC_FP64_Versor* twin);
|
||||
|
||||
inline void bgc_fp32_versor_make(const float s0, const float x1, const float x2, const float x3, BGC_FP32_Versor* versor)
|
||||
inline void bgc_fp32_versor_make(BGC_FP32_Versor* versor, const float s0, const float x1, const float x2, const float x3)
|
||||
{
|
||||
versor->_s0 = s0;
|
||||
versor->_x1 = x1;
|
||||
|
|
@ -76,7 +76,7 @@ inline void bgc_fp32_versor_make(const float s0, const float x1, const float x2,
|
|||
}
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_make(const double s0, const double x1, const double x2, const double x3, BGC_FP64_Versor* versor)
|
||||
inline void bgc_fp64_versor_make(BGC_FP64_Versor* versor, const double s0, const double x1, const double x2, const double x3)
|
||||
{
|
||||
versor->_s0 = s0;
|
||||
versor->_x1 = x1;
|
||||
|
|
@ -92,49 +92,49 @@ inline void bgc_fp64_versor_make(const double s0, const double x1, const double
|
|||
|
||||
// ================== Set Turn ================== //
|
||||
|
||||
void bgc_fp32_versor_make_for_turn(const float x1, const float x2, const float x3, const float angle, const int unit, BGC_FP32_Versor* result);
|
||||
void bgc_fp32_versor_make_for_turn(BGC_FP32_Versor* versor, const float x1, const float x2, const float x3, const float angle, const int unit);
|
||||
|
||||
void bgc_fp64_versor_make_for_turn(const double x1, const double x2, const double x3, const double angle, const int unit, BGC_FP64_Versor* result);
|
||||
void bgc_fp64_versor_make_for_turn(BGC_FP64_Versor* versor, const double x1, const double x2, const double x3, const double angle, const int unit);
|
||||
|
||||
// ================ Set Rotation ================ //
|
||||
|
||||
inline void bgc_fp32_versor_make_for_rotation(const BGC_FP32_Rotation3* rotation, BGC_FP32_Versor* result)
|
||||
inline void bgc_fp32_versor_make_for_rotation(BGC_FP32_Versor* versor, const BGC_FP32_Rotation3* rotation)
|
||||
{
|
||||
bgc_fp32_versor_make_for_turn(rotation->axis.x1, rotation->axis.x2, rotation->axis.x3, rotation->radians, BGC_ANGLE_UNIT_RADIANS, result);
|
||||
bgc_fp32_versor_make_for_turn(versor, rotation->axis.x1, rotation->axis.x2, rotation->axis.x3, rotation->radians, BGC_ANGLE_UNIT_RADIANS);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_make_for_rotation(const BGC_FP64_Rotation3* rotation, BGC_FP64_Versor* result)
|
||||
inline void bgc_fp64_versor_make_for_rotation(BGC_FP64_Versor* versor, const BGC_FP64_Rotation3* rotation)
|
||||
{
|
||||
bgc_fp64_versor_make_for_turn(rotation->axis.x1, rotation->axis.x2, rotation->axis.x3, rotation->radians, BGC_ANGLE_UNIT_RADIANS, result);
|
||||
bgc_fp64_versor_make_for_turn(versor, rotation->axis.x1, rotation->axis.x2, rotation->axis.x3, rotation->radians, BGC_ANGLE_UNIT_RADIANS);
|
||||
}
|
||||
|
||||
// ========= Make Direction Difference ========== //
|
||||
|
||||
int bgc_fp32_versor_make_direction_difference(const BGC_FP32_Vector3* start, const BGC_FP32_Vector3* end, BGC_FP32_Versor* result);
|
||||
int bgc_fp32_versor_make_direction_difference(BGC_FP32_Versor* difference, const BGC_FP32_Vector3* start, const BGC_FP32_Vector3* end);
|
||||
|
||||
int bgc_fp64_versor_make_direction_difference(const BGC_FP64_Vector3* start, const BGC_FP64_Vector3* end, BGC_FP64_Versor* result);
|
||||
int bgc_fp64_versor_make_direction_difference(BGC_FP64_Versor* difference, const BGC_FP64_Vector3* start, const BGC_FP64_Vector3* end);
|
||||
|
||||
// =============== Set Directions =============== //
|
||||
|
||||
int bgc_fp32_versor_make_basis_difference(
|
||||
BGC_FP32_Versor* versor,
|
||||
const BGC_FP32_Vector3* initial_primary_direction,
|
||||
const BGC_FP32_Vector3* initial_auxiliary_direction,
|
||||
const BGC_FP32_Vector3* final_primary_direction,
|
||||
const BGC_FP32_Vector3* final_auxiliary_direction,
|
||||
BGC_FP32_Versor* result
|
||||
const BGC_FP32_Vector3* final_auxiliary_direction
|
||||
);
|
||||
|
||||
int bgc_fp64_versor_make_basis_difference(
|
||||
BGC_FP64_Versor* versor,
|
||||
const BGC_FP64_Vector3* initial_primary_direction,
|
||||
const BGC_FP64_Vector3* initial_auxiliary_direction,
|
||||
const BGC_FP64_Vector3* final_primary_direction,
|
||||
const BGC_FP64_Vector3* final_auxiliary_direction,
|
||||
BGC_FP64_Versor* result
|
||||
const BGC_FP64_Vector3* final_auxiliary_direction
|
||||
);
|
||||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_versor_copy(const BGC_FP32_Versor* source, BGC_FP32_Versor* destination)
|
||||
inline void bgc_fp32_versor_copy(BGC_FP32_Versor* destination, const BGC_FP32_Versor* source)
|
||||
{
|
||||
destination->_s0 = source->_s0;
|
||||
destination->_x1 = source->_x1;
|
||||
|
|
@ -142,7 +142,7 @@ inline void bgc_fp32_versor_copy(const BGC_FP32_Versor* source, BGC_FP32_Versor*
|
|||
destination->_x3 = source->_x3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_copy(const BGC_FP64_Versor* source, BGC_FP64_Versor* destination)
|
||||
inline void bgc_fp64_versor_copy(BGC_FP64_Versor* destination, const BGC_FP64_Versor* source)
|
||||
{
|
||||
destination->_s0 = source->_s0;
|
||||
destination->_x1 = source->_x1;
|
||||
|
|
@ -202,25 +202,25 @@ inline int bgc_fp64_versor_is_idle(const BGC_FP64_Versor* versor)
|
|||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_versor_convert_to_fp32(const BGC_FP64_Versor* source, BGC_FP32_Versor* destination)
|
||||
{
|
||||
bgc_fp32_versor_make(
|
||||
(float)source->_s0,
|
||||
(float)source->_x1,
|
||||
(float)source->_x2,
|
||||
(float)source->_x3,
|
||||
destination
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp32_versor_convert_to_fp64(const BGC_FP32_Versor* source, BGC_FP64_Versor* destination)
|
||||
inline void bgc_fp32_versor_convert_to_fp64(BGC_FP64_Versor* destination, const BGC_FP32_Versor* source)
|
||||
{
|
||||
bgc_fp64_versor_make(
|
||||
destination,
|
||||
source->_s0,
|
||||
source->_x1,
|
||||
source->_x2,
|
||||
source->_x3,
|
||||
destination
|
||||
source->_x3
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_convert_to_fp32(BGC_FP32_Versor* destination, const BGC_FP64_Versor* source)
|
||||
{
|
||||
bgc_fp32_versor_make(
|
||||
destination,
|
||||
(float)source->_s0,
|
||||
(float)source->_x1,
|
||||
(float)source->_x2,
|
||||
(float)source->_x3
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ inline void bgc_fp64_versor_shorten(BGC_FP64_Versor* versor)
|
|||
}
|
||||
}
|
||||
|
||||
inline void bgc_fp32_versor_get_shortened(const BGC_FP32_Versor* versor, BGC_FP32_Versor* shortened)
|
||||
inline void bgc_fp32_versor_get_shortened(BGC_FP32_Versor* shortened, const BGC_FP32_Versor* versor)
|
||||
{
|
||||
if (versor->_s0 >= 0.0f) {
|
||||
shortened->_s0 = versor->_s0;
|
||||
|
|
@ -262,7 +262,7 @@ inline void bgc_fp32_versor_get_shortened(const BGC_FP32_Versor* versor, BGC_FP3
|
|||
shortened->_x3 = -versor->_x3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_get_shortened(const BGC_FP64_Versor* versor, BGC_FP64_Versor* shortened)
|
||||
inline void bgc_fp64_versor_get_shortened(BGC_FP64_Versor* shortened, const BGC_FP64_Versor* versor)
|
||||
{
|
||||
if (versor->_s0 >= 0.0) {
|
||||
shortened->_s0 = versor->_s0;
|
||||
|
|
@ -296,20 +296,20 @@ inline void bgc_fp64_versor_alternate(BGC_FP64_Versor* versor)
|
|||
versor->_x3 = -versor->_x3;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_versor_get_alternative(const BGC_FP32_Versor* versor, BGC_FP32_Versor* opposite)
|
||||
inline void bgc_fp32_versor_get_alternative(BGC_FP32_Versor* alternative, const BGC_FP32_Versor* versor)
|
||||
{
|
||||
opposite->_s0 = -versor->_s0;
|
||||
opposite->_x1 = -versor->_x1;
|
||||
opposite->_x2 = -versor->_x2;
|
||||
opposite->_x3 = -versor->_x3;
|
||||
alternative->_s0 = -versor->_s0;
|
||||
alternative->_x1 = -versor->_x1;
|
||||
alternative->_x2 = -versor->_x2;
|
||||
alternative->_x3 = -versor->_x3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_get_alternative(const BGC_FP64_Versor* versor, BGC_FP64_Versor* opposite)
|
||||
inline void bgc_fp64_versor_get_alternative(BGC_FP64_Versor* alternative, const BGC_FP64_Versor* versor)
|
||||
{
|
||||
opposite->_s0 = -versor->_s0;
|
||||
opposite->_x1 = -versor->_x1;
|
||||
opposite->_x2 = -versor->_x2;
|
||||
opposite->_x3 = -versor->_x3;
|
||||
alternative->_s0 = -versor->_s0;
|
||||
alternative->_x1 = -versor->_x1;
|
||||
alternative->_x2 = -versor->_x2;
|
||||
alternative->_x3 = -versor->_x3;
|
||||
}
|
||||
|
||||
// =================== Invert =================== //
|
||||
|
|
@ -328,7 +328,7 @@ inline void bgc_fp64_versor_revert(BGC_FP64_Versor* versor)
|
|||
versor->_x3 = -versor->_x3;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_versor_get_reverse(const BGC_FP32_Versor* versor, BGC_FP32_Versor* inverse)
|
||||
inline void bgc_fp32_versor_get_reverse(BGC_FP32_Versor* inverse, const BGC_FP32_Versor* versor)
|
||||
{
|
||||
inverse->_s0 = versor->_s0;
|
||||
inverse->_x1 = -versor->_x1;
|
||||
|
|
@ -336,7 +336,7 @@ inline void bgc_fp32_versor_get_reverse(const BGC_FP32_Versor* versor, BGC_FP32_
|
|||
inverse->_x3 = -versor->_x3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_get_reverse(const BGC_FP64_Versor* versor, BGC_FP64_Versor* inverse)
|
||||
inline void bgc_fp64_versor_get_reverse(BGC_FP64_Versor* inverse, const BGC_FP64_Versor* versor)
|
||||
{
|
||||
inverse->_s0 = versor->_s0;
|
||||
inverse->_x1 = -versor->_x1;
|
||||
|
|
@ -346,37 +346,37 @@ inline void bgc_fp64_versor_get_reverse(const BGC_FP64_Versor* versor, BGC_FP64_
|
|||
|
||||
// =============== Get Exponation =============== //
|
||||
|
||||
void bgc_fp32_versor_get_exponation(const BGC_FP32_Versor* base, const float exponent, BGC_FP32_Versor* power);
|
||||
void bgc_fp32_versor_get_exponation(BGC_FP32_Versor* power, const BGC_FP32_Versor* base, const float exponent);
|
||||
|
||||
void bgc_fp64_versor_get_exponation(const BGC_FP64_Versor* base, const double exponent, BGC_FP64_Versor* power);
|
||||
void bgc_fp64_versor_get_exponation(BGC_FP64_Versor* power, const BGC_FP64_Versor* base, const double exponent);
|
||||
|
||||
// ================ Combination ================= //
|
||||
|
||||
inline void bgc_fp32_versor_combine(const BGC_FP32_Versor* first, const BGC_FP32_Versor* second, BGC_FP32_Versor* result)
|
||||
inline void bgc_fp32_versor_combine(BGC_FP32_Versor* combination, const BGC_FP32_Versor* first, const BGC_FP32_Versor* second)
|
||||
{
|
||||
bgc_fp32_versor_make(
|
||||
combination,
|
||||
(second->_s0 * first->_s0 - second->_x1 * first->_x1) - (second->_x2 * first->_x2 + second->_x3 * first->_x3),
|
||||
(second->_x1 * first->_s0 + second->_s0 * first->_x1) - (second->_x3 * first->_x2 - second->_x2 * first->_x3),
|
||||
(second->_x2 * first->_s0 + second->_s0 * first->_x2) - (second->_x1 * first->_x3 - second->_x3 * first->_x1),
|
||||
(second->_x3 * first->_s0 + second->_s0 * first->_x3) - (second->_x2 * first->_x1 - second->_x1 * first->_x2),
|
||||
result
|
||||
(second->_x3 * first->_s0 + second->_s0 * first->_x3) - (second->_x2 * first->_x1 - second->_x1 * first->_x2)
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_combine(const BGC_FP64_Versor* first, const BGC_FP64_Versor* second, BGC_FP64_Versor* result)
|
||||
inline void bgc_fp64_versor_combine(BGC_FP64_Versor* combination, const BGC_FP64_Versor* first, const BGC_FP64_Versor* second)
|
||||
{
|
||||
bgc_fp64_versor_make(
|
||||
combination,
|
||||
(second->_s0 * first->_s0 - second->_x1 * first->_x1) - (second->_x2 * first->_x2 + second->_x3 * first->_x3),
|
||||
(second->_x1 * first->_s0 + second->_s0 * first->_x1) - (second->_x3 * first->_x2 - second->_x2 * first->_x3),
|
||||
(second->_x2 * first->_s0 + second->_s0 * first->_x2) - (second->_x1 * first->_x3 - second->_x3 * first->_x1),
|
||||
(second->_x3 * first->_s0 + second->_s0 * first->_x3) - (second->_x2 * first->_x1 - second->_x1 * first->_x2),
|
||||
result
|
||||
(second->_x3 * first->_s0 + second->_s0 * first->_x3) - (second->_x2 * first->_x1 - second->_x1 * first->_x2)
|
||||
);
|
||||
}
|
||||
|
||||
// ============ Combination of three ============ //
|
||||
|
||||
inline void bgc_fp32_versor_combine3(const BGC_FP32_Versor* first, const BGC_FP32_Versor* second, const BGC_FP32_Versor* third, BGC_FP32_Versor* result)
|
||||
inline void bgc_fp32_versor_combine3(BGC_FP32_Versor* combination, const BGC_FP32_Versor* first, const BGC_FP32_Versor* second, const BGC_FP32_Versor* third)
|
||||
{
|
||||
const float s0 = (second->_s0 * first->_s0 - second->_x1 * first->_x1) - (second->_x2 * first->_x2 + second->_x3 * first->_x3);
|
||||
const float x1 = (second->_x1 * first->_s0 + second->_s0 * first->_x1) - (second->_x3 * first->_x2 - second->_x2 * first->_x3);
|
||||
|
|
@ -384,15 +384,15 @@ inline void bgc_fp32_versor_combine3(const BGC_FP32_Versor* first, const BGC_FP3
|
|||
const float x3 = (second->_x3 * first->_s0 + second->_s0 * first->_x3) - (second->_x2 * first->_x1 - second->_x1 * first->_x2);
|
||||
|
||||
bgc_fp32_versor_make(
|
||||
combination,
|
||||
(third->_s0 * s0 - third->_x1 * x1) - (third->_x2 * x2 + third->_x3 * x3),
|
||||
(third->_x1 * s0 + third->_s0 * x1) - (third->_x3 * x2 - third->_x2 * x3),
|
||||
(third->_x2 * s0 + third->_s0 * x2) - (third->_x1 * x3 - third->_x3 * x1),
|
||||
(third->_x3 * s0 + third->_s0 * x3) - (third->_x2 * x1 - third->_x1 * x2),
|
||||
result
|
||||
(third->_x3 * s0 + third->_s0 * x3) - (third->_x2 * x1 - third->_x1 * x2)
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_combine3(const BGC_FP64_Versor* first, const BGC_FP64_Versor* second, const BGC_FP64_Versor* third, BGC_FP64_Versor* result)
|
||||
inline void bgc_fp64_versor_combine3(BGC_FP64_Versor* combination, const BGC_FP64_Versor* first, const BGC_FP64_Versor* second, const BGC_FP64_Versor* third)
|
||||
{
|
||||
const double s0 = (second->_s0 * first->_s0 - second->_x1 * first->_x1) - (second->_x2 * first->_x2 + second->_x3 * first->_x3);
|
||||
const double x1 = (second->_x1 * first->_s0 + second->_s0 * first->_x1) - (second->_x3 * first->_x2 - second->_x2 * first->_x3);
|
||||
|
|
@ -400,53 +400,53 @@ inline void bgc_fp64_versor_combine3(const BGC_FP64_Versor* first, const BGC_FP6
|
|||
const double x3 = (second->_x3 * first->_s0 + second->_s0 * first->_x3) - (second->_x2 * first->_x1 - second->_x1 * first->_x2);
|
||||
|
||||
bgc_fp64_versor_make(
|
||||
combination,
|
||||
(third->_s0 * s0 - third->_x1 * x1) - (third->_x2 * x2 + third->_x3 * x3),
|
||||
(third->_x1 * s0 + third->_s0 * x1) - (third->_x3 * x2 - third->_x2 * x3),
|
||||
(third->_x2 * s0 + third->_s0 * x2) - (third->_x1 * x3 - third->_x3 * x1),
|
||||
(third->_x3 * s0 + third->_s0 * x3) - (third->_x2 * x1 - third->_x1 * x2),
|
||||
result
|
||||
(third->_x3 * s0 + third->_s0 * x3) - (third->_x2 * x1 - third->_x1 * x2)
|
||||
);
|
||||
}
|
||||
|
||||
// ================= Exclusion ================== //
|
||||
|
||||
inline void bgc_fp32_versor_exclude(const BGC_FP32_Versor* base, const BGC_FP32_Versor* excludant, BGC_FP32_Versor* difference)
|
||||
inline void bgc_fp32_versor_exclude(BGC_FP32_Versor* difference, const BGC_FP32_Versor* base, const BGC_FP32_Versor* excludant)
|
||||
{
|
||||
bgc_fp32_versor_make(
|
||||
difference,
|
||||
(base->_s0 * excludant->_s0 + base->_x1 * excludant->_x1) + (base->_x2 * excludant->_x2 + base->_x3 * excludant->_x3),
|
||||
(base->_x1 * excludant->_s0 + base->_x3 * excludant->_x2) - (base->_s0 * excludant->_x1 + base->_x2 * excludant->_x3),
|
||||
(base->_x2 * excludant->_s0 + base->_x1 * excludant->_x3) - (base->_s0 * excludant->_x2 + base->_x3 * excludant->_x1),
|
||||
(base->_x3 * excludant->_s0 + base->_x2 * excludant->_x1) - (base->_s0 * excludant->_x3 + base->_x1 * excludant->_x2),
|
||||
difference
|
||||
(base->_x3 * excludant->_s0 + base->_x2 * excludant->_x1) - (base->_s0 * excludant->_x3 + base->_x1 * excludant->_x2)
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_exclude(const BGC_FP64_Versor* base, const BGC_FP64_Versor* excludant, BGC_FP64_Versor* difference)
|
||||
inline void bgc_fp64_versor_exclude(BGC_FP64_Versor* difference, const BGC_FP64_Versor* base, const BGC_FP64_Versor* excludant)
|
||||
{
|
||||
bgc_fp64_versor_make(
|
||||
difference,
|
||||
(base->_s0 * excludant->_s0 + base->_x1 * excludant->_x1) + (base->_x2 * excludant->_x2 + base->_x3 * excludant->_x3),
|
||||
(base->_x1 * excludant->_s0 + base->_x3 * excludant->_x2) - (base->_s0 * excludant->_x1 + base->_x2 * excludant->_x3),
|
||||
(base->_x2 * excludant->_s0 + base->_x1 * excludant->_x3) - (base->_s0 * excludant->_x2 + base->_x3 * excludant->_x1),
|
||||
(base->_x3 * excludant->_s0 + base->_x2 * excludant->_x1) - (base->_s0 * excludant->_x3 + base->_x1 * excludant->_x2),
|
||||
difference
|
||||
(base->_x3 * excludant->_s0 + base->_x2 * excludant->_x1) - (base->_s0 * excludant->_x3 + base->_x1 * excludant->_x2)
|
||||
);
|
||||
}
|
||||
|
||||
// ============ Sphere Interpolation ============ //
|
||||
|
||||
void bgc_fp32_versor_spherically_interpolate(const BGC_FP32_Versor* start, const BGC_FP32_Versor* end, const float phase, BGC_FP32_Versor* result);
|
||||
void bgc_fp32_versor_spherically_interpolate(BGC_FP32_Versor* interpolation, const BGC_FP32_Versor* start, const BGC_FP32_Versor* end, const float phase);
|
||||
|
||||
void bgc_fp64_versor_spherically_interpolate(const BGC_FP64_Versor* start, const BGC_FP64_Versor* end, const double phase, BGC_FP64_Versor* result);
|
||||
void bgc_fp64_versor_spherically_interpolate(BGC_FP64_Versor* interpolation, const BGC_FP64_Versor* start, const BGC_FP64_Versor* end, const double phase);
|
||||
|
||||
// ================ Get Rotation ================ //
|
||||
|
||||
void bgc_fp32_versor_get_rotation(const BGC_FP32_Versor* versor, BGC_FP32_Rotation3* result);
|
||||
void bgc_fp32_versor_get_rotation(BGC_FP32_Rotation3* rotation, const BGC_FP32_Versor* versor);
|
||||
|
||||
void bgc_fp64_versor_get_rotation(const BGC_FP64_Versor* versor, BGC_FP64_Rotation3* result);
|
||||
void bgc_fp64_versor_get_rotation(BGC_FP64_Rotation3* rotation, const BGC_FP64_Versor* versor);
|
||||
|
||||
// ============ Get Rotation Matrix ============= //
|
||||
|
||||
inline void bgc_fp32_versor_get_rotation_matrix(const BGC_FP32_Versor* versor, BGC_FP32_Matrix3x3* matrix)
|
||||
inline void bgc_fp32_versor_get_rotation_matrix(BGC_FP32_Matrix3x3* matrix, const BGC_FP32_Versor* versor)
|
||||
{
|
||||
const float s0s0 = versor->_s0 * versor->_s0;
|
||||
const float x1x1 = versor->_x1 * versor->_x1;
|
||||
|
|
@ -473,7 +473,7 @@ inline void bgc_fp32_versor_get_rotation_matrix(const BGC_FP32_Versor* versor, B
|
|||
matrix->r1c3 = 2.0f * (x1x3 + s0x2);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_get_rotation_matrix(const BGC_FP64_Versor* versor, BGC_FP64_Matrix3x3* matrix)
|
||||
inline void bgc_fp64_versor_get_rotation_matrix(BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Versor* versor)
|
||||
{
|
||||
const double s0s0 = versor->_s0 * versor->_s0;
|
||||
const double x1x1 = versor->_x1 * versor->_x1;
|
||||
|
|
@ -502,7 +502,7 @@ inline void bgc_fp64_versor_get_rotation_matrix(const BGC_FP64_Versor* versor, B
|
|||
|
||||
// ============= Get Reverse Matrix ============= //
|
||||
|
||||
inline void bgc_fp32_versor_get_reverse_matrix(const BGC_FP32_Versor* versor, BGC_FP32_Matrix3x3* matrix)
|
||||
inline void bgc_fp32_versor_get_reverse_matrix(BGC_FP32_Matrix3x3* matrix, const BGC_FP32_Versor* versor)
|
||||
{
|
||||
const float s0s0 = versor->_s0 * versor->_s0;
|
||||
const float x1x1 = versor->_x1 * versor->_x1;
|
||||
|
|
@ -529,7 +529,7 @@ inline void bgc_fp32_versor_get_reverse_matrix(const BGC_FP32_Versor* versor, BG
|
|||
matrix->r1c3 = 2.0f * (x1x3 - s0x2);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_get_reverse_matrix(const BGC_FP64_Versor* versor, BGC_FP64_Matrix3x3* matrix)
|
||||
inline void bgc_fp64_versor_get_reverse_matrix(BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Versor* versor)
|
||||
{
|
||||
const double s0s0 = versor->_s0 * versor->_s0;
|
||||
const double x1x1 = versor->_x1 * versor->_x1;
|
||||
|
|
@ -558,21 +558,21 @@ inline void bgc_fp64_versor_get_reverse_matrix(const BGC_FP64_Versor* versor, BG
|
|||
|
||||
// ============= Get Both Matrixes ============== //
|
||||
|
||||
inline void bgc_fp32_versor_get_both_matrices(const BGC_FP32_Versor* versor, BGC_FP32_Matrix3x3* rotation, BGC_FP32_Matrix3x3* reverse)
|
||||
inline void bgc_fp32_versor_get_both_matrices(BGC_FP32_Matrix3x3* rotation, BGC_FP32_Matrix3x3* reverse, const BGC_FP32_Versor* versor)
|
||||
{
|
||||
bgc_fp32_versor_get_reverse_matrix(versor, reverse);
|
||||
bgc_fp32_matrix3x3_get_transposed(reverse, rotation);
|
||||
bgc_fp32_versor_get_reverse_matrix(reverse, versor);
|
||||
bgc_fp32_matrix3x3_get_transposed(rotation, reverse);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_get_both_matrices(const BGC_FP64_Versor* versor, BGC_FP64_Matrix3x3* rotation, BGC_FP64_Matrix3x3* reverse)
|
||||
inline void bgc_fp64_versor_get_both_matrices(BGC_FP64_Matrix3x3* rotation, BGC_FP64_Matrix3x3* reverse, const BGC_FP64_Versor* versor)
|
||||
{
|
||||
bgc_fp64_versor_get_reverse_matrix(versor, reverse);
|
||||
bgc_fp64_matrix3x3_get_transposed(reverse, rotation);
|
||||
bgc_fp64_versor_get_reverse_matrix(reverse, versor);
|
||||
bgc_fp64_matrix3x3_get_transposed(rotation, reverse);
|
||||
}
|
||||
|
||||
// ================ Turn Vector ================= //
|
||||
|
||||
inline void bgc_fp32_versor_turn_vector(const BGC_FP32_Versor* versor, const BGC_FP32_Vector3* vector, BGC_FP32_Vector3* result)
|
||||
inline void bgc_fp32_versor_turn_vector(BGC_FP32_Vector3* turned_vector, const BGC_FP32_Versor* versor, const BGC_FP32_Vector3* vector)
|
||||
{
|
||||
const float tx1 = 2.0f * (versor->_x2 * vector->x3 - versor->_x3 * vector->x2);
|
||||
const float tx2 = 2.0f * (versor->_x3 * vector->x1 - versor->_x1 * vector->x3);
|
||||
|
|
@ -582,12 +582,12 @@ inline void bgc_fp32_versor_turn_vector(const BGC_FP32_Versor* versor, const BGC
|
|||
const float x2 = (vector->x2 + tx2 * versor->_s0) + (versor->_x3 * tx1 - versor->_x1 * tx3);
|
||||
const float x3 = (vector->x3 + tx3 * versor->_s0) + (versor->_x1 * tx2 - versor->_x2 * tx1);
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
result->x3 = x3;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
turned_vector->x3 = x3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_turn_vector(const BGC_FP64_Versor* versor, const BGC_FP64_Vector3* vector, BGC_FP64_Vector3* result)
|
||||
inline void bgc_fp64_versor_turn_vector(BGC_FP64_Vector3* turned_vector, const BGC_FP64_Versor* versor, const BGC_FP64_Vector3* vector)
|
||||
{
|
||||
const double tx1 = 2.0 * (versor->_x2 * vector->x3 - versor->_x3 * vector->x2);
|
||||
const double tx2 = 2.0 * (versor->_x3 * vector->x1 - versor->_x1 * vector->x3);
|
||||
|
|
@ -597,14 +597,14 @@ inline void bgc_fp64_versor_turn_vector(const BGC_FP64_Versor* versor, const BGC
|
|||
const double x2 = (vector->x2 + tx2 * versor->_s0) + (versor->_x3 * tx1 - versor->_x1 * tx3);
|
||||
const double x3 = (vector->x3 + tx3 * versor->_s0) + (versor->_x1 * tx2 - versor->_x2 * tx1);
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
result->x3 = x3;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
turned_vector->x3 = x3;
|
||||
}
|
||||
|
||||
// ============== Turn Vector Back ============== //
|
||||
|
||||
inline void bgc_fp32_versor_turn_vector_back(const BGC_FP32_Versor* versor, const BGC_FP32_Vector3* vector, BGC_FP32_Vector3* result)
|
||||
inline void bgc_fp32_versor_turn_vector_back(BGC_FP32_Vector3* turned_vector, const BGC_FP32_Versor* versor, const BGC_FP32_Vector3* vector)
|
||||
{
|
||||
const float tx1 = 2.0f * (versor->_x2 * vector->x3 - versor->_x3 * vector->x2);
|
||||
const float tx2 = 2.0f * (versor->_x3 * vector->x1 - versor->_x1 * vector->x3);
|
||||
|
|
@ -614,12 +614,12 @@ inline void bgc_fp32_versor_turn_vector_back(const BGC_FP32_Versor* versor, cons
|
|||
const float x2 = (vector->x2 - tx2 * versor->_s0) + (versor->_x3 * tx1 - versor->_x1 * tx3);
|
||||
const float x3 = (vector->x3 - tx3 * versor->_s0) + (versor->_x1 * tx2 - versor->_x2 * tx1);
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
result->x3 = x3;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
turned_vector->x3 = x3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_turn_vector_back(const BGC_FP64_Versor* versor, const BGC_FP64_Vector3* vector, BGC_FP64_Vector3* result)
|
||||
inline void bgc_fp64_versor_turn_vector_back(BGC_FP64_Vector3* turned_vector, const BGC_FP64_Versor* versor, const BGC_FP64_Vector3* vector)
|
||||
{
|
||||
const double tx1 = 2.0 * (versor->_x2 * vector->x3 - versor->_x3 * vector->x2);
|
||||
const double tx2 = 2.0 * (versor->_x3 * vector->x1 - versor->_x1 * vector->x3);
|
||||
|
|
@ -629,9 +629,9 @@ inline void bgc_fp64_versor_turn_vector_back(const BGC_FP64_Versor* versor, cons
|
|||
const double x2 = (vector->x2 - tx2 * versor->_s0) + (versor->_x3 * tx1 - versor->_x1 * tx3);
|
||||
const double x3 = (vector->x3 - tx3 * versor->_s0) + (versor->_x1 * tx2 - versor->_x2 * tx1);
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
result->x3 = x3;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
turned_vector->x3 = x3;
|
||||
}
|
||||
|
||||
// ================== Are Close ================= //
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue