Упорядочивание проекта
This commit is contained in:
parent
0dcd9c0d4d
commit
89dfd7644b
32 changed files with 1730 additions and 1719 deletions
|
|
@ -14,7 +14,7 @@ extern inline void bgc_slerp_get_turn_for_phase_fp64(const BgcSlerpFP64* slerp,
|
|||
|
||||
void bgc_slerp_make_fp32(const BgcVersorFP32* start, const BgcVersorFP32* augment, BgcSlerpFP32* slerp)
|
||||
{
|
||||
const float square_vector = augment->x1 * augment->x1 + augment->x2 * augment->x2 + augment->x3 * augment->x3;
|
||||
const float square_vector = augment->_x1 * augment->_x1 + augment->_x2 * augment->_x2 + augment->_x3 * augment->_x3;
|
||||
|
||||
if (square_vector != square_vector) {
|
||||
bgc_slerp_reset_fp32(slerp);
|
||||
|
|
@ -22,10 +22,10 @@ void bgc_slerp_make_fp32(const BgcVersorFP32* start, const BgcVersorFP32* augmen
|
|||
}
|
||||
|
||||
if (square_vector <= BGC_SQUARE_EPSYLON_FP32) {
|
||||
slerp->s0_cos_weight = start->s0;
|
||||
slerp->x1_cos_weight = start->x1;
|
||||
slerp->x2_cos_weight = start->x2;
|
||||
slerp->x3_cos_weight = start->x3;
|
||||
slerp->s0_cos_weight = start->_s0;
|
||||
slerp->x1_cos_weight = start->_x1;
|
||||
slerp->x2_cos_weight = start->_x2;
|
||||
slerp->x3_cos_weight = start->_x3;
|
||||
|
||||
slerp->s0_sin_weight = 0.0f;
|
||||
slerp->x1_sin_weight = 0.0f;
|
||||
|
|
@ -38,24 +38,24 @@ void bgc_slerp_make_fp32(const BgcVersorFP32* start, const BgcVersorFP32* augmen
|
|||
|
||||
const float vector_modulus = sqrtf(square_vector);
|
||||
|
||||
slerp->radians = atan2f(vector_modulus, augment->s0);
|
||||
slerp->radians = atan2f(vector_modulus, augment->_s0);
|
||||
|
||||
const float multiplier = 1.0f / vector_modulus;
|
||||
|
||||
slerp->s0_cos_weight = start->s0;
|
||||
slerp->x1_cos_weight = start->x1;
|
||||
slerp->x2_cos_weight = start->x2;
|
||||
slerp->x3_cos_weight = start->x3;
|
||||
slerp->s0_cos_weight = start->_s0;
|
||||
slerp->x1_cos_weight = start->_x1;
|
||||
slerp->x2_cos_weight = start->_x2;
|
||||
slerp->x3_cos_weight = start->_x3;
|
||||
|
||||
slerp->s0_sin_weight = -multiplier * (augment->x1 * start->x1 + augment->x2 * start->x2 + augment->x3 * start->x3);
|
||||
slerp->x1_sin_weight = multiplier * (augment->x1 * start->s0 + augment->x2 * start->x3 - augment->x3 * start->x2);
|
||||
slerp->x2_sin_weight = multiplier * (augment->x2 * start->s0 - augment->x1 * start->x3 + augment->x3 * start->x1);
|
||||
slerp->x3_sin_weight = multiplier * (augment->x3 * start->s0 - augment->x2 * start->x1 + augment->x1 * start->x2);
|
||||
slerp->s0_sin_weight = -multiplier * (augment->_x1 * start->_x1 + augment->_x2 * start->_x2 + augment->_x3 * start->_x3);
|
||||
slerp->x1_sin_weight = multiplier * (augment->_x1 * start->_s0 + augment->_x2 * start->_x3 - augment->_x3 * start->_x2);
|
||||
slerp->x2_sin_weight = multiplier * (augment->_x2 * start->_s0 - augment->_x1 * start->_x3 + augment->_x3 * start->_x1);
|
||||
slerp->x3_sin_weight = multiplier * (augment->_x3 * start->_s0 - augment->_x2 * start->_x1 + augment->_x1 * start->_x2);
|
||||
}
|
||||
|
||||
void bgc_slerp_make_fp64(const BgcVersorFP64* start, const BgcVersorFP64* augment, BgcSlerpFP64* slerp)
|
||||
{
|
||||
const double square_vector = augment->x1 * augment->x1 + augment->x2 * augment->x2 + augment->x3 * augment->x3;
|
||||
const double square_vector = augment->_x1 * augment->_x1 + augment->_x2 * augment->_x2 + augment->_x3 * augment->_x3;
|
||||
|
||||
if (square_vector != square_vector) {
|
||||
bgc_slerp_reset_fp64(slerp);
|
||||
|
|
@ -63,10 +63,10 @@ void bgc_slerp_make_fp64(const BgcVersorFP64* start, const BgcVersorFP64* augmen
|
|||
}
|
||||
|
||||
if (square_vector <= BGC_SQUARE_EPSYLON_FP64) {
|
||||
slerp->s0_cos_weight = start->s0;
|
||||
slerp->x1_cos_weight = start->x1;
|
||||
slerp->x2_cos_weight = start->x2;
|
||||
slerp->x3_cos_weight = start->x3;
|
||||
slerp->s0_cos_weight = start->_s0;
|
||||
slerp->x1_cos_weight = start->_x1;
|
||||
slerp->x2_cos_weight = start->_x2;
|
||||
slerp->x3_cos_weight = start->_x3;
|
||||
|
||||
slerp->s0_sin_weight = 0.0;
|
||||
slerp->x1_sin_weight = 0.0;
|
||||
|
|
@ -79,17 +79,17 @@ void bgc_slerp_make_fp64(const BgcVersorFP64* start, const BgcVersorFP64* augmen
|
|||
|
||||
const double vector_modulus = sqrt(square_vector);
|
||||
|
||||
slerp->radians = atan2(vector_modulus, augment->s0);
|
||||
slerp->radians = atan2(vector_modulus, augment->_s0);
|
||||
|
||||
const double multiplier = 1.0 / vector_modulus;
|
||||
|
||||
slerp->s0_cos_weight = start->s0;
|
||||
slerp->x1_cos_weight = start->x1;
|
||||
slerp->x2_cos_weight = start->x2;
|
||||
slerp->x3_cos_weight = start->x3;
|
||||
slerp->s0_cos_weight = start->_s0;
|
||||
slerp->x1_cos_weight = start->_x1;
|
||||
slerp->x2_cos_weight = start->_x2;
|
||||
slerp->x3_cos_weight = start->_x3;
|
||||
|
||||
slerp->s0_sin_weight = -multiplier * (augment->x1 * start->x1 + augment->x2 * start->x2 + augment->x3 * start->x3);
|
||||
slerp->x1_sin_weight = multiplier * (augment->x1 * start->s0 + augment->x2 * start->x3 - augment->x3 * start->x2);
|
||||
slerp->x2_sin_weight = multiplier * (augment->x2 * start->s0 - augment->x1 * start->x3 + augment->x3 * start->x1);
|
||||
slerp->x3_sin_weight = multiplier * (augment->x3 * start->s0 - augment->x2 * start->x1 + augment->x1 * start->x2);
|
||||
slerp->s0_sin_weight = -multiplier * (augment->_x1 * start->_x1 + augment->_x2 * start->_x2 + augment->_x3 * start->_x3);
|
||||
slerp->x1_sin_weight = multiplier * (augment->_x1 * start->_s0 + augment->_x2 * start->_x3 - augment->_x3 * start->_x2);
|
||||
slerp->x2_sin_weight = multiplier * (augment->_x2 * start->_s0 - augment->_x1 * start->_x3 + augment->_x3 * start->_x1);
|
||||
slerp->x3_sin_weight = multiplier * (augment->_x3 * start->_s0 - augment->_x2 * start->_x1 + augment->_x1 * start->_x2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue