Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
SphereData.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef _SPHEREDATA_H_ 00003 #define _SPHEREDATA_H_ 00004 00005 #include <vector> 00006 #include <iostream> 00007 00008 #include "BaseData.h" // superclass 00009 #include "Point.h" // Point data member 00010 #include "ShapeTypes.h" // sphereDataType 00011 00012 namespace DualCoding { 00013 00014 class ShapeRoot; 00015 class SketchSpace; 00016 template<typename T> class Sketch; 00017 00018 #define SPHERE_DATA_MOBILE false 00019 00020 class SphereData : public BaseData { 00021 private: 00022 Point centroid; 00023 float radius; 00024 00025 public: 00026 00027 //! Constructor 00028 SphereData(ShapeSpace& _space, const Point &c, float r); 00029 00030 //! Copy constructor 00031 SphereData(const SphereData& otherData); 00032 00033 static ShapeType_t getStaticType() { return sphereDataType; } 00034 00035 DATASTUFF_H(SphereData); 00036 00037 friend class Shape<SphereData>; 00038 00039 //! Centroid. (Virtual in BaseData.) 00040 Point getCentroid() const { return centroid; } 00041 00042 void setCentroidPt(const Point& pt) { centroid.setCoords(pt); } 00043 00044 //! Match spheres based on their parameters. (Virtual in BaseData.) 00045 virtual bool isMatchFor(const ShapeRoot& other) const; 00046 00047 virtual void mergeWith(const ShapeRoot& other); 00048 00049 virtual bool isAdmissible() const { 00050 return (radius >= 9.0 ); // **DST Hack** minimum size for a sphere to be added to local map 00051 } 00052 00053 virtual bool updateParams(const ShapeRoot& other, bool force=false); 00054 00055 //! Print information about this shape. (Virtual in BaseData.) 00056 virtual void printParams() const; 00057 00058 //! Transformations. (Virtual in BaseData.) 00059 void applyTransform(const fmat::Transform& Tmat, const ReferenceFrameType_t newref=unspecified); 00060 00061 //! Project to ground 00062 virtual void projectToGround(const fmat::Transform& camToBase, 00063 const PlaneEquation& groundplane); 00064 00065 virtual bool isInside(const Point& pt) const; 00066 //! Center point access function. 00067 const Point& centerPt() const { return centroid; } 00068 00069 virtual unsigned short getDimension() const { return 3; } 00070 00071 //! Properties functions. 00072 //@{ 00073 float getRadius() const { return radius; } 00074 //@} 00075 00076 00077 //! Set properties. 00078 //@{ 00079 void setRadius(float _radius); 00080 //@} 00081 00082 // ================================================== 00083 // BEGIN SKETCH MANIPULATION AND SPHERE EXTRACTION CODE 00084 // ================================================== 00085 00086 00087 //! Extraction. 00088 //@{ 00089 static std::vector<Shape<SphereData> > extractSpheres(const Sketch<bool>& sketch); 00090 static std::vector<Shape<SphereData> > get_spheres(const Sketch<CMVision::uchar>& cam); 00091 static std::vector<Shape<SphereData> > get_spheres(const Sketch<CMVision::uchar>& cam, 00092 std::vector<bool>& Valid_Colors); 00093 //@} 00094 00095 00096 private: 00097 //! Render into a sketch space and return pointer. (Private.) 00098 Sketch<bool>* render() const; 00099 00100 SphereData& operator=(const SphereData&); //!< don't call 00101 }; 00102 00103 } // namespace 00104 00105 #endif |
DualCoding 5.1CVS |
Generated Mon May 9 04:56:28 2016 by Doxygen 1.6.3 |