Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
position.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2022-2023 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_POSITION_HPP_
25#define TAPROOT_POSITION_HPP_
26
28
30{
31// Forward declaration to avoid circular dependency
32class Vector;
33
35{
36public:
37 /* Constructors */
38 Position(float x, float y, float z) : coordinates_({x, y, z}) {}
39
40 /* Use rvalue reference */
41 Position(const Position&& other) : coordinates_(std::move(other.coordinates_)) {}
42
43 Position(const Position& other) : coordinates_(CMSISMat(other.coordinates_)) {}
44
46
47 Position(CMSISMat<3, 1>&& coordinates) : coordinates_(std::move(coordinates)) {}
48
49 /* Getters */
50
51 inline float x() const { return coordinates_.data[0]; }
52
53 inline float y() const { return coordinates_.data[1]; }
54
55 inline float z() const { return coordinates_.data[2]; }
56
57 /* Operators */
58 Position operator-(const Vector& other) const;
59
60 Vector operator-(const Position& other) const;
61
62 Position operator+(const Vector& vector) const;
63
64 Position operator+(const Position& vector) const;
65
66 Position operator*(const float scalar) const;
67
68 Position& operator=(const Position& other);
69
70 bool operator==(const Position& other) const;
71
72 inline CMSISMat<3, 1> coordinates() const { return this->coordinates_; }
73
74 static inline Position interpolate(const Position& a, const Position& b, const float t)
75 {
76 return a * (1 - t) + b * t;
77 }
78
79 static float distance(const Position& a, const Position& b);
80
81 friend class Transform;
82 friend class DynamicPosition;
83
84private:
85 CMSISMat<3, 1> coordinates_;
86}; // class Position
87} // namespace tap::algorithms::transforms
88
89#endif // TAPROOT_POSITION_HPP_
Definition dynamic_position.hpp:35
Definition position.hpp:35
float z() const
Definition position.hpp:55
Position(float x, float y, float z)
Definition position.hpp:38
bool operator==(const Position &other) const
Definition position.cpp:61
CMSISMat< 3, 1 > coordinates() const
Definition position.hpp:72
Position operator-(const Vector &other) const
Definition position.cpp:30
float x() const
Definition position.hpp:51
Position(CMSISMat< 3, 1 > &&coordinates)
Definition position.hpp:47
Position operator+(const Vector &vector) const
Definition position.cpp:40
float y() const
Definition position.hpp:53
static float distance(const Position &a, const Position &b)
Definition position.cpp:66
Position & operator=(const Position &other)
Definition position.cpp:55
Position(const CMSISMat< 3, 1 > &coordinates)
Definition position.hpp:45
Position(const Position &other)
Definition position.hpp:43
Position(const Position &&other)
Definition position.hpp:41
static Position interpolate(const Position &a, const Position &b, const float t)
Definition position.hpp:74
Position operator*(const float scalar) const
Definition position.cpp:50
Definition transform.hpp:60
Definition vector.hpp:35
Definition angular_velocity.hpp:30
Definition cmsis_mat.hpp:45
std::array< float, ROWS *COLS > data
Definition cmsis_mat.hpp:46