Рефакторинг и оптимизация вычислений / Refactoring and optimization of computations
This commit is contained in:
parent
03e390c1d0
commit
2655e43cb4
15 changed files with 810 additions and 829 deletions
|
|
@ -181,6 +181,12 @@ static inline double bg_fp64_quaternion_get_modulus(const BgFP64Quaternion* quat
|
|||
return sqrt(bg_fp64_quaternion_get_square_modulus(quaternion));
|
||||
}
|
||||
|
||||
// =============== Normalization ================ //
|
||||
|
||||
int bg_fp32_quaternion_normalize(BgFP32Quaternion* quaternion);
|
||||
|
||||
int bg_fp64_quaternion_normalize(BgFP64Quaternion* quaternion);
|
||||
|
||||
// ============ Make Rotation Matrix ============ //
|
||||
|
||||
void bg_fp32_quaternion_get_rotation_matrix(const BgFP32Quaternion* quaternion, BgFP32Matrix3x3* matrix);
|
||||
|
|
@ -213,48 +219,56 @@ static inline void bg_fp64_quaternion_add(const BgFP64Quaternion * quaternion1,
|
|||
|
||||
// ================== Subtract ================== //
|
||||
|
||||
static inline void bg_fp32_quaternion_subtract(const BgFP32Quaternion * minuend, const BgFP32Quaternion * subtrahend, BgFP32Quaternion * result)
|
||||
static inline void bg_fp32_quaternion_subtract(const BgFP32Quaternion * minuend, const BgFP32Quaternion * subtrahend, BgFP32Quaternion * difference)
|
||||
{
|
||||
result->s0 = minuend->s0 - subtrahend->s0;
|
||||
result->x1 = minuend->x1 - subtrahend->x1;
|
||||
result->x2 = minuend->x2 - subtrahend->x2;
|
||||
result->x3 = minuend->x3 - subtrahend->x3;
|
||||
difference->s0 = minuend->s0 - subtrahend->s0;
|
||||
difference->x1 = minuend->x1 - subtrahend->x1;
|
||||
difference->x2 = minuend->x2 - subtrahend->x2;
|
||||
difference->x3 = minuend->x3 - subtrahend->x3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_quaternion_subtract(const BgFP64Quaternion * minuend, const BgFP64Quaternion * subtrahend, BgFP64Quaternion * result)
|
||||
static inline void bg_fp64_quaternion_subtract(const BgFP64Quaternion * minuend, const BgFP64Quaternion * subtrahend, BgFP64Quaternion * difference)
|
||||
{
|
||||
result->s0 = minuend->s0 - subtrahend->s0;
|
||||
result->x1 = minuend->x1 - subtrahend->x1;
|
||||
result->x2 = minuend->x2 - subtrahend->x2;
|
||||
result->x3 = minuend->x3 - subtrahend->x3;
|
||||
difference->s0 = minuend->s0 - subtrahend->s0;
|
||||
difference->x1 = minuend->x1 - subtrahend->x1;
|
||||
difference->x2 = minuend->x2 - subtrahend->x2;
|
||||
difference->x3 = minuend->x3 - subtrahend->x3;
|
||||
}
|
||||
|
||||
// =============== Multiplication =============== //
|
||||
|
||||
static inline void bg_fp32_quaternion_multiply(const BgFP32Quaternion* left, const BgFP32Quaternion* right, BgFP32Quaternion* result)
|
||||