Добавление restricted функций, нормализация дуальных кватернионов и позиции твёрдого тела (rigid pose3)
This commit is contained in:
parent
7591b20f41
commit
24d37be75d
7 changed files with 130 additions and 82 deletions
|
|
@ -479,6 +479,22 @@ inline double bgc_fp64_vector3_get_triple_product(const BGC_FP64_Vector3* vector
|
|||
+ vector1->x3 * (vector2->x1 * vector3->x2 - vector2->x2 * vector3->x1);
|
||||
}
|
||||
|
||||
// =========== Restrict Cross Product =========== //
|
||||
|
||||
inline void _bgc_fp32_restrict_vector3_get_cross_product(BGC_FP32_Vector3* restrict product, const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2)
|
||||
{
|
||||
product->x1 = vector1->x2 * vector2->x3 - vector1->x3 * vector2->x2;
|
||||
product->x2 = vector1->x3 * vector2->x1 - vector1->x1 * vector2->x3;
|
||||
product->x3 = vector1->x1 * vector2->x2 - vector1->x2 * vector2->x1;
|
||||
}
|
||||
|
||||
inline void _bgc_fp64_restrict_vector3_get_cross_product(BGC_FP64_Vector3* restrict product, const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2)
|
||||
{
|
||||
product->x1 = vector1->x2 * vector2->x3 - vector1->x3 * vector2->x2;
|
||||
product->x2 = vector1->x3 * vector2->x1 - vector1->x1 * vector2->x3;
|
||||
product->x3 = vector1->x1 * vector2->x2 - vector1->x2 * vector2->x1;
|
||||
}
|
||||
|
||||
// =============== Cross Product ================ //
|
||||
|
||||
inline void bgc_fp32_vector3_get_cross_product(BGC_FP32_Vector3* product, const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2)
|
||||
|
|
@ -642,7 +658,7 @@ inline int bgc_fp32_vector3_are_parallel(const BGC_FP32_Vector3* vector1, const
|
|||
|
||||
BGC_FP32_Vector3 product;
|
||||
|
||||
bgc_fp32_vector3_get_cross_product(&product, vector1, vector2);
|
||||
_bgc_fp32_restrict_vector3_get_cross_product(&product, vector1, vector2);
|
||||
|
||||
return bgc_fp32_vector3_get_squared_length(&product) <= BGC_FP32_SQUARE_EPSILON * square_modulus1 * square_modulus2;
|
||||
}
|
||||
|
|
@ -658,7 +674,7 @@ inline int bgc_fp64_vector3_are_parallel(const BGC_FP64_Vector3* vector1, const
|
|||
|
||||
BGC_FP64_Vector3 product;
|
||||
|
||||
bgc_fp64_vector3_get_cross_product(&product, vector1, vector2);
|
||||
_bgc_fp64_restrict_vector3_get_cross_product(&product, vector1, vector2);
|
||||
|
||||
return bgc_fp64_vector3_get_squared_length(&product) <= BGC_FP64_SQUARE_EPSILON * square_modulus1 * square_modulus2;
|
||||
}
|
||||
|
|
@ -714,7 +730,7 @@ inline int bgc_fp32_vector3_get_attitude(const BGC_FP32_Vector3* vector1, const
|
|||
|
||||
BGC_FP32_Vector3 product;
|
||||
|
||||
bgc_fp32_vector3_get_cross_product(&product, vector1, vector2);
|
||||
_bgc_fp32_restrict_vector3_get_cross_product(&product, vector1, vector2);
|
||||
|
||||
if (bgc_fp32_vector3_get_squared_length(&product) > square_limit) {
|
||||
return BGC_ATTITUDE_ANY;
|
||||
|
|
@ -742,7 +758,7 @@ inline int bgc_fp64_vector3_get_attitude(const BGC_FP64_Vector3* vector1, const
|
|||
|
||||
BGC_FP64_Vector3 product;
|
||||
|
||||
bgc_fp64_vector3_get_cross_product(&product, vector1, vector2);
|
||||
_bgc_fp64_restrict_vector3_get_cross_product(&product, vector1, vector2);
|
||||
|
||||
if (bgc_fp64_vector3_get_squared_length(&product) > square_limit) {
|
||||
return BGC_ATTITUDE_ANY;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue