ChainApproximation.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @author Fabian Reister ( fabian dot reister at kit dot edu )
17 * @date 2021
18 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19 * GNU General Public License
20 */
21
22#pragma once
23
24#include <iosfwd>
25#include <vector>
26
27#include <Eigen/Core>
28
29namespace armarx
30{
31
32 namespace detail
33 {
35 {
36 float distanceTh; // [mm]
37
39 };
40
54
55 std::ostream& operator<<(std::ostream& str, const ApproximationResult& res);
56 } // namespace detail
57
59 {
60 public:
61 using Point = Eigen::Vector2f;
62 using Points = std::vector<Point>;
63
66
67 ChainApproximation(const Points& points, const Params& params);
68
70
71 [[nodiscard]] Points approximatedChain() const;
72
73 private:
74 struct Triplet
75 {
76 Triplet(const int& a, const int& b, const int& c) noexcept : a(a), b(b), c(c)
77 {
78 }
79
80 int a;
81 int b;
82 int c;
83 };
84
85 using Triplets = std::vector<Triplet>;
86
87 Triplets getTriplets() const;
88
89 std::vector<float> computeDistances(const Triplets& triplets);
90 float computeDistance(const Triplet& triplet) const;
91
92 bool approximateStep();
93
94 Points points;
95
96 std::vector<int> indices;
97
98 const Params params;
99 };
100
101} // namespace armarx
constexpr T c
std::string str(const T &t)
ChainApproximation(const Points &points, const Params &params)
ApproximationResult approximate()
std::vector< Point > Points
detail::ApproximationResult ApproximationResult
detail::ChainApproximationParams Params
std::ostream & operator<<(std::ostream &out, const LocationProvider::Location &l)
Definition trace.cpp:164
This file offers overloads of toIce() and fromIce() functions for STL container types.