00001 #ifndef search_zones_h___ 00002 #define search_zones_h___ 00003 00004 #include <iostream> 00005 #include "utilities.h" 00006 #include "Qhull.h" 00007 00008 namespace ICR 00009 { 00010 //------------------------------------------------------------------- 00011 //------------------------------------------------------------------- 00016 struct PrimitiveSearchZone 00017 { 00021 std::vector<uint> hyperplane_ids_; 00022 PrimitiveSearchZone(); 00026 VectorXui satisfied_wc_ids_; 00027 00028 friend std::ostream& operator<<(std::ostream& stream, PrimitiveSearchZone const& psz); 00029 }; 00030 //------------------------------------------------------------------- 00031 //------------------------------------------------------------------- 00035 class SearchZones 00036 { 00037 private: 00038 00039 GraspPtr grasp_; 00040 WrenchSpace* tws_; 00041 std::vector<SearchZone*> search_zones_; 00042 uint num_search_zones_; 00043 bool search_zones_computed_; 00044 RowVectorXui map_vertex2finger_; 00045 Eigen::Matrix<double,Eigen::Dynamic,6> hyperplane_normals_; 00046 Eigen::VectorXd hyperplane_offsets_; 00047 00048 void computeShiftedHyperplanes(double alpha); 00049 void initializeSearchZones(); 00050 void addShiftedPrimitiveSearchZone(uint finger_id,vertexT const* curr_vtx); 00051 void resetPrimitiveSearchZones(uint sz_id); 00052 void clear(); 00053 SearchZones(); 00054 00055 public: 00056 00057 friend class IndependentContactRegions; 00058 00059 SearchZones(const GraspPtr grasp); 00060 SearchZones(SearchZones const& src); 00061 SearchZones& operator=(SearchZones const& src); 00062 friend std::ostream& operator<<(std::ostream& stream,SearchZones const& sz); 00063 ~SearchZones(); 00064 00070 void computeShiftedSearchZones(double alpha); 00071 const GraspPtr getGrasp()const; 00072 SearchZone const* getSearchZone(uint finger_id)const; 00073 uint getNumSearchZones()const; 00074 bool searchZonesComputed()const; 00083 void resetSearchZones(); 00084 Eigen::Matrix<double,Eigen::Dynamic,6> const* getHyperplaneNormals()const; 00085 Eigen::VectorXd const*getHyperplaneOffsets()const; 00086 WrenchSpace const* getTWS()const; 00087 }; 00088 //------------------------------------------------------------------- 00089 //------------------------------------------------------------------- 00090 }//namespace ICR 00091 #endif