iterative closest points
CEV ICP algorithm library
Loading...
Searching...
No Matches
geo.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <vector>
10#include <cmath>
11#include <sstream>
12#include <Eigen/Core>
13
14namespace icp {
15 using Vector = Eigen::Vector2d;
16 using Matrix = Eigen::Matrix2d;
17
19 struct RBTransform final {
22
23 public:
25 translation = Vector::Zero();
26 rotation = Matrix::Identity();
27 }
28
31
33 return rotation * v + translation;
34 }
35
36 RBTransform and_then(const RBTransform& next) const {
37 return RBTransform(next.rotation * this->translation + next.translation,
38 next.rotation * this->rotation);
39 }
40
42 auto transpose = this->rotation.transpose();
43 return RBTransform(-transpose * this->translation, transpose);
44 }
45
46 std::string to_string() const {
47 std::stringstream stream;
48 stream << "RBTransform {\n";
49 stream << " translation:\n" << translation << '\n';
50 stream << " rotation:\n" << rotation << '\n';
51 stream << "}";
52 return stream.str();
53 }
54 };
55
56 Vector get_centroid(const std::vector<Vector>& points);
57}
Definition driver.h:12
Eigen::Vector2d Vector
Definition geo.h:15
Eigen::Matrix2d Matrix
Definition geo.h:16
Vector get_centroid(const std::vector< Vector > &points)
Definition geo.cpp:11
Rigid-body transformation.
Definition geo.h:19
Matrix rotation
Definition geo.h:21
RBTransform and_then(const RBTransform &next) const
Definition geo.h:36
RBTransform inverse() const
Definition geo.h:41
Vector apply_to(Vector v) const
Definition geo.h:32
Vector translation
Definition geo.h:20
std::string to_string() const
Definition geo.h:46
RBTransform(Vector translation, Matrix rotation)
Definition geo.h:29