object.h
Go to the documentation of this file.
00001 
00059 /*
00060  * object.h
00061  *
00062  *  Created on: 29.05.2012
00063  *      Author: josh
00064  */
00065 
00066 #ifndef SCP_OBJECT_H_
00067 #define SCP_OBJECT_H_
00068 
00069 #include "extended_curved_polygon.h"
00070 
00071 namespace Slam_CurvedPolygon
00072 {
00073 
00074   template<typename _DOF6>
00075   class Object
00076   {
00077     typedef Slam_CurvedPolygon::ex_curved_polygon DATA;
00078 
00079     //cob_3d_mapping_msgs::CurvedPolygon data_;
00080     DATA data_;
00081     size_t used_, creation_;
00082     bool proc_;
00083 
00084   public:
00085 
00086     typedef _DOF6 DOF6;
00087     typedef typename DOF6::SOURCE1 TFLINK;
00088 
00089     struct TF_CORS
00090     {
00091       typename TFLINK::TFLinkObj a,b;
00092 
00093       TF_CORS(const typename TFLINK::TFLinkObj &a, const typename TFLINK::TFLinkObj &b):
00094         a(a), b(b)
00095       {}
00096     };
00097 
00098     typedef boost::shared_ptr<Object> Ptr;
00099     typedef typename std::list<TF_CORS> TFLIST;
00100 
00101     Object(const DATA &cp):
00102       data_(cp), used_(1), creation_(1), proc_(true)
00103     {
00104 
00105     }
00106 
00107     const Slam_CurvedPolygon::ex_curved_polygon &getData() const {return data_;}
00108 
00109     inline Ptr makeShared () { return Ptr (new Object (*this)); }
00110 
00111     inline void transform(const Eigen::Matrix3f &rot, const Eigen::Vector3f &tr, const float var_R, const float var_T)
00112     {
00113       data_.transform(rot, tr,var_R,var_T);
00114     }
00115 
00116     bool operator+=(const Object &o) {
00117       int st;
00118       return op_plus(o,st);
00119     }
00120     bool op_plus(const Object &o, int &status) {
00122       if(data_.op_plus(o.data_,status) ) {
00123         used_ += o.used_;
00124         creation_ = std::max(creation_,o.creation_)+std::min(creation_,o.creation_)/2;
00125         if(used_>creation_)
00126           creation_ = used_;
00127         return true;
00128       }
00129       return false;
00130     }
00131 
00132     void used() {++used_;if(used_>creation_) --used_;}
00133     void processed() {++creation_;proc_=true;}
00134     void notProcessed() {proc_=false;}
00135 
00136     bool getProcessed() const {return proc_;}
00137 
00138     bool isReachable(const Object &o, const typename DOF6::TYPE &thr_rot, const typename DOF6::TYPE &thr_tr) const;
00139     std::vector<typename DOF6::TYPE> getDistance(const Object &o) const;
00140 
00141     bool operator|(const Object &o) const; 
00142     bool operator&(const Object &o) const; 
00143     TFLIST getTFList(const Object &o, const typename DOF6::TYPE &thr_rot, const typename DOF6::TYPE &thr_tr, const Eigen::Matrix3f &rot, const Eigen::Vector3f &tr) const;
00144     void addTFList(const Object &o, const typename DOF6::TYPE &thr_rot, const typename DOF6::TYPE &thr_tr, const Eigen::Matrix3f &rot, const Eigen::Vector3f &tr, TFLIST &list) const;
00145 
00146     Eigen::Vector3f getNearestPoint() const {return data_.getNearestPoint();}
00147     Eigen::Vector3f getNearestTransformedPoint(const Eigen::Matrix3f &rot, const Eigen::Vector3f &tr) const {return data_.getNearestTransformedPoint(rot, tr);}
00148 
00149     size_t getUsedCounter() const {return used_;}
00150     size_t getCreationCounter() const {return creation_;}
00151 
00152     float getSimilarity(const Object &o) const;
00153 
00154     const DATA::BB &getBB() const;
00155     DATA::BB getBB(const typename DOF6::TYPE &thr_rot, const typename DOF6::TYPE &thr_tr) const;
00156 
00161     bool intersectsBB(const Object &o, const typename DOF6::TYPE &thr_rot, const typename DOF6::TYPE &thr_tr) const;
00162 
00167     bool intersectsBB(const Eigen::Vector3f &o, const typename DOF6::TYPE &thr_rot, const typename DOF6::TYPE &thr_tr) const;
00168     bool intersectsBB(const Eigen::Vector3f &o, const Eigen::Matrix3f &rot, const Eigen::Vector3f &tr, const typename DOF6::TYPE &thr_rot, const typename DOF6::TYPE &thr_tr) const;
00169         
00170     bool intersectsPts(const Object &o, const typename DOF6::TYPE &thr_rot, const typename DOF6::TYPE &thr_tr) const;
00171 
00172     bool invalid() const {
00173       return data_.getOutline().size()>100||data_.invalid();
00174     }
00175   };
00176 
00177 #include "impl/object.hpp"
00178 
00179 }
00180 
00181 
00182 #endif /* OBJECT_H_ */


cob_3d_mapping_slam
Author(s): Joshua Hampp
autogenerated on Wed Aug 26 2015 11:04:51