Небольшие исправления, а также добавление гомогенного трёхмерного вектора
This commit is contained in:
parent
03627f4401
commit
043cc72c81
25 changed files with 1686 additions and 1644 deletions
|
|
@ -192,12 +192,12 @@ inline void bgc_fp64_versor_swap(BGC_FP64_Versor* versor1, BGC_FP64_Versor* vers
|
|||
|
||||
inline int bgc_fp32_versor_is_idle(const BGC_FP32_Versor* versor)
|
||||
{
|
||||
return versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3 <= BGC_FP32_SQUARE_EPSYLON;
|
||||
return versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3 <= BGC_FP32_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_versor_is_idle(const BGC_FP64_Versor* versor)
|
||||
{
|
||||
return versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3 <= BGC_FP64_SQUARE_EPSYLON;
|
||||
return versor->_x1 * versor->_x1 + versor->_x2 * versor->_x2 + versor->_x3 * versor->_x3 <= BGC_FP64_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
// ================== Convert =================== //
|
||||
|
|
@ -460,17 +460,17 @@ inline void bgc_fp32_versor_get_rotation_matrix(BGC_FP32_Matrix3x3* matrix, cons
|
|||
const float x1x3 = versor->_x1 * versor->_x3;
|
||||
const float x2x3 = versor->_x2 * versor->_x3;
|
||||
|
||||
matrix->r1c1 = (s0s0 + x1x1) - (x2x2 + x3x3);
|
||||
matrix->r2c2 = (s0s0 + x2x2) - (x1x1 + x3x3);
|
||||
matrix->r3c3 = (s0s0 + x3x3) - (x1x1 + x2x2);
|
||||
matrix->row1_col1 = (s0s0 + x1x1) - (x2x2 + x3x3);
|
||||
matrix->row2_col2 = (s0s0 + x2x2) - (x1x1 + x3x3);
|
||||
matrix->row3_col3 = (s0s0 + x3x3) - (x1x1 + x2x2);
|
||||
|
||||
matrix->r1c2 = 2.0f * (x1x2 - s0x3);
|
||||
matrix->r2c3 = 2.0f * (x2x3 - s0x1);
|
||||
matrix->r3c1 = 2.0f * (x1x3 - s0x2);
|
||||
matrix->row1_col2 = 2.0f * (x1x2 - s0x3);
|
||||
matrix->row2_col3 = 2.0f * (x2x3 - s0x1);
|
||||
matrix->row3_col1 = 2.0f * (x1x3 - s0x2);
|
||||
|
||||
matrix->r2c1 = 2.0f * (x1x2 + s0x3);
|
||||
matrix->r3c2 = 2.0f * (x2x3 + s0x1);
|
||||
matrix->r1c3 = 2.0f * (x1x3 + s0x2);
|
||||
matrix->row2_col1 = 2.0f * (x1x2 + s0x3);
|
||||
matrix->row3_col2 = 2.0f * (x2x3 + s0x1);
|
||||
matrix->row1_col3 = 2.0f * (x1x3 + s0x2);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_get_rotation_matrix(BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Versor* versor)
|
||||
|
|
@ -487,17 +487,17 @@ inline void bgc_fp64_versor_get_rotation_matrix(BGC_FP64_Matrix3x3* matrix, cons
|
|||
const double x1x3 = versor->_x1 * versor->_x3;
|
||||
const double x2x3 = versor->_x2 * versor->_x3;
|
||||
|
||||
matrix->r1c1 = (s0s0 + x1x1) - (x2x2 + x3x3);
|
||||
matrix->r2c2 = (s0s0 + x2x2) - (x1x1 + x3x3);
|
||||
matrix->r3c3 = (s0s0 + x3x3) - (x1x1 + x2x2);
|
||||
matrix->row1_col1 = (s0s0 + x1x1) - (x2x2 + x3x3);
|
||||
matrix->row2_col2 = (s0s0 + x2x2) - (x1x1 + x3x3);
|
||||
matrix->row3_col3 = (s0s0 + x3x3) - (x1x1 + x2x2);
|
||||
|
||||
matrix->r1c2 = 2.0 * (x1x2 - s0x3);
|
||||
matrix->r2c3 = 2.0 * (x2x3 - s0x1);
|
||||
matrix->r3c1 = 2.0 * (x1x3 - s0x2);
|
||||
matrix->row1_col2 = 2.0 * (x1x2 - s0x3);
|
||||
matrix->row2_col3 = 2.0 * (x2x3 - s0x1);
|
||||
matrix->row3_col1 = 2.0 * (x1x3 - s0x2);
|
||||
|
||||
matrix->r2c1 = 2.0 * (x1x2 + s0x3);
|
||||
matrix->r3c2 = 2.0 * (x2x3 + s0x1);
|
||||
matrix->r1c3 = 2.0 * (x1x3 + s0x2);
|
||||
matrix->row2_col1 = 2.0 * (x1x2 + s0x3);
|
||||
matrix->row3_col2 = 2.0 * (x2x3 + s0x1);
|
||||
matrix->row1_col3 = 2.0 * (x1x3 + s0x2);
|
||||
}
|
||||
|
||||
// ============= Get Reverse Matrix ============= //
|
||||
|
|
@ -516,17 +516,17 @@ inline void bgc_fp32_versor_get_reverse_matrix(BGC_FP32_Matrix3x3* matrix, const
|
|||
const float x1x3 = versor->_x1 * versor->_x3;
|
||||
const float x2x3 = versor->_x2 * versor->_x3;
|
||||
|
||||
matrix->r1c1 = (s0s0 + x1x1) - (x2x2 + x3x3);
|
||||
matrix->r2c2 = (s0s0 + x2x2) - (x1x1 + x3x3);
|
||||
matrix->r3c3 = (s0s0 + x3x3) - (x1x1 + x2x2);
|
||||
matrix->row1_col1 = (s0s0 + x1x1) - (x2x2 + x3x3);
|
||||
matrix->row2_col2 = (s0s0 + x2x2) - (x1x1 + x3x3);
|
||||
matrix->row3_col3 = (s0s0 + x3x3) - (x1x1 + x2x2);
|
||||
|
||||
matrix->r1c2 = 2.0f * (x1x2 + s0x3);
|
||||
matrix->r2c3 = 2.0f * (x2x3 + s0x1);
|
||||
matrix->r3c1 = 2.0f * (x1x3 + s0x2);
|
||||
matrix->row1_col2 = 2.0f * (x1x2 + s0x3);
|
||||
matrix->row2_col3 = 2.0f * (x2x3 + s0x1);
|
||||
matrix->row3_col1 = 2.0f * (x1x3 + s0x2);
|
||||
|
||||
matrix->r2c1 = 2.0f * (x1x2 - s0x3);
|
||||
matrix->r3c2 = 2.0f * (x2x3 - s0x1);
|
||||
matrix->r1c3 = 2.0f * (x1x3 - s0x2);
|
||||
matrix->row2_col1 = 2.0f * (x1x2 - s0x3);
|
||||
matrix->row3_col2 = 2.0f * (x2x3 - s0x1);
|
||||
matrix->row1_col3 = 2.0f * (x1x3 - s0x2);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_versor_get_reverse_matrix(BGC_FP64_Matrix3x3* matrix, const BGC_FP64_Versor* versor)
|
||||
|
|
@ -543,17 +543,17 @@ inline void bgc_fp64_versor_get_reverse_matrix(BGC_FP64_Matrix3x3* matrix, const
|
|||
const double x1x3 = versor->_x1 * versor->_x3;
|
||||
const double x2x3 = versor->_x2 * versor->_x3;
|
||||
|
||||
matrix->r1c1 = (s0s0 + x1x1) - (x2x2 + x3x3);
|
||||
matrix->r2c2 = (s0s0 + x2x2) - (x1x1 + x3x3);
|
||||
matrix->r3c3 = (s0s0 + x3x3) - (x1x1 + x2x2);
|
||||
matrix->row1_col1 = (s0s0 + x1x1) - (x2x2 + x3x3);
|
||||
matrix->row2_col2 = (s0s0 + x2x2) - (x1x1 + x3x3);
|
||||
matrix->row3_col3 = (s0s0 + x3x3) - (x1x1 + x2x2);
|
||||
|
||||
matrix->r1c2 = 2.0 * (x1x2 + s0x3);
|
||||
matrix->r2c3 = 2.0 * (x2x3 + s0x1);
|
||||
matrix->r3c1 = 2.0 * (x1x3 + s0x2);
|
||||
matrix->row1_col2 = 2.0 * (x1x2 + s0x3);
|
||||
matrix->row2_col3 = 2.0 * (x2x3 + s0x1);
|
||||
matrix->row3_col1 = 2.0 * (x1x3 + s0x2);
|
||||
|
||||
matrix->r2c1 = 2.0 * (x1x2 - s0x3);
|
||||
matrix->r3c2 = 2.0 * (x2x3 - s0x1);
|
||||
matrix->r1c3 = 2.0 * (x1x3 - s0x2);
|
||||
matrix->row2_col1 = 2.0 * (x1x2 - s0x3);
|
||||
matrix->row3_col2 = 2.0 * (x2x3 - s0x1);
|
||||
matrix->row1_col3 = 2.0 * (x1x3 - s0x2);
|
||||
}
|
||||
|
||||
// ============= Get Both Matrixes ============== //
|
||||
|
|
@ -643,7 +643,7 @@ inline int bgc_fp32_versor_are_close(const BGC_FP32_Versor* versor1, const BGC_F
|
|||
const float dx2 = versor1->_x2 - versor2->_x2;
|
||||
const float dx3 = versor1->_x3 - versor2->_x3;
|
||||
|
||||
return (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3) <= BGC_FP32_SQUARE_EPSYLON;
|
||||
return (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3) <= BGC_FP32_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_versor_are_close(const BGC_FP64_Versor* versor1, const BGC_FP64_Versor* versor2)
|
||||
|
|
@ -653,7 +653,7 @@ inline int bgc_fp64_versor_are_close(const BGC_FP64_Versor* versor1, const BGC_F
|
|||
const double dx2 = versor1->_x2 - versor2->_x2;
|
||||
const double dx3 = versor1->_x3 - versor2->_x3;
|
||||
|
||||
return (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3) <= BGC_FP64_SQUARE_EPSYLON;
|
||||
return (ds0 * ds0 + dx1 * dx1) + (dx2 * dx2 + dx3 * dx3) <= BGC_FP64_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue