Развитие дуальный чисел, векторов и кватернионов, а также гомогенных векторов и матриц
This commit is contained in:
parent
3f96b661a9
commit
b87518cd3f
21 changed files with 1787 additions and 1511 deletions
|
|
@ -635,17 +635,17 @@ inline int bgc_fp32_quaternion_get_rotation_matrix(BGC_FP32_Matrix3x3* rotation,
|
|||
|
||||
const float corrector2 = 2.0f * corrector1;
|
||||
|
||||
rotation->row1_col1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
|
||||
rotation->row2_col2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
|
||||
rotation->row3_col3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
|
||||
rotation->r1c1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
|
||||
rotation->r2c2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
|
||||
rotation->r3c3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
|
||||
|
||||
rotation->row1_col2 = corrector2 * (x1x2 - s0x3);
|
||||
rotation->row2_col3 = corrector2 * (x2x3 - s0x1);
|
||||
rotation->row3_col1 = corrector2 * (x1x3 - s0x2);
|
||||
rotation->r1c2 = corrector2 * (x1x2 - s0x3);
|
||||
rotation->r2c3 = corrector2 * (x2x3 - s0x1);
|
||||
rotation->r3c1 = corrector2 * (x1x3 - s0x2);
|
||||
|
||||
rotation->row2_col1 = corrector2 * (x1x2 + s0x3);
|
||||
rotation->row3_col2 = corrector2 * (x2x3 + s0x1);
|
||||
rotation->row1_col3 = corrector2 * (x1x3 + s0x2);
|
||||
rotation->r2c1 = corrector2 * (x1x2 + s0x3);
|
||||
rotation->r3c2 = corrector2 * (x2x3 + s0x1);
|
||||
rotation->r1c3 = corrector2 * (x1x3 + s0x2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -676,17 +676,17 @@ inline int bgc_fp64_quaternion_get_rotation_matrix(BGC_FP64_Matrix3x3* rotation,
|
|||
|
||||
const double corrector2 = 2.0f * corrector1;
|
||||
|
||||
rotation->row1_col1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
|
||||
rotation->row2_col2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
|
||||
rotation->row3_col3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
|
||||
rotation->r1c1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
|
||||
rotation->r2c2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
|
||||
rotation->r3c3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
|
||||
|
||||
rotation->row1_col2 = corrector2 * (x1x2 - s0x3);
|
||||
rotation->row2_col3 = corrector2 * (x2x3 - s0x1);
|
||||
rotation->row3_col1 = corrector2 * (x1x3 - s0x2);
|
||||
rotation->r1c2 = corrector2 * (x1x2 - s0x3);
|
||||
rotation->r2c3 = corrector2 * (x2x3 - s0x1);
|
||||
rotation->r3c1 = corrector2 * (x1x3 - s0x2);
|
||||
|
||||
rotation->row2_col1 = corrector2 * (x1x2 + s0x3);
|
||||
rotation->row3_col2 = corrector2 * (x2x3 + s0x1);
|
||||
rotation->row1_col3 = corrector2 * (x1x3 + s0x2);
|
||||
rotation->r2c1 = corrector2 * (x1x2 + s0x3);
|
||||
rotation->r3c2 = corrector2 * (x2x3 + s0x1);
|
||||
rotation->r1c3 = corrector2 * (x1x3 + s0x2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -719,17 +719,17 @@ inline int bgc_fp32_quaternion_get_reverse_matrix(BGC_FP32_Matrix3x3* reverse, c
|
|||
|
||||
const float corrector2 = 2.0f * corrector1;
|
||||
|
||||
reverse->row1_col1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
|
||||
reverse->row2_col2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
|
||||
reverse->row3_col3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
|
||||
reverse->r1c1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
|
||||
reverse->r2c2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
|
||||
reverse->r3c3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
|
||||
|
||||
reverse->row1_col2 = corrector2 * (x1x2 + s0x3);
|
||||
reverse->row2_col3 = corrector2 * (x2x3 + s0x1);
|
||||
reverse->row3_col1 = corrector2 * (x1x3 + s0x2);
|
||||
reverse->r1c2 = corrector2 * (x1x2 + s0x3);
|
||||
reverse->r2c3 = corrector2 * (x2x3 + s0x1);
|
||||
reverse->r3c1 = corrector2 * (x1x3 + s0x2);
|
||||
|
||||
reverse->row2_col1 = corrector2 * (x1x2 - s0x3);
|
||||
reverse->row3_col2 = corrector2 * (x2x3 - s0x1);
|
||||
reverse->row1_col3 = corrector2 * (x1x3 - s0x2);
|
||||
reverse->r2c1 = corrector2 * (x1x2 - s0x3);
|
||||
reverse->r3c2 = corrector2 * (x2x3 - s0x1);
|
||||
reverse->r1c3 = corrector2 * (x1x3 - s0x2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -760,17 +760,17 @@ inline int bgc_fp64_quaternion_get_reverse_matrix(BGC_FP64_Matrix3x3* reverse, c
|
|||
|
||||
const double corrector2 = 2.0f * corrector1;
|
||||
|
||||
reverse->row1_col1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
|
||||
reverse->row2_col2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
|
||||
reverse->row3_col3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
|
||||
reverse->r1c1 = corrector1 * ((s0s0 + x1x1) - (x2x2 + x3x3));
|
||||
reverse->r2c2 = corrector1 * ((s0s0 + x2x2) - (x1x1 + x3x3));
|
||||
reverse->r3c3 = corrector1 * ((s0s0 + x3x3) - (x1x1 + x2x2));
|
||||
|
||||
reverse->row1_col2 = corrector2 * (x1x2 + s0x3);
|
||||
reverse->row2_col3 = corrector2 * (x2x3 + s0x1);
|
||||
reverse->row3_col1 = corrector2 * (x1x3 + s0x2);
|
||||
reverse->r1c2 = corrector2 * (x1x2 + s0x3);
|
||||
reverse->r2c3 = corrector2 * (x2x3 + s0x1);
|
||||
reverse->r3c1 = corrector2 * (x1x3 + s0x2);
|
||||
|
||||
reverse->row2_col1 = corrector2 * (x1x2 - s0x3);
|
||||
reverse->row3_col2 = corrector2 * (x2x3 - s0x1);
|
||||
reverse->row1_col3 = corrector2 * (x1x3 - s0x2);
|
||||
reverse->r2c1 = corrector2 * (x1x2 - s0x3);
|
||||
reverse->r3c2 = corrector2 * (x2x3 - s0x1);
|
||||
reverse->r1c3 = corrector2 * (x1x3 - s0x2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue