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