-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmain.cpp
More file actions
50 lines (42 loc) · 1.44 KB
/
Copy pathmain.cpp
File metadata and controls
50 lines (42 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "FA3R.h"
#include <random>
#include <Eigen/Core>
#include <Eigen/Dense>
Eigen::MatrixXd randomMatrix(int m, int n, std::random_device *rd)
{
std::mt19937 gen((*rd)()); //here you could also set a seed
std::uniform_real_distribution<double> dis(-1000.0, 1000.0);
return Eigen::MatrixXd::NullaryExpr(m,n,[&](){return dis(gen);});;
}
int main()
{
std::random_device rd;
const int len = 1000;
std::vector<Eigen::Vector3d> P, Q;
for(int i = 0; i < len; ++i)
{
auto P_ = randomMatrix(3, 1, &rd);
auto Q_ = randomMatrix(3, 1, &rd);
P.push_back(P_);
Q.push_back(Q_);
}
Eigen::Matrix3d rRes_FA3Rd, rRes_FA3Ri, rRes_eig;
Eigen::Vector3d tRes_FA3Rd, tRes_FA3Ri, tRes_eig;
FA3R_double(&P, &Q, nullptr, 20, &rRes_FA3Rd, &tRes_FA3Rd);
FA3R_int(&P, &Q, nullptr, 20, &rRes_FA3Ri, &tRes_FA3Ri);
eig3D_eig(&P, &Q, nullptr, &rRes_eig, &tRes_eig);
std::cout << "FA3R double:" << std::endl;
std::cout << "R: " << rRes_FA3Rd << std::endl;
std::cout << "t: " << tRes_FA3Rd << std::endl;
std::cout << std::endl;
std::cout << std::endl;
std::cout << "FA3R int:" << std::endl;
std::cout << "R: " << rRes_FA3Ri << std::endl;
std::cout << "t: " << tRes_FA3Ri << std::endl;
std::cout << std::endl;
std::cout << std::endl;
std::cout << "Eig:" << std::endl;
std::cout << "R: " << rRes_eig << std::endl;
std::cout << "t: " << tRes_eig << std::endl;
return 0;
}