hermite  0.0.1
pose.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <cstddef>
10 
12 
13 namespace hermite {
14 using svector::Vector;
15 
23 template <std::size_t D> class Pose {
24 public:
30  Pose() : m_time{0} {}
31 
39  Pose(const double time, const Vector<D> pos, const Vector<D> vel)
40  : m_time{time}, m_pos{pos}, m_vel{vel} {}
41 
45  Pose(const Pose<D> &other)
46  : m_time{other.m_time}, m_pos{other.m_pos}, m_vel{other.m_vel} {}
47 
51  Pose<D> &operator=(const Pose<D> &other) {
52  // check if assigning to self
53  if (this == &other) {
54  return *this;
55  }
56 
57  m_pos = other.m_pos;
58  m_vel = other.m_vel;
59  m_time = other.m_time;
60 
61  return *this;
62  }
63 
67  ~Pose() = default;
68 
74  Vector<D> getPos() const { return m_pos; }
75 
81  Vector<D> getVel() const { return m_vel; }
82 
88  double getTime() const { return m_time; }
89 
95  void setPos(const Vector<D> &pos) { m_pos = pos; }
96 
102  void setVel(const Vector<D> &vel) { m_vel = vel; }
103 
109  void setTime(const double &time) { m_time = time; }
110 
111 private:
112  double m_time;
113  Vector<D> m_pos;
114  Vector<D> m_vel;
115 };
116 } // namespace hermite
A pose object.
Definition: pose.hpp:23
Vector< D > getVel() const
Gets velocity vector.
Definition: pose.hpp:81
void setTime(const double &time)
Sets time.
Definition: pose.hpp:109
Vector< D > getPos() const
Gets position vector.
Definition: pose.hpp:74
~Pose()=default
Destructor.
void setPos(const Vector< D > &pos)
Sets position vector.
Definition: pose.hpp:95
Pose(const double time, const Vector< D > pos, const Vector< D > vel)
Constructor.
Definition: pose.hpp:39
Pose(const Pose< D > &other)
Copy constructor.
Definition: pose.hpp:45
void setVel(const Vector< D > &vel)
Sets velocity vector.
Definition: pose.hpp:102
double getTime() const
Gets time.
Definition: pose.hpp:88
Pose< D > & operator=(const Pose< D > &other)
Assignment operator.
Definition: pose.hpp:51
Pose()
Default constructor.
Definition: pose.hpp:30
A base vector representation.
Definition: simplevectors.hpp:63