Продолжение переименования
This commit is contained in:
parent
3b6efaafa9
commit
120e651517
19 changed files with 457 additions and 421 deletions
|
@ -58,7 +58,7 @@ inline void versor_reset_fp64(versor_fp64_t* versor)
|
|||
|
||||
// ==================== Set ===================== //
|
||||
|
||||
inline void versor_fp32_set_values(const float s0, const float x1, const float x2, const float x3, versor_fp32_t* versor)
|
||||
inline void versor_set_values_fp32(const float s0, const float x1, const float x2, const float x3, versor_fp32_t* versor)
|
||||
{
|
||||
__BgFP32DarkTwinVersor* twin = (__BgFP32DarkTwinVersor*)versor;
|
||||
|
||||
|
@ -89,7 +89,7 @@ inline void versor_fp32_set_values(const float s0, const float x1, const float x
|
|||
twin->x3 *= multiplier;
|
||||
}
|
||||
|
||||
inline void versor_fp64_set_values(const double s0, const double x1, const double x2, const double x3, versor_fp64_t* versor)
|
||||
inline void versor_set_values_fp64(const double s0, const double x1, const double x2, const double x3, versor_fp64_t* versor)
|
||||
{
|
||||
__BgFP64DarkTwinVersor* twin = (__BgFP64DarkTwinVersor*)versor;
|
||||
|
||||
|
@ -190,51 +190,51 @@ inline void versor_swap_fp64(versor_fp64_t* versor1, versor_fp64_t* versor2)
|
|||
|
||||
// =============== Set Crude Turn =============== //
|
||||
|
||||
void versor_fp32_set_crude_turn(const float x1, const float x2, const float x3, const float angle, const angle_unit_t unit, versor_fp32_t* result);
|
||||
void versor_set_crude_turn_fp32(const float x1, const float x2, const float x3, const float angle, const angle_unit_t unit, versor_fp32_t* result);
|
||||
|
||||
void versor_fp64_set_crude_turn(const double x1, const double x2, const double x3, const double angle, const angle_unit_t unit, versor_fp64_t* result);
|
||||
void versor_set_crude_turn_fp64(const double x1, const double x2, const double x3, const double angle, const angle_unit_t unit, versor_fp64_t* result);
|
||||
|
||||
// ================== Set Turn ================== //
|
||||
|
||||
inline void versor_fp32_set_turn(const vector3_fp32_t* axis, const float angle, const angle_unit_t unit, versor_fp32_t* result)
|
||||
inline void versor_set_turn_fp32(const vector3_fp32_t* axis, const float angle, const angle_unit_t unit, versor_fp32_t* result)
|
||||
{
|
||||
versor_fp32_set_crude_turn(axis->x1, axis->x2, axis->x3, angle, unit, result);
|
||||
versor_set_crude_turn_fp32(axis->x1, axis->x2, axis->x3, angle, unit, result);
|
||||
}
|
||||
|
||||
inline void versor_fp64_set_turn(const vector3_fp32_t* axis, const double angle, const angle_unit_t unit, versor_fp64_t* result)
|
||||
inline void versor_set_turn_fp64(const vector3_fp32_t* axis, const double angle, const angle_unit_t unit, versor_fp64_t* result)
|
||||
{
|
||||
versor_fp64_set_crude_turn(axis->x1, axis->x2, axis->x3, angle, unit, result);
|
||||
versor_set_crude_turn_fp64(axis->x1, axis->x2, axis->x3, angle, unit, result);
|
||||
}
|
||||
|
||||
// ================ Set Rotation ================ //
|
||||
|
||||
inline void versor_fp32_set_rotation(const rotation3_fp32_t* rotation, versor_fp32_t* result)
|
||||
inline void versor_set_rotation_fp32(const rotation3_fp32_t* rotation, versor_fp32_t* result)
|
||||
{
|
||||
versor_fp32_set_crude_turn(rotation->axis.x1, rotation->axis.x2, rotation->axis.x3, rotation->radians, BG_ANGLE_UNIT_RADIANS, result);
|
||||
versor_set_crude_turn_fp32(rotation->axis.x1, rotation->axis.x2, rotation->axis.x3, rotation->radians, BG_ANGLE_UNIT_RADIANS, result);
|
||||
}
|
||||
|
||||
inline void versor_fp64_set_rotation(const rotation3_fp64_t* rotation, versor_fp64_t* result)
|
||||
inline void versor_set_rotation_fp64(const rotation3_fp64_t* rotation, versor_fp64_t* result)
|
||||
{
|
||||
versor_fp64_set_crude_turn(rotation->axis.x1, rotation->axis.x2, rotation->axis.x3, rotation->radians, BG_ANGLE_UNIT_RADIANS, result);
|
||||
versor_set_crude_turn_fp64(rotation->axis.x1, rotation->axis.x2, rotation->axis.x3, rotation->radians, BG_ANGLE_UNIT_RADIANS, result);
|
||||
}
|
||||
|
||||
// ================= Comparison ================= //
|
||||
|
||||
inline int versor_fp32_is_idle(const versor_fp32_t* versor)
|
||||
inline int versor_is_idle_fp32(const versor_fp32_t* versor)
|
||||
{
|
||||
return 1.0f - FP32_EPSYLON <= versor->s0 || versor->s0 <= -(1.0 - FP32_EPSYLON);
|
||||
}
|
||||
|
||||
inline int versor_fp64_is_idle(const versor_fp64_t* versor)
|
||||
inline int versor_is_idle_fp64(const versor_fp64_t* versor)
|
||||
{
|
||||
return 1.0 - FP64_EPSYLON <= versor->s0 || versor->s0 <= -(1.0 - FP64_EPSYLON);
|
||||
}
|
||||
|
||||
// ============= Copy to twin type ============== //
|
||||
|
||||
inline void versor_fp32_set_from_fp64(const versor_fp64_t* versor, versor_fp32_t* result)
|
||||
inline void versor_convert_fp64_to_fp32(const versor_fp64_t* versor, versor_fp32_t* result)
|
||||
{
|
||||
versor_fp32_set_values(
|
||||
versor_set_values_fp32(
|
||||
(float) versor->s0,
|
||||
(float) versor->x1,
|
||||
(float) versor->x2,
|
||||
|
@ -243,9 +243,9 @@ inline void versor_fp32_set_from_fp64(const versor_fp64_t* versor, versor_fp32_t
|
|||
);
|
||||
}
|
||||
|
||||
inline void versor_fp64_set_from_fp32(const versor_fp32_t* versor, versor_fp64_t* result)
|
||||
inline void versor_convert_fp32_to_fp64(const versor_fp32_t* versor, versor_fp64_t* result)
|
||||
{
|
||||
versor_fp64_set_values(
|
||||
versor_set_values_fp64(
|
||||
versor->s0,
|
||||
versor->x1,
|
||||
versor->x2,
|
||||
|
@ -256,7 +256,7 @@ inline void versor_fp64_set_from_fp32(const versor_fp32_t* versor, versor_fp64_t
|
|||
|
||||
// ================== Shorten =================== //
|
||||
|
||||
inline void versor_fp32_shorten(versor_fp32_t* versor)
|
||||
inline void versor_shorten_fp32(versor_fp32_t* versor)
|
||||
{
|
||||
if (versor->s0 >= 0.0f) {
|
||||
return;
|
||||
|
@ -269,7 +269,7 @@ inline void versor_fp32_shorten(versor_fp32_t* versor)
|
|||
twin->x3 = -versor->x3;
|
||||
}
|
||||
|
||||
inline void versor_fp64_shorten(versor_fp64_t* versor)
|
||||
inline void versor_shorten_fp64(versor_fp64_t* versor)
|
||||
{
|
||||
if (versor->s0 >= 0.0f) {
|
||||
return;
|
||||
|
@ -284,7 +284,7 @@ inline void versor_fp64_shorten(versor_fp64_t* versor)
|
|||
|
||||
// ================== Shorten =================== //
|
||||
|
||||
inline void versor_fp32_set_shortened(const versor_fp32_t* versor, versor_fp32_t* shortened)
|
||||
inline void versor_set_shortened_fp32(const versor_fp32_t* versor, versor_fp32_t* shortened)
|
||||
{
|
||||
__BgFP32DarkTwinVersor* twin = (__BgFP32DarkTwinVersor*)shortened;
|
||||
|
||||
|
@ -302,7 +302,7 @@ inline void versor_fp32_set_shortened(const versor_fp32_t* versor, versor_fp32_t
|
|||
twin->x3 = -versor->x3;
|
||||
}
|
||||
|
||||
inline void versor_fp64_set_shortened(const versor_fp64_t* versor, versor_fp64_t* shortened)
|
||||
inline void versor_set_shortened_fp64(const versor_fp64_t* versor, versor_fp64_t* shortened)
|
||||
{
|
||||
__BgFP64DarkTwinVersor* twin = (__BgFP64DarkTwinVersor*)shortened;
|
||||
|
||||
|
@ -340,7 +340,7 @@ inline void versor_invert_fp64(versor_fp64_t* versor)
|
|||
|
||||
// ================ Set Inverted ================ //
|
||||
|
||||
inline void versor_fp32_set_inverted(const versor_fp32_t* versor, versor_fp32_t* to)
|
||||
inline void versor_set_inverted_fp32(const versor_fp32_t* versor, versor_fp32_t* to)
|
||||
{
|
||||
__BgFP32DarkTwinVersor* twin = (__BgFP32DarkTwinVersor*)to;
|
||||
twin->s0 = versor->s0;
|
||||
|
@ -349,7 +349,7 @@ inline void versor_fp32_set_inverted(const versor_fp32_t* versor, versor_fp32_t*
|
|||
twin->x3 = -versor->x3;
|
||||
}
|
||||
|
||||
inline void versor_fp64_set_inverted(const versor_fp64_t* versor, versor_fp64_t* to)
|
||||
inline void versor_set_inverted_fp64(const versor_fp64_t* versor, versor_fp64_t* to)
|
||||
{
|
||||
__BgFP64DarkTwinVersor* twin = (__BgFP64DarkTwinVersor*)to;
|
||||
twin->s0 = versor->s0;
|
||||
|
@ -360,9 +360,9 @@ inline void versor_fp64_set_inverted(const versor_fp64_t* versor, versor_fp64_t*
|
|||
|
||||
// ================ Set Inverted ================ //
|
||||
|
||||
inline void versor_fp32_set_inverted_fp64(const versor_fp64_t* versor, versor_fp32_t* to)
|
||||
inline void versor_set_inverted_fp64_to_fp32(const versor_fp64_t* versor, versor_fp32_t* to)
|
||||
{
|
||||
versor_fp32_set_values(
|
||||
versor_set_values_fp32(
|
||||
(float) versor->s0,
|
||||
(float) -versor->x1,
|
||||
(float) -versor->x2,
|
||||
|
@ -371,9 +371,9 @@ inline void versor_fp32_set_inverted_fp64(const versor_fp64_t* versor, versor_fp
|
|||
);
|
||||
}
|
||||
|
||||
inline void versor_fp64_set_inverted_fp32(const versor_fp32_t* versor, versor_fp64_t* to)
|
||||
inline void versor_set_inverted_fp32_to_fp64(const versor_fp32_t* versor, versor_fp64_t* to)
|
||||
{
|
||||
versor_fp64_set_values(
|
||||
versor_set_values_fp64(
|
||||
versor->s0,
|
||||
-versor->x1,
|
||||
-versor->x2,
|
||||
|
@ -384,7 +384,7 @@ inline void versor_fp64_set_inverted_fp32(const versor_fp32_t* versor, versor_fp
|
|||
|
||||
// ================ Combination ================= //
|
||||
|
||||
inline void versor_fp32_combine(const versor_fp32_t* second, const versor_fp32_t* first, versor_fp32_t* result)
|
||||
inline void versor_combine_fp32(const versor_fp32_t* second, const versor_fp32_t* first, versor_fp32_t* result)
|
||||
{
|
||||
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);
|
||||
|
@ -412,7 +412,7 @@ inline void versor_fp32_combine(const versor_fp32_t* second, const versor_fp32_t
|
|||
twin->x3 *= multiplier;
|
||||
}
|
||||
|
||||
inline void versor_fp64_combine(const versor_fp64_t* second, const versor_fp64_t* first, versor_fp64_t* result)
|
||||
inline void versor_combine_fp64(const versor_fp64_t* second, const versor_fp64_t* first, versor_fp64_t* result)
|
||||
{
|
||||
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);
|
||||
|
@ -442,7 +442,7 @@ inline void versor_fp64_combine(const versor_fp64_t* second, const versor_fp64_t
|
|||
|
||||
// ============ Combination of three ============ //
|
||||
|
||||
inline void versor_fp32_combine3(const versor_fp32_t* third, const versor_fp32_t* second, const versor_fp32_t* first, versor_fp32_t* result)
|
||||
inline void versor_combine3_fp32(const versor_fp32_t* third, const versor_fp32_t* second, const versor_fp32_t* first, versor_fp32_t* result)
|
||||
{
|
||||
const float s0a = (second->s0 * first->s0 - second->x1 * first->x1) - (second->x2 * first->x2 + second->x3 * first->x3);
|
||||
const float x1a = (second->x1 * first->s0 + second->s0 * first->x1) - (second->x3 * first->x2 - second->x2 * first->x3);
|
||||
|
@ -475,7 +475,7 @@ inline void versor_fp32_combine3(const versor_fp32_t* third, const versor_fp32_t
|
|||
twin->x3 *= multiplier;
|
||||
}
|
||||
|
||||
inline void versor_fp64_combine3(const versor_fp64_t* third, const versor_fp64_t* second, const versor_fp64_t* first, versor_fp64_t* result)
|
||||
inline void versor_combine3_fp64(const versor_fp64_t* third, const versor_fp64_t* second, const versor_fp64_t* first, versor_fp64_t* result)
|
||||
{
|
||||
const double s0a = (second->s0 * first->s0 - second->x1 * first->x1) - (second->x2 * first->x2 + second->x3 * first->x3);
|
||||
const double x1a = (second->x1 * first->s0 + second->s0 * first->x1) - (second->x3 * first->x2 - second->x2 * first->x3);
|
||||
|
@ -510,7 +510,7 @@ inline void versor_fp64_combine3(const versor_fp64_t* third, const versor_fp64_t
|
|||
|
||||
// ================= Exclusion ================== //
|
||||
|
||||
inline void versor_fp32_exclude(const versor_fp32_t* basic, const versor_fp32_t* exclusion, versor_fp32_t* result)
|
||||
inline void versor_exclude_fp32(const versor_fp32_t* basic, const versor_fp32_t* exclusion, versor_fp32_t* result)
|
||||
{
|
||||
const float s0 = (basic->s0 * exclusion->s0 + basic->x1 * exclusion->x1) + (basic->x2 * exclusion->x2 + basic->x3 * exclusion->x3);
|
||||
const float x1 = (basic->x1 * exclusion->s0 - basic->s0 * exclusion->x1) + (basic->x3 * exclusion->x2 - basic->x2 * exclusion->x3);
|
||||
|
@ -538,7 +538,7 @@ inline void versor_fp32_exclude(const versor_fp32_t* basic, const versor_fp32_t*
|
|||
twin->x3 *= multiplier;
|
||||
}
|
||||
|
||||
inline void versor_fp64_exclude(const versor_fp64_t* basic, const versor_fp64_t* exclusion, versor_fp64_t* result)
|
||||
inline void versor_exclude_fp64(const versor_fp64_t* basic, const versor_fp64_t* exclusion, versor_fp64_t* result)
|
||||
{
|
||||
const double s0 = (basic->s0 * exclusion->s0 + basic->x1 * exclusion->x1) + (basic->x2 * exclusion->x2 + basic->x3 * exclusion->x3);
|
||||
const double x1 = (basic->x1 * exclusion->s0 - basic->s0 * exclusion->x1) + (basic->x3 * exclusion->x2 - basic->x2 * exclusion->x3);
|
||||
|
@ -568,13 +568,13 @@ inline void versor_fp64_exclude(const versor_fp64_t* basic, const versor_fp64_t*
|
|||
|
||||
// ================= Rotation3 ================== //
|
||||
|
||||
void versor_fp32_get_rotation(const versor_fp32_t* versor, rotation3_fp32_t* result);
|
||||
void versor_get_rotation_fp32(const versor_fp32_t* versor, rotation3_fp32_t* result);
|
||||
|
||||
void versor_fp64_get_rotation(const versor_fp64_t* versor, rotation3_fp64_t* result);
|
||||
void versor_get_rotation_fp64(const versor_fp64_t* versor, rotation3_fp64_t* result);
|
||||
|
||||
// =========== Make Rotation Matrix3x3 ========== //
|
||||
|
||||
inline void versor_fp32_make_rotation_matrix(const versor_fp32_t* versor, matrix3x3_fp32_t* matrix)
|
||||
inline void versor_make_rotation_matrix_fp32(const versor_fp32_t* versor, matrix3x3_fp32_t* matrix)
|
||||
{
|
||||
const float s0s0 = versor->s0 * versor->s0;
|
||||
const float x1x1 = versor->x1 * versor->x1;
|
||||
|
@ -602,7 +602,7 @@ inline void versor_fp32_make_rotation_matrix(const versor_fp32_t* versor, matrix
|
|||
matrix->r1c3 = x1x3 + s0x2;
|
||||
}
|
||||
|
||||
inline void versor_fp64_make_rotation_matrix(const versor_fp64_t* versor, matrix3x3_fp64_t* matrix)
|
||||
inline void versor_make_rotation_matrix_fp64(const versor_fp64_t* versor, matrix3x3_fp64_t* matrix)
|
||||
{
|
||||
const double s0s0 = versor->s0 * versor->s0;
|
||||
const double x1x1 = versor->x1 * versor->x1;
|
||||
|
@ -632,7 +632,7 @@ inline void versor_fp64_make_rotation_matrix(const versor_fp64_t* versor, matrix
|
|||
|
||||
// =========== Make Reverse Matrix3x3 =========== //
|
||||
|
||||
inline void versor_fp32_make_reverse_matrix(const versor_fp32_t* versor, matrix3x3_fp32_t* matrix)
|
||||
inline void versor_make_reverse_matrix_fp32(const versor_fp32_t* versor, matrix3x3_fp32_t* matrix)
|
||||
{
|
||||
const float s0s0 = versor->s0 * versor->s0;
|
||||
const float x1x1 = versor->x1 * versor->x1;
|
||||
|
@ -660,7 +660,7 @@ inline void versor_fp32_make_reverse_matrix(const versor_fp32_t* versor, matrix3
|
|||
matrix->r1c3 = x1x3 - s0x2;
|
||||
}
|
||||
|
||||
inline void versor_fp64_make_reverse_matrix(const versor_fp64_t* versor, matrix3x3_fp64_t* matrix)
|
||||
inline void versor_make_reverse_matrix_fp64(const versor_fp64_t* versor, matrix3x3_fp64_t* matrix)
|
||||
{
|
||||
const double s0s0 = versor->s0 * versor->s0;
|
||||
const double x1x1 = versor->x1 * versor->x1;
|
||||
|
@ -690,7 +690,7 @@ inline void versor_fp64_make_reverse_matrix(const versor_fp64_t* versor, matrix3
|
|||
|
||||
// ================ Turn Vector ================= //
|
||||
|
||||
inline void versor_fp32_turn(const versor_fp32_t* versor, const vector3_fp32_t* vector, vector3_fp32_t* result)
|
||||
inline void versor_turn_vector_fp32(const versor_fp32_t* versor, const vector3_fp32_t* vector, vector3_fp32_t* result)
|
||||
{
|
||||
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);
|
||||
|
@ -705,7 +705,7 @@ inline void versor_fp32_turn(const versor_fp32_t* versor, const vector3_fp32_t*
|
|||
result->x3 = x3;
|
||||
}
|
||||
|
||||
inline void versor_fp64_turn(const versor_fp64_t* versor, const vector3_fp64_t* vector, vector3_fp64_t* result)
|
||||
inline void versor_turn_vector_fp64(const versor_fp64_t* versor, const vector3_fp64_t* vector, vector3_fp64_t* result)
|
||||
{
|
||||
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);
|
||||
|
@ -722,7 +722,7 @@ inline void versor_fp64_turn(const versor_fp64_t* versor, const vector3_fp64_t*
|
|||
|
||||
// ============== Turn Vector Back ============== //
|
||||
|
||||
inline void versor_fp32_turn_back(const versor_fp32_t* versor, const vector3_fp32_t* vector, vector3_fp32_t* result)
|
||||
inline void versor_turn_vector_back_fp32(const versor_fp32_t* versor, const vector3_fp32_t* vector, vector3_fp32_t* result)
|
||||
{
|
||||
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);
|
||||
|
@ -737,7 +737,7 @@ inline void versor_fp32_turn_back(const versor_fp32_t* versor, const vector3_fp3
|
|||
result->x3 = x3;
|
||||
}
|
||||
|
||||
inline void versor_fp64_turn_back(const versor_fp64_t* versor, const vector3_fp64_t* vector, vector3_fp64_t* result)
|
||||
inline void versor_turn_vector_back_fp64(const versor_fp64_t* versor, const vector3_fp64_t* vector, vector3_fp64_t* result)
|
||||
{
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue