Добавление арифметических операций для дуальных кватернионов
This commit is contained in:
parent
b470a3194b
commit
b0b064de5a
24 changed files with 171 additions and 102 deletions
|
|
@ -192,7 +192,7 @@ void bgc_fp64_turn3_set_rotation(BGC_FP64_Turn3* turn, const double x1, const do
|
|||
|
||||
const double multiplier = sine / sqrt(square_vector);
|
||||
|
||||
bgc_fp64_quaternion_make(&turn->_versor, cosf(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier);
|
||||
bgc_fp64_quaternion_make(&turn->_versor, cos(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier);
|
||||
|
||||
const double square_modulus = bgc_fp64_quaternion_get_square_modulus(&turn->_versor);
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ void bgc_fp64_turn3_set_rotation(BGC_FP64_Turn3* turn, const double x1, const do
|
|||
|
||||
// ========= Make Direction Difference ========== //
|
||||
|
||||
static int _bgc_fp32_turn3_make_direction_turn(BGC_FP32_Turn3* turn, const BGC_FP32_Vector3* start, const BGC_FP32_Vector3* end, const float square_modulus)
|
||||
static int _bgc_fp32_turn3_make_direction_turn(BGC_FP32_Turn3* turn, const BGC_FP32_Vector3* start, const BGC_FP32_Vector3* end, const float square_modulus_product)
|
||||
{
|
||||
BGC_FP32_Vector3 orthogonal_axis;
|
||||
|
||||
|
|
@ -213,13 +213,13 @@ static int _bgc_fp32_turn3_make_direction_turn(BGC_FP32_Turn3* turn, const BGC_F
|
|||
const float square_modulus = bgc_fp32_vector3_get_square_modulus(&orthogonal_axis);
|
||||
const float square_sine = square_modulus / square_modulus_product;
|
||||
|
||||
if (square_sine > BGC_FP64_SQUARE_EPSILON) {
|
||||
if (square_sine > BGC_FP32_SQUARE_EPSILON) {
|
||||
const float cosine = scalar_product / sqrtf(square_modulus_product);
|
||||
const float angle = 0.5 * atan2f(sqrtf(square_sine), cosine);
|
||||
const float angle = 0.5f * atan2f(sqrtf(square_sine), cosine);
|
||||
|
||||
const float multiplier = sin(angle) * sqrtf(1.0f / square_modulus);
|
||||
const float multiplier = sinf(angle) * sqrtf(1.0f / square_modulus);
|
||||
|
||||
bgc_fp32_turn3_set_raw_values(versor, cosf(angle), orthogonal_axis.x1 * multiplier, orthogonal_axis.x2 * multiplier, orthogonal_axis.x3 * multiplier);
|
||||
bgc_fp32_turn3_set_raw_values(turn, cosf(angle), orthogonal_axis.x1 * multiplier, orthogonal_axis.x2 * multiplier, orthogonal_axis.x3 * multiplier);
|
||||
return BGC_SOME_TURN;
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ static int _bgc_fp32_turn3_make_direction_turn(BGC_FP32_Turn3* turn, const BGC_F
|
|||
return BGC_OPPOSITE;
|
||||
}
|
||||
|
||||
bgc_fp32_turn3_reset(versor);
|
||||
bgc_fp32_turn3_reset(turn);
|
||||
|
||||
return BGC_ZERO_TURN;
|
||||
}
|
||||
|
|
@ -273,15 +273,6 @@ int bgc_fp32_turn3_find_direction_difference(BGC_FP32_Turn3* difference, const B
|
|||
return BGC_ZERO_TURN;
|
||||
}
|
||||
|
||||
const double scalar_product = bgc_fp64_vector3_get_dot_product(start, end);
|
||||
|
||||
if () {
|
||||
}
|
||||
|
||||
BGC_FP64_Vector3 orthogonal_axis;
|
||||
|
||||
bgc_fp64_vector3_get_cross_product(&orthogonal_axis, start, end);
|
||||
|
||||
return _bgc_fp32_turn3_make_direction_turn(difference, start, end, start_square_modulus * end_square_modulus);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue