Переименование 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,28 +12,28 @@
|
|||
|
||||
inline void bgc_fp32_rigid_pose3_reset(BGC_FP32_RigidPose3* const pose)
|
||||
{
|
||||
pose->_versor.real_part.s0 = 1.0f;
|
||||
pose->_versor.real_part.x1 = 0.0f;
|
||||
pose->_versor.real_part.x2 = 0.0f;
|
||||
pose->_versor.real_part.x3 = 0.0f;
|
||||
pose->_versor.real_part.s = 1.0f;
|
||||
pose->_versor.real_part.x = 0.0f;
|
||||
pose->_versor.real_part.y = 0.0f;
|
||||
pose->_versor.real_part.z = 0.0f;
|
||||
|
||||
pose->_versor.dual_part.s0 = 0.0f;
|
||||
pose->_versor.dual_part.x1 = 0.0f;
|
||||
pose->_versor.dual_part.x2 = 0.0f;
|
||||
pose->_versor.dual_part.x3 = 0.0f;
|
||||
pose->_versor.dual_part.s = 0.0f;
|
||||
pose->_versor.dual_part.x = 0.0f;
|
||||
pose->_versor.dual_part.y = 0.0f;
|
||||
pose->_versor.dual_part.z = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_rigid_pose3_reset(BGC_FP64_RigidPose3* const pose)
|
||||
{
|
||||
pose->_versor.real_part.s0 = 1.0;
|
||||
pose->_versor.real_part.x1 = 0.0;
|
||||
pose->_versor.real_part.x2 = 0.0;
|
||||
pose->_versor.real_part.x3 = 0.0;
|
||||
pose->_versor.real_part.s = 1.0;
|
||||
pose->_versor.real_part.x = 0.0;
|
||||
pose->_versor.real_part.y = 0.0;
|
||||
pose->_versor.real_part.z = 0.0;
|
||||
|
||||
pose->_versor.dual_part.s0 = 0.0;
|
||||
pose->_versor.dual_part.x1 = 0.0;
|
||||
pose->_versor.dual_part.x2 = 0.0;
|
||||
pose->_versor.dual_part.x3 = 0.0;
|
||||
pose->_versor.dual_part.s = 0.0;
|
||||
pose->_versor.dual_part.x = 0.0;
|
||||
pose->_versor.dual_part.y = 0.0;
|
||||
pose->_versor.dual_part.z = 0.0;
|
||||
}
|
||||
|
||||
// ================= Normalize ================== //
|
||||
|
|
@ -182,7 +182,7 @@ inline void bgc_fp64_rigid_pose3_convert_to_fp32(BGC_FP32_RigidPose3* const dest
|
|||
|
||||
inline void bgc_fp32_rigid_pose3_shorten(BGC_FP32_RigidPose3* const pose)
|
||||
{
|
||||
if (pose->_versor.real_part.s0 < 0.0f) {
|
||||
if (pose->_versor.real_part.s < 0.0f) {
|
||||
bgc_fp32_quaternion_revert(&pose->_versor.real_part);
|
||||
bgc_fp32_quaternion_revert(&pose->_versor.dual_part);
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ inline void bgc_fp32_rigid_pose3_shorten(BGC_FP32_RigidPose3* const pose)
|
|||
|
||||
inline void bgc_fp64_rigid_pose3_shorten(BGC_FP64_RigidPose3* const pose)
|
||||
{
|
||||
if (pose->_versor.real_part.s0 < 0.0) {
|
||||
if (pose->_versor.real_part.s < 0.0) {
|
||||
bgc_fp64_quaternion_revert(&pose->_versor.real_part);
|
||||
bgc_fp64_quaternion_revert(&pose->_versor.dual_part);
|
||||
}
|
||||
|
|
@ -200,7 +200,7 @@ inline void bgc_fp64_rigid_pose3_shorten(BGC_FP64_RigidPose3* const pose)
|
|||
|
||||
inline void bgc_fp32_rigid_pose3_get_shortened(BGC_FP32_RigidPose3* const shortened, const BGC_FP32_RigidPose3* const pose)
|
||||
{
|
||||
if (pose->_versor.real_part.s0 < 0.0f) {
|
||||
if (pose->_versor.real_part.s < 0.0f) {
|
||||
bgc_fp32_quaternion_get_reverse(&shortened->_versor.real_part, &pose->_versor.real_part);
|
||||
bgc_fp32_quaternion_get_reverse(&shortened->_versor.dual_part, &pose->_versor.dual_part);
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ inline void bgc_fp32_rigid_pose3_get_shortened(BGC_FP32_RigidPose3* const shorte
|
|||
|
||||
inline void bgc_fp64_rigid_pose3_get_shortened(BGC_FP64_RigidPose3* const shortened, const BGC_FP64_RigidPose3* const pose)
|
||||
{
|
||||
if (pose->_versor.real_part.s0 < 0.0) {
|
||||
if (pose->_versor.real_part.s < 0.0) {
|
||||
bgc_fp64_quaternion_get_reverse(&shortened->_versor.real_part, &pose->_versor.real_part);
|
||||
bgc_fp64_quaternion_get_reverse(&shortened->_versor.dual_part, &pose->_versor.dual_part);
|
||||
}
|
||||
|
|
@ -351,9 +351,9 @@ inline void bgc_fp32_rigid_pose3_get_shift(BGC_FP32_Vector3* const shift, const
|
|||
const BGC_FP32_Quaternion* const real = &pose->_versor.real_part;
|
||||
const BGC_FP32_Quaternion* const dual = &pose->_versor.dual_part;
|
||||
|
||||
shift->x1 = 2.0f * ((dual->x1 * real->s0 + dual->x3 * real->x2) - (dual->s0 * real->x1 + dual->x2 * real->x3));
|
||||
shift->x2 = 2.0f * ((dual->x2 * real->s0 + dual->x1 * real->x3) - (dual->s0 * real->x2 + dual->x3 * real->x1));
|
||||
shift->x3 = 2.0f * ((dual->x3 * real->s0 + dual->x2 * real->x1) - (dual->s0 * real->x3 + dual->x1 * real->x2));
|
||||
shift->x = 2.0f * ((dual->x * real->s + dual->z * real->y) - (dual->s * real->x + dual->y * real->z));
|
||||
shift->y = 2.0f * ((dual->y * real->s + dual->x * real->z) - (dual->s * real->y + dual->z * real->x));
|
||||
shift->z = 2.0f * ((dual->z * real->s + dual->y * real->x) - (dual->s * real->z + dual->x * real->y));
|
||||
}
|
||||
|
||||
inline void bgc_fp64_rigid_pose3_get_shift(BGC_FP64_Vector3* const shift, const BGC_FP64_RigidPose3* const pose)
|
||||
|
|
@ -361,9 +361,9 @@ inline void bgc_fp64_rigid_pose3_get_shift(BGC_FP64_Vector3* const shift, const
|
|||
const BGC_FP64_Quaternion* const real = &pose->_versor.real_part;
|
||||
const BGC_FP64_Quaternion* const dual = &pose->_versor.dual_part;
|
||||
|
||||
shift->x1 = 2.0 * ((dual->x1 * real->s0 + dual->x3 * real->x2) - (dual->s0 * real->x1 + dual->x2 * real->x3));
|
||||
shift->x2 = 2.0 * ((dual->x2 * real->s0 + dual->x1 * real->x3) - (dual->s0 * real->x2 + dual->x3 * real->x1));
|
||||
shift->x3 = 2.0 * ((dual->x3 * real->s0 + dual->x2 * real->x1) - (dual->s0 * real->x3 + dual->x1 * real->x2));
|
||||
shift->x = 2.0 * ((dual->x * real->s + dual->z * real->y) - (dual->s * real->x + dual->y * real->z));
|
||||
shift->y = 2.0 * ((dual->y * real->s + dual->x * real->z) - (dual->s * real->y + dual->z * real->x));
|
||||
shift->z = 2.0 * ((dual->z * real->s + dual->y * real->x) - (dual->s * real->z + dual->x * real->y));
|
||||
}
|
||||
|
||||
// ============= Get Reverse Shift ============= //
|
||||
|
|
@ -373,9 +373,9 @@ inline void bgc_fp32_rigid_pose3_get_reverse_shift(BGC_FP32_Vector3* const shift
|
|||
const BGC_FP32_Quaternion* const real = &pose->_versor.real_part;
|
||||
const BGC_FP32_Quaternion* const dual = &pose->_versor.dual_part;
|
||||
|
||||
shift->x1 = 2.0f * ((dual->s0 * real->x1 - dual->x1 * real->s0) + (dual->x3 * real->x2 - dual->x2 * real->x3));
|
||||
shift->x2 = 2.0f * ((dual->s0 * real->x2 - dual->x2 * real->s0) + (dual->x1 * real->x3 - dual->x3 * real->x1));
|
||||
shift->x3 = 2.0f * ((dual->s0 * real->x3 - dual->x3 * real->s0) + (dual->x2 * real->x1 - dual->x1 * real->x2));
|
||||
shift->x = 2.0f * ((dual->s * real->x - dual->x * real->s) + (dual->z * real->y - dual->y * real->z));
|
||||
shift->y = 2.0f * ((dual->s * real->y - dual->y * real->s) + (dual->x * real->z - dual->z * real->x));
|
||||
shift->z = 2.0f * ((dual->s * real->z - dual->z * real->s) + (dual->y * real->x - dual->x * real->y));
|
||||
}
|
||||
|
||||
inline void bgc_fp64_rigid_pose3_get_reverse_shift(BGC_FP64_Vector3* const shift, const BGC_FP64_RigidPose3* const pose)
|
||||
|
|
@ -383,9 +383,9 @@ inline void bgc_fp64_rigid_pose3_get_reverse_shift(BGC_FP64_Vector3* const shift
|
|||
const BGC_FP64_Quaternion* const real = &pose->_versor.real_part;
|
||||
const BGC_FP64_Quaternion* const dual = &pose->_versor.dual_part;
|
||||
|
||||
shift->x1 = 2.0 * ((dual->s0 * real->x1 - dual->x1 * real->s0) + (dual->x3 * real->x2 - dual->x2 * real->x3));
|
||||
shift->x2 = 2.0 * ((dual->s0 * real->x2 - dual->x2 * real->s0) + (dual->x1 * real->x3 - dual->x3 * real->x1));
|
||||
shift->x3 = 2.0 * ((dual->s0 * real->x3 - dual->x3 * real->s0) + (dual->x2 * real->x1 - dual->x1 * real->x2));
|
||||
shift->x = 2.0 * ((dual->s * real->x - dual->x * real->s) + (dual->z * real->y - dual->y * real->z));
|
||||
shift->y = 2.0 * ((dual->s * real->y - dual->y * real->s) + (dual->x * real->z - dual->z * real->x));
|
||||
shift->z = 2.0 * ((dual->s * real->z - dual->z * real->s) + (dual->y * real->x - dual->x * real->y));
|
||||
}
|
||||
|
||||
// ================ Get Affine3 ================= //
|
||||
|
|
@ -439,10 +439,10 @@ inline void bgc_fp32_rigid_pose3_set_position(BGC_FP32_RigidPose3* const pose, c
|
|||
|
||||
bgc_fp32_quaternion_copy(&pose->_versor.real_part, versor);
|
||||
|
||||
pose->_versor.dual_part.s0 = -0.5f * (shift->x1 * versor->x1 + shift->x2 * versor->x2 + shift->x3 * versor->x3);
|
||||
pose->_versor.dual_part.x1 = -0.5f * (shift->x3 * versor->x2 - shift->x2 * versor->x3 - shift->x1 * versor->s0);
|
||||
pose->_versor.dual_part.x2 = -0.5f * (shift->x1 * versor->x3 - shift->x3 * versor->x1 - shift->x2 * versor->s0);
|
||||
pose->_versor.dual_part.x3 = -0.5f * (shift->x2 * versor->x1 - shift->x1 * versor->x2 - shift->x3 * versor->s0);
|
||||
pose->_versor.dual_part.s = -0.5f * (shift->x * versor->x + shift->y * versor->y + shift->z * versor->z);
|
||||
pose->_versor.dual_part.x = -0.5f * (shift->z * versor->y - shift->y * versor->z - shift->x * versor->s);
|
||||
pose->_versor.dual_part.y = -0.5f * (shift->x * versor->z - shift->z * versor->x - shift->y * versor->s);
|
||||
pose->_versor.dual_part.z = -0.5f * (shift->y * versor->x - shift->x * versor->y - shift->z * versor->s);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_rigid_pose3_set_position(BGC_FP64_RigidPose3* const pose, const BGC_FP64_Position3* const position)
|
||||
|
|
@ -452,10 +452,10 @@ inline void bgc_fp64_rigid_pose3_set_position(BGC_FP64_RigidPose3* const pose, c
|
|||
|
||||
bgc_fp64_quaternion_copy(&pose->_versor.real_part, versor);
|
||||
|
||||
pose->_versor.dual_part.s0 = -0.5 * (shift->x1 * versor->x1 + shift->x2 * versor->x2 + shift->x3 * versor->x3);
|
||||
pose->_versor.dual_part.x1 = -0.5 * (shift->x3 * versor->x2 - shift->x2 * versor->x3 - shift->x1 * versor->s0);
|
||||
pose->_versor.dual_part.x2 = -0.5 * (shift->x1 * versor->x3 - shift->x3 * versor->x1 - shift->x2 * versor->s0);
|
||||
pose->_versor.dual_part.x3 = -0.5 * (shift->x2 * versor->x1 - shift->x1 * versor->x2 - shift->x3 * versor->s0);
|
||||
pose->_versor.dual_part.s = -0.5 * (shift->x * versor->x + shift->y * versor->y + shift->z * versor->z);
|
||||
pose->_versor.dual_part.x = -0.5 * (shift->z * versor->y - shift->y * versor->z - shift->x * versor->s);
|
||||
pose->_versor.dual_part.y = -0.5 * (shift->x * versor->z - shift->z * versor->x - shift->y * versor->s);
|
||||
pose->_versor.dual_part.z = -0.5 * (shift->y * versor->x - shift->x * versor->y - shift->z * versor->s);
|
||||
}
|
||||
|
||||
// =========== Get Reverse Position3 ============ //
|
||||
|
|
@ -481,10 +481,10 @@ inline void bgc_fp32_rigid_pose3_set_reverse_position(BGC_FP32_RigidPose3* const
|
|||
|
||||
bgc_fp32_quaternion_get_conjugate(&pose->_versor.real_part, versor);
|
||||
|
||||
pose->_versor.dual_part.s0 = -0.5f * (versor->x1 * shift->x1 + versor->x2 * shift->x2 + versor->x3 * shift->x3);
|
||||
pose->_versor.dual_part.x1 = -0.5f * (versor->s0 * shift->x1 + versor->x3 * shift->x2 - versor->x2 * shift->x3);
|
||||
pose->_versor.dual_part.x2 = -0.5f * (versor->s0 * shift->x2 + versor->x1 * shift->x3 - versor->x3 * shift->x1);
|
||||
pose->_versor.dual_part.x3 = -0.5f * (versor->s0 * shift->x3 + versor->x2 * shift->x1 - versor->x1 * shift->x2);
|
||||
pose->_versor.dual_part.s = -0.5f * (versor->x * shift->x + versor->y * shift->y + versor->z * shift->z);
|
||||
pose->_versor.dual_part.x = -0.5f * (versor->s * shift->x + versor->z * shift->y - versor->y * shift->z);
|
||||
pose->_versor.dual_part.y = -0.5f * (versor->s * shift->y + versor->x * shift->z - versor->z * shift->x);
|
||||
pose->_versor.dual_part.z = -0.5f * (versor->s * shift->z + versor->y * shift->x - versor->x * shift->y);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_rigid_pose3_set_reverse_position(BGC_FP64_RigidPose3* const pose, const BGC_FP64_Position3* const position)
|
||||
|
|
@ -494,10 +494,10 @@ inline void bgc_fp64_rigid_pose3_set_reverse_position(BGC_FP64_RigidPose3* const
|
|||
|
||||
bgc_fp64_quaternion_get_conjugate(&pose->_versor.real_part, versor);
|
||||
|
||||
pose->_versor.dual_part.s0 = -0.5f * (versor->x1 * shift->x1 + versor->x2 * shift->x2 + versor->x3 * shift->x3);
|
||||
pose->_versor.dual_part.x1 = -0.5f * (versor->s0 * shift->x1 + versor->x3 * shift->x2 - versor->x2 * shift->x3);
|
||||
pose->_versor.dual_part.x2 = -0.5f * (versor->s0 * shift->x2 + versor->x1 * shift->x3 - versor->x3 * shift->x1);
|
||||
pose->_versor.dual_part.x3 = -0.5f * (versor->s0 * shift->x3 + versor->x2 * shift->x1 - versor->x1 * shift->x2);
|
||||
pose->_versor.dual_part.s = -0.5f * (versor->x * shift->x + versor->y * shift->y + versor->z * shift->z);
|
||||
pose->_versor.dual_part.x = -0.5f * (versor->s * shift->x + versor->z * shift->y - versor->y * shift->z);
|
||||
pose->_versor.dual_part.y = -0.5f * (versor->s * shift->y + versor->x * shift->z - versor->z * shift->x);
|
||||
pose->_versor.dual_part.z = -0.5f * (versor->s * shift->z + versor->y * shift->x - versor->x * shift->y);
|
||||
}
|
||||
|
||||
// ============== Transform Vector ============== //
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue