File tree Expand file tree Collapse file tree 5 files changed +57
-18
lines changed
Expand file tree Collapse file tree 5 files changed +57
-18
lines changed Original file line number Diff line number Diff line change 11/*
22 * This file is part of the GreasePad distribution (https://github.com/FraunhoferIOSB/GreasePad).
3- * Copyright (c) 2022-2025 Jochen Meidow, Fraunhofer IOSB
3+ * Copyright (c) 2022-2026 Jochen Meidow, Fraunhofer IOSB
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
1818
1919#include " adjustment.h"
2020#include " constraints.h"
21+ #include " geometry/minrot.h"
2122#include " global.h"
2223#include " matfun.h"
2324#include " matrix.h"
@@ -49,7 +50,8 @@ using Eigen::MatrixXd;
4950using Eigen::SparseMatrix;
5051using Eigen::VectorXidx;
5152
52- using Matfun::Rot_ab;
53+ using Geometry::Rot_ab;
54+
5355using Matfun::null;
5456using Matfun::is_rank_deficient;
5557using Matfun::indexOf;
Original file line number Diff line number Diff line change 11/*
22 * This file is part of the GreasePad distribution (https://github.com/FraunhoferIOSB/GreasePad).
3- * Copyright (c) 2022-2025 Jochen Meidow, Fraunhofer IOSB
3+ * Copyright (c) 2022-2026 Jochen Meidow, Fraunhofer IOSB
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
2929#include < cmath>
3030#include < cstdlib>
3131
32+ #include " geometry/minrot.h"
3233#include " matfun.h"
3334
3435namespace Constraint {
@@ -37,7 +38,8 @@ using Eigen::Vector3d;
3738using Eigen::Vector2cd;
3839using Eigen::Matrix;
3940
40- using Matfun::Rot_ab;
41+ using Geometry::Rot_ab;
42+
4143using Matfun::null;
4244using Matfun::cof3;
4345using Matfun::sign;
Original file line number Diff line number Diff line change 1+ /*
2+ * This file is part of the GreasePad distribution (https://github.com/FraunhoferIOSB/GreasePad).
3+ * Copyright (c) 2022-2026 Jochen Meidow, Fraunhofer IOSB
4+ *
5+ * This program is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
17+ */
18+
19+
20+ #ifndef MINROT_H
21+ #define MINROT_H
22+
23+ #include < cassert>
24+
25+ #include < Eigen/Core>
26+
27+
28+ namespace Geometry {
29+
30+ using Eigen::MatrixXd;
31+ using Eigen::VectorXd;
32+
33+
34+ [[maybe_unused]] static MatrixXd Rot_ab ( const VectorXd &a, const VectorXd &b)
35+ {
36+ assert ( a.size ()==b.size () );
37+ #ifdef QT_DEBUG
38+ Q_ASSERT ( std::fabs ( a.norm ()-1 .) < 1e-5 );
39+ Q_ASSERT ( std::fabs ( b.norm ()-1 .) < 1e-5 );
40+ #endif
41+ return MatrixXd::Identity ( a.size (),a.size ())
42+ +2 *b*a.adjoint ()
43+ -(a+b)*(a+b).adjoint ()/(1 .+a.dot (b));
44+ }
45+
46+ } // namespace Geometry
47+
48+ #endif // MINROT_H
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ HEADERS += \
5353 conncomp.h \
5454 constraints.h \
5555 geometry/aabb.h \
56+ geometry/minrot.h \
5657 global.h \
5758 mainwindow.h \
5859 mainscene.h \
Original file line number Diff line number Diff line change @@ -63,20 +63,6 @@ using Eigen::Dynamic;
6363}
6464
6565
66-
67- [[maybe_unused]] static MatrixXd Rot_ab ( const VectorXd &a, const VectorXd &b)
68- {
69- Q_ASSERT ( a.size ()==b.size () );
70- #ifdef QT_DEBUG
71- Q_ASSERT ( std::fabs ( a.norm ()-1 .) < FLT_EPSILON );
72- Q_ASSERT ( std::fabs ( b.norm ()-1 .) < FLT_EPSILON );
73- #endif
74- return MatrixXd::Identity ( a.size (),a.size ())
75- +2 *b*a.adjoint ()
76- -(a+b)*(a+b).adjoint ()/(1 .+a.dot (b));
77- }
78-
79-
8066// ! check if the matrix AA is rank-deficient
8167[[maybe_unused]] static bool is_rank_deficient ( SparseMatrix<double ,Eigen::ColMajor> & AA, const double threshold )
8268{
You can’t perform that action at this time.
0 commit comments