Skip to content

Commit 0cf9adf

Browse files
committed
function Rot_ab moved to directory geometry
1 parent be741a5 commit 0cf9adf

File tree

5 files changed

+57
-18
lines changed

5 files changed

+57
-18
lines changed

src/adjustment.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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
@@ -18,6 +18,7 @@
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;
4950
using Eigen::SparseMatrix;
5051
using Eigen::VectorXidx;
5152

52-
using Matfun::Rot_ab;
53+
using Geometry::Rot_ab;
54+
5355
using Matfun::null;
5456
using Matfun::is_rank_deficient;
5557
using Matfun::indexOf;

src/constraints.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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
@@ -29,6 +29,7 @@
2929
#include <cmath>
3030
#include <cstdlib>
3131

32+
#include "geometry/minrot.h"
3233
#include "matfun.h"
3334

3435
namespace Constraint {
@@ -37,7 +38,8 @@ using Eigen::Vector3d;
3738
using Eigen::Vector2cd;
3839
using Eigen::Matrix;
3940

40-
using Matfun::Rot_ab;
41+
using Geometry::Rot_ab;
42+
4143
using Matfun::null;
4244
using Matfun::cof3;
4345
using Matfun::sign;

src/geometry/minrot.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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

src/greasepad.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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 \

src/matfun.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff 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
{

0 commit comments

Comments
 (0)