Переименование s0 -> s, x1 -> x, x2 -> y, x3 -> z, что должно упростить читаемость кода. Также обновление документации
This commit is contained in:
parent
d83ab7160d
commit
b8d383da33
38 changed files with 2104 additions and 2070 deletions
|
|
@ -12,8 +12,8 @@ extern inline void bgc_fp64_turn3_reset(BGC_FP64_Turn3* const turn);
|
|||
extern inline void _bgc_fp32_turn3_normalize(BGC_FP32_Turn3* const turn);
|
||||
extern inline void _bgc_fp64_turn3_normalize(BGC_FP64_Turn3* const turn);
|
||||
|
||||
extern inline void bgc_fp32_turn3_set_values(BGC_FP32_Turn3* const turn, const float s0, const float x1, const float x2, const float x3);
|
||||
extern inline void bgc_fp64_turn3_set_values(BGC_FP64_Turn3* const turn, const double s0, const double x1, const double x2, const double x3);
|
||||
extern inline void bgc_fp32_turn3_set_values(BGC_FP32_Turn3* const turn, const float s, const float x, const float y, const float z);
|
||||
extern inline void bgc_fp64_turn3_set_values(BGC_FP64_Turn3* const turn, const double s, const double x, const double y, const double z);
|
||||
|
||||
extern inline void bgc_fp32_turn3_get_quaternion(BGC_FP32_Quaternion* const quaternion, const BGC_FP32_Turn3* const turn);
|
||||
extern inline void bgc_fp64_turn3_get_quaternion(BGC_FP64_Quaternion* const quaternion, const BGC_FP64_Turn3* const turn);
|
||||
|
|
@ -82,7 +82,7 @@ extern inline int bgc_fp64_turn3_are_close(const BGC_FP64_Turn3* const turn1, co
|
|||
|
||||
float bgc_fp32_turn3_get_rotation(BGC_FP32_Vector3* const axis, const BGC_FP32_Turn3* const turn, const int angle_unit)
|
||||
{
|
||||
const float square_vector_modulus = turn->_versor.x1 * turn->_versor.x1 + turn->_versor.x2 * turn->_versor.x2 + turn->_versor.x3 * turn->_versor.x3;
|
||||
const float square_vector_modulus = turn->_versor.x * turn->_versor.x + turn->_versor.y * turn->_versor.y + turn->_versor.z * turn->_versor.z;
|
||||
|
||||
if (square_vector_modulus <= BGC_FP32_SQUARE_EPSILON) {
|
||||
bgc_fp32_vector3_reset(axis);
|
||||
|
|
@ -93,16 +93,16 @@ float bgc_fp32_turn3_get_rotation(BGC_FP32_Vector3* const axis, const BGC_FP32_T
|
|||
|
||||
const float multiplier = 1.0f / vector_modulus;
|
||||
|
||||
axis->x1 = turn->_versor.x1 * multiplier;
|
||||
axis->x2 = turn->_versor.x2 * multiplier;
|
||||
axis->x3 = turn->_versor.x3 * multiplier;
|
||||
axis->x = turn->_versor.x * multiplier;
|
||||
axis->y = turn->_versor.y * multiplier;
|
||||
axis->z = turn->_versor.z * multiplier;
|
||||
|
||||
return 2.0f * atan2f(vector_modulus, turn->_versor.s0);
|
||||
return 2.0f * atan2f(vector_modulus, turn->_versor.s);
|
||||
}
|
||||
|
||||
double bgc_fp64_turn3_get_rotation(BGC_FP64_Vector3* const axis, const BGC_FP64_Turn3* const turn, const int angle_unit)
|
||||
{
|
||||
const double square_vector_modulus = turn->_versor.x1 * turn->_versor.x1 + turn->_versor.x2 * turn->_versor.x2 + turn->_versor.x3 * turn->_versor.x3;
|
||||
const double square_vector_modulus = turn->_versor.x * turn->_versor.x + turn->_versor.y * turn->_versor.y + turn->_versor.z * turn->_versor.z;
|
||||
|
||||
if (square_vector_modulus <= BGC_FP64_SQUARE_EPSILON) {
|
||||
bgc_fp64_vector3_reset(axis);
|
||||
|
|
@ -113,18 +113,18 @@ double bgc_fp64_turn3_get_rotation(BGC_FP64_Vector3* const axis, const BGC_FP64_
|
|||
|
||||
const double multiplier = 1.0 / vector_modulus;
|
||||
|
||||
axis->x1 = turn->_versor.x1 * multiplier;
|
||||
axis->x2 = turn->_versor.x2 * multiplier;
|
||||
axis->x3 = turn->_versor.x3 * multiplier;
|
||||
axis->x = turn->_versor.x * multiplier;
|
||||
axis->y = turn->_versor.y * multiplier;
|
||||
axis->z = turn->_versor.z * multiplier;
|
||||
|
||||
return 2.0 * atan2(vector_modulus, turn->_versor.s0);
|
||||
return 2.0 * atan2(vector_modulus, turn->_versor.s);
|
||||
}
|
||||
|
||||
// ================ Set Rotation ================ //
|
||||
|
||||
void bgc_fp32_turn3_set_rotation(BGC_FP32_Turn3* const turn, const float x1, const float x2, const float x3, const float angle, const int angle_unit)
|
||||
void bgc_fp32_turn3_set_rotation(BGC_FP32_Turn3* const turn, const float x, const float y, const float z, const float angle, const int angle_unit)
|
||||
{
|
||||
const float square_vector = x1 * x1 + x2 * x2 + x3 * x3;
|
||||
const float square_vector = x * x + y * y + z * z;
|
||||
|
||||
if (square_vector <= BGC_FP32_SQUARE_EPSILON) {
|
||||
bgc_fp32_turn3_reset(turn);
|
||||
|
|
@ -142,14 +142,14 @@ void bgc_fp32_turn3_set_rotation(BGC_FP32_Turn3* const turn, const float x1, con
|
|||
|
||||
const float multiplier = sine / sqrtf(square_vector);
|
||||
|
||||
bgc_fp32_quaternion_set_values(&turn->_versor, cosf(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier);
|
||||
bgc_fp32_quaternion_set_values(&turn->_versor, cosf(half_angle), x * multiplier, y * multiplier, z * multiplier);
|
||||
|
||||
_bgc_fp32_turn3_normalize(turn);
|
||||
}
|
||||
|
||||
void bgc_fp64_turn3_set_rotation(BGC_FP64_Turn3* const turn, const double x1, const double x2, const double x3, const double angle, const int angle_unit)
|
||||
void bgc_fp64_turn3_set_rotation(BGC_FP64_Turn3* const turn, const double x, const double y, const double z, const double angle, const int angle_unit)
|
||||
{
|
||||
const double square_vector = x1 * x1 + x2 * x2 + x3 * x3;
|
||||
const double square_vector = x * x + y * y + z * z;
|
||||
|
||||
if (square_vector <= BGC_FP64_SQUARE_EPSILON) {
|
||||
bgc_fp64_turn3_reset(turn);
|
||||
|
|
@ -167,7 +167,7 @@ void bgc_fp64_turn3_set_rotation(BGC_FP64_Turn3* const turn, const double x1, co
|
|||
|
||||
const double multiplier = sine / sqrt(square_vector);
|
||||
|
||||
bgc_fp64_quaternion_set_values(&turn->_versor, cos(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier);
|
||||
bgc_fp64_quaternion_set_values(&turn->_versor, cos(half_angle), x * multiplier, y * multiplier, z * multiplier);
|
||||
|
||||
_bgc_fp64_turn3_normalize(turn);
|
||||
}
|
||||
|
|
@ -210,7 +210,7 @@ int bgc_fp32_turn3_find_direction_difference(BGC_FP32_Turn3* const turn, const B
|
|||
|
||||
const float vector_multiplier = sinf(angle) / axis_modulus;
|
||||
|
||||
bgc_fp32_turn3_set_values(turn, cosf(angle), axis.x1 * vector_multiplier, axis.x2 * vector_multiplier, axis.x3 * vector_multiplier);
|
||||
bgc_fp32_turn3_set_values(turn, cosf(angle), axis.x * vector_multiplier, axis.y * vector_multiplier, axis.z * vector_multiplier);
|
||||
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
|
@ -251,7 +251,7 @@ int bgc_fp64_turn3_find_direction_difference(BGC_FP64_Turn3* const turn, const B
|
|||
|
||||
const double vector_multiplier = sin(angle) / axis_modulus;
|
||||
|
||||
bgc_fp64_turn3_set_values(turn, cos(angle), axis.x1 * vector_multiplier, axis.x2 * vector_multiplier, axis.x3 * vector_multiplier);
|
||||
bgc_fp64_turn3_set_values(turn, cos(angle), axis.x * vector_multiplier, axis.y * vector_multiplier, axis.z * vector_multiplier);
|
||||
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
|
@ -332,18 +332,18 @@ static inline void _bgc_fp32_turn3_get_turning_quaternion(BGC_FP32_Quaternion* c
|
|||
if (axis_square_modulus <= BGC_FP32_SQUARE_EPSILON) {
|
||||
// unit_start and unit_end are co-directional, angle = 180 degrees
|
||||
if (dot_product >= 0.0f) {
|
||||
quaternion->s0 = 1.0f;
|
||||
quaternion->x1 = 0.0f;
|
||||
quaternion->x2 = 0.0f;
|
||||
quaternion->x3 = 0.0f;
|
||||
quaternion->s = 1.0f;
|
||||
quaternion->x = 0.0f;
|
||||
quaternion->y = 0.0f;
|
||||
quaternion->z = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
// unit_start and unit_end are opposite, angle = 180 degrees
|
||||
quaternion->s0 = 0.0f;
|
||||
quaternion->x1 = unit_orthogonal->x1;
|
||||
quaternion->x2 = unit_orthogonal->x2;
|
||||
quaternion->x3 = unit_orthogonal->x3;
|
||||
quaternion->s = 0.0f;
|
||||
quaternion->x = unit_orthogonal->x;
|
||||
quaternion->y = unit_orthogonal->y;
|
||||
quaternion->z = unit_orthogonal->z;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -353,10 +353,10 @@ static inline void _bgc_fp32_turn3_get_turning_quaternion(BGC_FP32_Quaternion* c
|
|||
|
||||
const float multiplier = sinf(angle) / axis_modulus;
|
||||
|
||||
quaternion->s0 = cosf(angle);
|
||||
quaternion->x1 = axis.x1 * multiplier;
|
||||
quaternion->x2 = axis.x2 * multiplier;
|
||||
quaternion->x3 = axis.x3 * multiplier;
|
||||
quaternion->s = cosf(angle);
|
||||
quaternion->x = axis.x * multiplier;
|
||||
quaternion->y = axis.y * multiplier;
|
||||
quaternion->z = axis.z * multiplier;
|
||||
}
|
||||
|
||||
static inline void _bgc_fp64_turn3_get_turning_quaternion(BGC_FP64_Quaternion* const quaternion, const BGC_FP64_Vector3* const unit_start, const BGC_FP64_Vector3* const unit_end, const BGC_FP64_Vector3* const unit_orthogonal)
|
||||
|
|
@ -373,18 +373,18 @@ static inline void _bgc_fp64_turn3_get_turning_quaternion(BGC_FP64_Quaternion* c
|
|||
if (axis_square_modulus <= BGC_FP64_SQUARE_EPSILON) {
|
||||
// unit_start and unit_end are co-directional, angle = 180 degrees
|
||||
if (dot_product >= 0.0) {
|
||||
quaternion->s0 = 1.0;
|
||||
quaternion->x1 = 0.0;
|
||||
quaternion->x2 = 0.0;
|
||||
quaternion->x3 = 0.0;
|
||||
quaternion->s = 1.0;
|
||||
quaternion->x = 0.0;
|
||||
quaternion->y = 0.0;
|
||||
quaternion->z = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
// unit_start and unit_end are opposite, angle = 180 degrees
|
||||
quaternion->s0 = 0.0;
|
||||
quaternion->x1 = unit_orthogonal->x1;
|
||||
quaternion->x2 = unit_orthogonal->x2;
|
||||
quaternion->x3 = unit_orthogonal->x3;
|
||||
quaternion->s = 0.0;
|
||||
quaternion->x = unit_orthogonal->x;
|
||||
quaternion->y = unit_orthogonal->y;
|
||||
quaternion->z = unit_orthogonal->z;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -394,10 +394,10 @@ static inline void _bgc_fp64_turn3_get_turning_quaternion(BGC_FP64_Quaternion* c
|
|||
|
||||
const double multiplier = sin(angle) / axis_modulus;
|
||||
|
||||
quaternion->s0 = cos(angle);
|
||||
quaternion->x1 = axis.x1 * multiplier;
|
||||
quaternion->x2 = axis.x2 * multiplier;
|
||||
quaternion->x3 = axis.x3 * multiplier;
|
||||
quaternion->s = cos(angle);
|
||||
quaternion->x = axis.x * multiplier;
|
||||
quaternion->y = axis.y * multiplier;
|
||||
quaternion->z = axis.z * multiplier;
|
||||
}
|
||||
|
||||
// ============ Make Pair Difference ============ //
|
||||
|
|
@ -492,7 +492,7 @@ int bgc_fp64_turn3_find_pair_difference(
|
|||
|
||||
void bgc_fp32_turn3_get_power(BGC_FP32_Turn3* const power, const BGC_FP32_Turn3* const base, const float exponent)
|
||||
{
|
||||
const float square_vector = base->_versor.x1 * base->_versor.x1 + base->_versor.x2 * base->_versor.x2 + base->_versor.x3 * base->_versor.x3;
|
||||
const float square_vector = base->_versor.x * base->_versor.x + base->_versor.y * base->_versor.y + base->_versor.z * base->_versor.z;
|
||||
|
||||
if (square_vector <= BGC_FP32_SQUARE_EPSILON || square_vector != square_vector) {
|
||||
bgc_fp32_turn3_reset(power);
|
||||
|
|
@ -501,16 +501,16 @@ void bgc_fp32_turn3_get_power(BGC_FP32_Turn3* const power, const BGC_FP32_Turn3*
|
|||
|
||||
const float vector_modulus = sqrtf(square_vector);
|
||||
|
||||
const float angle = atan2f(vector_modulus, base->_versor.s0) * exponent;
|
||||
const float angle = atan2f(vector_modulus, base->_versor.s) * exponent;
|
||||
|
||||
const float multiplier = sinf(angle) / vector_modulus;
|
||||
|
||||
bgc_fp32_turn3_set_values(power, cosf(angle), base->_versor.x1 * multiplier, base->_versor.x2 * multiplier, base->_versor.x3 * multiplier);
|
||||
bgc_fp32_turn3_set_values(power, cosf(angle), base->_versor.x * multiplier, base->_versor.y * multiplier, base->_versor.z * multiplier);
|
||||
}
|
||||
|
||||
void bgc_fp64_turn3_get_power(BGC_FP64_Turn3* const power, const BGC_FP64_Turn3* const base, const double exponent)
|
||||
{
|
||||
const double square_vector = base->_versor.x1 * base->_versor.x1 + base->_versor.x2 * base->_versor.x2 + base->_versor.x3 * base->_versor.x3;
|
||||
const double square_vector = base->_versor.x * base->_versor.x + base->_versor.y * base->_versor.y + base->_versor.z * base->_versor.z;
|
||||
|
||||
if (square_vector <= BGC_FP64_SQUARE_EPSILON || square_vector != square_vector) {
|
||||
bgc_fp64_turn3_reset(power);
|
||||
|
|
@ -519,23 +519,23 @@ void bgc_fp64_turn3_get_power(BGC_FP64_Turn3* const power, const BGC_FP64_Turn3*
|
|||
|
||||
const double vector_modulus = sqrt(square_vector);
|
||||
|
||||
const double angle = atan2(vector_modulus, base->_versor.s0) * exponent;
|
||||
const double angle = atan2(vector_modulus, base->_versor.s) * exponent;
|
||||
|
||||
const double multiplier = sin(angle) / vector_modulus;
|
||||
|
||||
bgc_fp64_turn3_set_values(power, cos(angle), base->_versor.x1 * multiplier, base->_versor.x2 * multiplier, base->_versor.x3 * multiplier);
|
||||
bgc_fp64_turn3_set_values(power, cos(angle), base->_versor.x * multiplier, base->_versor.y * multiplier, base->_versor.z * multiplier);
|
||||
}
|
||||
|
||||
// ============ Sphere Interpolation ============ //
|
||||
|
||||
void bgc_fp32_turn3_spherically_interpolate(BGC_FP32_Turn3* const interpolation, const BGC_FP32_Turn3* const start, const BGC_FP32_Turn3* const end, const float phase)
|
||||
{
|
||||
const float delta_s0 = (end->_versor.s0 * start->_versor.s0 + end->_versor.x1 * start->_versor.x1) + (end->_versor.x2 * start->_versor.x2 + end->_versor.x3 * start->_versor.x3);
|
||||
const float delta_x1 = (end->_versor.x1 * start->_versor.s0 + end->_versor.x3 * start->_versor.x2) - (end->_versor.s0 * start->_versor.x1 + end->_versor.x2 * start->_versor.x3);
|
||||
const float delta_x2 = (end->_versor.x2 * start->_versor.s0 + end->_versor.x1 * start->_versor.x3) - (end->_versor.s0 * start->_versor.x2 + end->_versor.x3 * start->_versor.x1);
|
||||
const float delta_x3 = (end->_versor.x3 * start->_versor.s0 + end->_versor.x2 * start->_versor.x1) - (end->_versor.s0 * start->_versor.x3 + end->_versor.x1 * start->_versor.x2);
|
||||
const float delta_s = (end->_versor.s * start->_versor.s + end->_versor.x * start->_versor.x) + (end->_versor.y * start->_versor.y + end->_versor.z * start->_versor.z);
|
||||
const float delta_x = (end->_versor.x * start->_versor.s + end->_versor.z * start->_versor.y) - (end->_versor.s * start->_versor.x + end->_versor.y * start->_versor.z);
|
||||
const float delta_y = (end->_versor.y * start->_versor.s + end->_versor.x * start->_versor.z) - (end->_versor.s * start->_versor.y + end->_versor.z * start->_versor.x);
|
||||
const float delta_z = (end->_versor.z * start->_versor.s + end->_versor.y * start->_versor.x) - (end->_versor.s * start->_versor.z + end->_versor.x * start->_versor.y);
|
||||
|
||||
const float square_vector = delta_x1 * delta_x1 + delta_x2 * delta_x2 + delta_x3 * delta_x3;
|
||||
const float square_vector = delta_x * delta_x + delta_y * delta_y + delta_z * delta_z;
|
||||
|
||||
// square_vector != square_vector means checking for NaN value at square_vector
|
||||
if (square_vector <= BGC_FP32_SQUARE_EPSILON || isnan(square_vector)) {
|
||||
|
|
@ -545,32 +545,32 @@ void bgc_fp32_turn3_spherically_interpolate(BGC_FP32_Turn3* const interpolation,
|
|||
|
||||
// Calculating of the turning which fits the phase:
|
||||
const float vector_modulus = sqrtf(square_vector);
|
||||
const float angle = atan2f(vector_modulus, delta_s0) * phase;
|
||||
const float angle = atan2f(vector_modulus, delta_s) * phase;
|
||||
const float multiplier = sinf(angle) / vector_modulus;
|
||||
|
||||
const float turn_s0 = cosf(angle);
|
||||
const float turn_x1 = delta_x1 * multiplier;
|
||||
const float turn_x2 = delta_x2 * multiplier;
|
||||
const float turn_x3 = delta_x3 * multiplier;
|
||||
const float turn_s = cosf(angle);
|
||||
const float turn_x = delta_x * multiplier;
|
||||
const float turn_y = delta_y * multiplier;
|
||||
const float turn_z = delta_z * multiplier;
|
||||
|
||||
// Combining of starting orientation with the turning
|
||||
bgc_fp32_turn3_set_values(
|
||||
interpolation,
|
||||
(turn_s0 * start->_versor.s0 - turn_x1 * start->_versor.x1) - (turn_x2 * start->_versor.x2 + turn_x3 * start->_versor.x3),
|
||||
(turn_x1 * start->_versor.s0 + turn_s0 * start->_versor.x1) - (turn_x3 * start->_versor.x2 - turn_x2 * start->_versor.x3),
|
||||
(turn_x2 * start->_versor.s0 + turn_s0 * start->_versor.x2) - (turn_x1 * start->_versor.x3 - turn_x3 * start->_versor.x1),
|
||||
(turn_x3 * start->_versor.s0 + turn_s0 * start->_versor.x3) - (turn_x2 * start->_versor.x1 - turn_x1 * start->_versor.x2)
|
||||
(turn_s * start->_versor.s - turn_x * start->_versor.x) - (turn_y * start->_versor.y + turn_z * start->_versor.z),
|
||||
(turn_x * start->_versor.s + turn_s * start->_versor.x) - (turn_z * start->_versor.y - turn_y * start->_versor.z),
|
||||
(turn_y * start->_versor.s + turn_s * start->_versor.y) - (turn_x * start->_versor.z - turn_z * start->_versor.x),
|
||||
(turn_z * start->_versor.s + turn_s * start->_versor.z) - (turn_y * start->_versor.x - turn_x * start->_versor.y)
|
||||
);
|
||||
}
|
||||
|
||||
void bgc_fp64_turn3_spherically_interpolate(BGC_FP64_Turn3* const interpolation, const BGC_FP64_Turn3* const start, const BGC_FP64_Turn3* const end, const double phase)
|
||||
{
|
||||
const double delta_s0 = (end->_versor.s0 * start->_versor.s0 + end->_versor.x1 * start->_versor.x1) + (end->_versor.x2 * start->_versor.x2 + end->_versor.x3 * start->_versor.x3);
|
||||
const double delta_x1 = (end->_versor.x1 * start->_versor.s0 + end->_versor.x3 * start->_versor.x2) - (end->_versor.s0 * start->_versor.x1 + end->_versor.x2 * start->_versor.x3);
|
||||
const double delta_x2 = (end->_versor.x2 * start->_versor.s0 + end->_versor.x1 * start->_versor.x3) - (end->_versor.s0 * start->_versor.x2 + end->_versor.x3 * start->_versor.x1);
|
||||
const double delta_x3 = (end->_versor.x3 * start->_versor.s0 + end->_versor.x2 * start->_versor.x1) - (end->_versor.s0 * start->_versor.x3 + end->_versor.x1 * start->_versor.x2);
|
||||
const double delta_s = (end->_versor.s * start->_versor.s + end->_versor.x * start->_versor.x) + (end->_versor.y * start->_versor.y + end->_versor.z * start->_versor.z);
|
||||
const double delta_x = (end->_versor.x * start->_versor.s + end->_versor.z * start->_versor.y) - (end->_versor.s * start->_versor.x + end->_versor.y * start->_versor.z);
|
||||
const double delta_y = (end->_versor.y * start->_versor.s + end->_versor.x * start->_versor.z) - (end->_versor.s * start->_versor.y + end->_versor.z * start->_versor.x);
|
||||
const double delta_z = (end->_versor.z * start->_versor.s + end->_versor.y * start->_versor.x) - (end->_versor.s * start->_versor.z + end->_versor.x * start->_versor.y);
|
||||
|
||||
const double square_vector = delta_x1 * delta_x1 + delta_x2 * delta_x2 + delta_x3 * delta_x3;
|
||||
const double square_vector = delta_x * delta_x + delta_y * delta_y + delta_z * delta_z;
|
||||
|
||||
// square_vector != square_vector means checking for NaN value at square_vector
|
||||
if (square_vector <= BGC_FP64_SQUARE_EPSILON || isnan(square_vector)) {
|
||||
|
|
@ -580,20 +580,20 @@ void bgc_fp64_turn3_spherically_interpolate(BGC_FP64_Turn3* const interpolation,
|
|||
|
||||
// Calculating of the turning which fits the phase:
|
||||
const double vector_modulus = sqrt(square_vector);
|
||||
const double angle = atan2(vector_modulus, delta_s0) * phase;
|
||||
const double angle = atan2(vector_modulus, delta_s) * phase;
|
||||
const double multiplier = sin(angle) / vector_modulus;
|
||||
|
||||
const double turn_s0 = cos(angle);
|
||||
const double turn_x1 = delta_x1 * multiplier;
|
||||
const double turn_x2 = delta_x2 * multiplier;
|
||||
const double turn_x3 = delta_x3 * multiplier;
|
||||
const double turn_s = cos(angle);
|
||||
const double turn_x = delta_x * multiplier;
|
||||
const double turn_y = delta_y * multiplier;
|
||||
const double turn_z = delta_z * multiplier;
|
||||
|
||||
// Combining of starting orientation with the turning
|
||||
bgc_fp64_turn3_set_values(
|
||||
interpolation,
|
||||
(turn_s0 * start->_versor.s0 - turn_x1 * start->_versor.x1) - (turn_x2 * start->_versor.x2 + turn_x3 * start->_versor.x3),
|
||||
(turn_x1 * start->_versor.s0 + turn_s0 * start->_versor.x1) - (turn_x3 * start->_versor.x2 - turn_x2 * start->_versor.x3),
|
||||
(turn_x2 * start->_versor.s0 + turn_s0 * start->_versor.x2) - (turn_x1 * start->_versor.x3 - turn_x3 * start->_versor.x1),
|
||||
(turn_x3 * start->_versor.s0 + turn_s0 * start->_versor.x3) - (turn_x2 * start->_versor.x1 - turn_x1 * start->_versor.x2)
|
||||
(turn_s * start->_versor.s - turn_x * start->_versor.x) - (turn_y * start->_versor.y + turn_z * start->_versor.z),
|
||||
(turn_x * start->_versor.s + turn_s * start->_versor.x) - (turn_z * start->_versor.y - turn_y * start->_versor.z),
|
||||
(turn_y * start->_versor.s + turn_s * start->_versor.y) - (turn_x * start->_versor.z - turn_z * start->_versor.x),
|
||||
(turn_z * start->_versor.s + turn_s * start->_versor.z) - (turn_y * start->_versor.x - turn_x * start->_versor.y)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue