Добавление проверки определителя матрицы, которая является кандидатом на матрицу поворота
This commit is contained in:
parent
b777560d93
commit
75cd82de6a
2 changed files with 16 additions and 0 deletions
|
@ -113,6 +113,10 @@ inline int bgc_matrix2x2_is_singular_fp64(const BgcMatrix2x2FP64* matrix)
|
|||
|
||||
inline int bgc_matrix2x2_is_rotation_fp32(const BgcMatrix2x2FP32* matrix)
|
||||
{
|
||||
if (!bgc_is_unit_fp32(bgc_matrix2x2_get_determinant_fp32(matrix))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const float product_r1c1 = matrix->r1c1 * matrix->r1c1 + matrix->r1c2 * matrix->r2c1;
|
||||
const float product_r1c2 = matrix->r1c1 * matrix->r1c2 + matrix->r1c2 * matrix->r2c2;
|
||||
|
||||
|
@ -125,6 +129,10 @@ inline int bgc_matrix2x2_is_rotation_fp32(const BgcMatrix2x2FP32* matrix)
|
|||
|
||||
inline int bgc_matrix2x2_is_rotation_fp64(const BgcMatrix2x2FP64* matrix)
|
||||
{
|
||||
if (!bgc_is_unit_fp64(bgc_matrix2x2_get_determinant_fp64(matrix))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const double product_r1c1 = matrix->r1c1 * matrix->r1c1 + matrix->r1c2 * matrix->r2c1;
|
||||
const double product_r1c2 = matrix->r1c1 * matrix->r1c2 + matrix->r1c2 * matrix->r2c2;
|
||||
|
||||
|
|
|
@ -276,6 +276,10 @@ inline int bgc_matrix3x3_is_singular_fp64(const BgcMatrix3x3FP64* matrix)
|
|||
|
||||
inline int bgc_matrix3x3_is_rotation_fp32(const BgcMatrix3x3FP32* matrix)
|
||||
{
|
||||
if (!bgc_is_unit_fp32(bgc_matrix3x3_get_determinant_fp32(matrix))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const float product_r1c1 = matrix->r1c1 * matrix->r1c1 + matrix->r1c2 * matrix->r2c1 + matrix->r1c3 * matrix->r3c1;
|
||||
const float product_r1c2 = matrix->r1c1 * matrix->r1c2 + matrix->r1c2 * matrix->r2c2 + matrix->r1c3 * matrix->r3c2;
|
||||
const float product_r1c3 = matrix->r1c1 * matrix->r1c3 + matrix->r1c2 * matrix->r2c3 + matrix->r1c3 * matrix->r3c3;
|
||||
|
@ -295,6 +299,10 @@ inline int bgc_matrix3x3_is_rotation_fp32(const BgcMatrix3x3FP32* matrix)
|
|||
|
||||
inline int bgc_matrix3x3_is_rotation_fp64(const BgcMatrix3x3FP64* matrix)
|
||||
{
|
||||
if (!bgc_is_unit_fp64(bgc_matrix3x3_get_determinant_fp64(matrix))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const double product_r1c1 = matrix->r1c1 * matrix->r1c1 + matrix->r1c2 * matrix->r2c1 + matrix->r1c3 * matrix->r3c1;
|
||||
const double product_r1c2 = matrix->r1c1 * matrix->r1c2 + matrix->r1c2 * matrix->r2c2 + matrix->r1c3 * matrix->r3c2;
|
||||
const double product_r1c3 = matrix->r1c1 * matrix->r1c3 + matrix->r1c2 * matrix->r2c3 + matrix->r1c3 * matrix->r3c3;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue