Helios++
Helios software for LiDAR simulations
DynMotion.h
1 #pragma once
2 
3 #include <rigidmotion/RigidMotion.h>
4 
5 #include <memory>
6 #include <boost/serialization/void_cast.hpp>
7 #include <boost/serialization/base_object.hpp>
8 #include <boost/serialization/deque.hpp>
9 
10 using namespace arma;
12 
13 using std::shared_ptr;
14 using std::make_shared;
15 
26 class DynMotion : public RigidMotion {
27 private:
28  // *** SERIALIZATION *** //
29  // *********************** //
30  friend class boost::serialization::access;
37  template <typename Archive>
38  void serialize(Archive &ar, const unsigned int version){
39  boost::serialization::void_cast_register<DynMotion, RigidMotion>();
40  ar &boost::serialization::base_object<RigidMotion>(*this);
41  ar &selfMode;
42  ar &normalMode;
43  //ar &C; // Not needed because it is in save/load construct
44  //ar &A; // Not needed because it is in save/load construct
45  }
46 
47 protected:
48  // *** ATTRIBUTES *** //
49  // ******************** //
62  bool selfMode = false;
63 
77  bool normalMode = false;
78 
79 public:
80  // *** CONSTRUCTION / DESTRUCTION *** //
81  // ************************************ //
89  DynMotion(RigidMotion const & rm, bool selfMode=false) :
90  RigidMotion(rm),
91  selfMode(selfMode)
92  {}
100  DynMotion(colvec const &C, arma::mat const &A) : RigidMotion(C, A) {}
101  virtual ~DynMotion() = default;
102 
103  // *** NORMALS UTILS *** //
104  // *********************** //
111  virtual bool checkModifiesNormal() const;
146  virtual DynMotion makeNormalCounterpart() const;
152  virtual inline shared_ptr<DynMotion> makeNormalCounterpartPtr() const
153  {return make_shared<DynMotion>(makeNormalCounterpart());}
154 
155  // *** GETTERs and SETTERs *** //
156  // ***************************** //
164  inline bool isSelfMode() const {return selfMode;}
171  inline void setSelfMode(bool const selfMode) {this->selfMode = selfMode;}
179  inline bool isNormalMode() const {return normalMode;}
186  inline void setNormalMode(bool const normalMode)
187  {this->normalMode = normalMode;}
188 };
Class which wraps the RigidMotion class to implement extra features such as the self mode control mec...
Definition: DynMotion.h:26
DynMotion(colvec const &C, arma::mat const &A)
Dynamic motion construction from given translation column vector and fixed origin transformation matr...
Definition: DynMotion.h:100
bool isNormalMode() const
Check if normal mode is enabled for the dynamic motion (true) or not (false)
Definition: DynMotion.h:179
virtual shared_ptr< DynMotion > makeNormalCounterpartPtr() const
Like makeNormalCounterpart method but returning a shared pointer instead of the raw object.
Definition: DynMotion.h:152
void setNormalMode(bool const normalMode)
Enable or disable normal mode.
Definition: DynMotion.h:186
bool isSelfMode() const
Check if self mode is enabled for the dynamic motion (true) or not (false)
Definition: DynMotion.h:164
void setSelfMode(bool const selfMode)
Enable or disable self mode.
Definition: DynMotion.h:171
void serialize(Archive &ar, const unsigned int version)
Serialize a dynamic motion to a stream of bytes.
Definition: DynMotion.h:38
DynMotion(RigidMotion const &rm, bool selfMode=false)
Dynamic motion construction from a rigid motion as basis.
Definition: DynMotion.h:89
Interface that must be implemented by any class which represents a specific rigid motions.
Definition: RigidMotion.h:49