00001 #ifndef wrench_space_h___ 00002 #define wrench_space_h___ 00003 00004 #include "utilities.h" 00005 #include <Eigen/Core> 00006 #include <iostream> 00007 #include "Qhull.h" 00008 00009 namespace ICR 00010 { 00011 //-------------------------------------------------------------------------- 00012 //-------------------------------------------------------------------------- 00016 class WrenchSpace 00017 { 00018 protected: 00019 00020 WrenchSpaceType type_; 00024 bool full_dim_; 00025 bool contains_origin_; 00029 double r_oc_insphere_; 00030 double volume_; 00031 double area_; 00032 uint dimension_; 00033 00034 public: 00035 00036 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00037 00038 friend class SearchZones; 00039 00040 WrenchSpace(); 00041 WrenchSpace(uint dimension); 00042 WrenchSpace(WrenchSpace const& src); 00043 WrenchSpace& operator=(WrenchSpace const& src); 00044 00045 virtual ~WrenchSpace(); 00046 00047 WrenchSpaceType getWrenchSpaceType()const; 00048 bool isFullDimension()const; 00049 bool containsOrigin()const; 00050 double getOcInsphereRadius()const; 00051 double getVolume()const; 00052 double getArea()const; 00053 uint getDimension()const; 00054 00055 }; 00056 //-------------------------------------------------------------------------- 00057 //-------------------------------------------------------------------------- 00061 class SphericalWrenchSpace : public WrenchSpace 00062 { 00063 private: 00064 00065 double radius_; 00066 void computeArea(); 00067 void computeVolume(); 00068 00069 public: 00070 00071 friend class SearchZones; 00072 00073 SphericalWrenchSpace(); 00074 SphericalWrenchSpace(uint dimension,double radius); 00075 SphericalWrenchSpace(SphericalWrenchSpace const& src); 00076 SphericalWrenchSpace& operator=(SphericalWrenchSpace const& src); 00077 friend std::ostream& operator<<(std::ostream& stream, SphericalWrenchSpace const& s_wrench_space); 00078 virtual ~SphericalWrenchSpace(); 00079 00080 void setRadius(double const radius); 00081 double getRadius()const; 00082 }; 00083 //--------------------------------------------------------------------------------- 00084 //--------------------------------------------------------------------------------- 00088 class DiscreteWrenchSpace : public WrenchSpace 00089 { 00090 00091 private: 00092 00093 bool ch_computed_; 00094 orgQhull::Qhull conv_hull_; 00095 uint num_wrenches_; 00096 uint num_vtx_; 00097 uint num_facets_; 00098 00099 public: 00100 00101 friend class SearchZones; 00102 00103 DiscreteWrenchSpace(); 00104 DiscreteWrenchSpace(DiscreteWrenchSpace const& src); 00105 DiscreteWrenchSpace& operator=(DiscreteWrenchSpace const& src); 00106 virtual ~DiscreteWrenchSpace(); 00107 friend std::ostream& operator<<(std::ostream& stream,DiscreteWrenchSpace const& d_wrench_space); 00111 void computeConvexHull(double const* wrenches,uint num_wrenches); 00112 orgQhull::Qhull const* getConvexHull()const; 00113 bool convHullComputed()const; 00114 uint getNumWrenches()const; 00115 uint getNumVertices()const; 00116 uint getNumFacets()const; 00117 }; 00118 //-------------------------------------------------------------------------- 00119 //-------------------------------------------------------------------------- 00120 }//namespace ICR 00121 #endif