Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PyramidData.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef _PYRAMIDDATA_H_
00003 #define _PYRAMIDDATA_H_
00004 
00005 #include <vector>
00006 #include <iostream>
00007 #include <string>
00008 
00009 #include "BaseData.h"    // superclass
00010 #include "Point.h"       // Point data members
00011 #include "ShapeTypes.h"  // brickDataType
00012 
00013 #include "LineData.h"
00014 #include "ShapeLine.h"
00015 #include "ShapeBlob.h"
00016 
00017 namespace DualCoding {
00018 
00019 class ShapeRoot;
00020 class SketchSpace;
00021 template<typename T> class Sketch;
00022 
00023 class PyramidData : public BaseData {  
00024  private:
00025   EndPoint FL;
00026   EndPoint FR;
00027   EndPoint BL;
00028   EndPoint BR;
00029   EndPoint Top;
00030 
00031   Point centroid;
00032 
00033  public:
00034 
00035   //! Constructor
00036   PyramidData(ShapeSpace& _space,
00037       const EndPoint &FL, const EndPoint &FR, const EndPoint &BL, const EndPoint &BR, 
00038       const EndPoint &Top);
00039 
00040 
00041   //! Copy constructor
00042   //PyramidData(PyramidData& otherPyramid);
00043 
00044   static ShapeType_t getStaticType() { return pyramidDataType; }
00045   DATASTUFF_H(PyramidData);
00046   
00047   //! Centroid. (Virtual in BaseData.)
00048   Point getCentroid() const { return centroid; } 
00049   
00050   EndPoint& getFL() {return FL;}
00051   const EndPoint& getFL() const {return FL;}
00052   EndPoint& getFR() {return FR;}
00053   const EndPoint& getFR() const {return FR;}
00054   EndPoint& getBL() {return BL;}
00055   const EndPoint& getBL() const {return BL;}
00056   EndPoint& getBR() {return BR;}
00057   const EndPoint& getBR() const {return BR;}
00058   EndPoint& getTop() {return Top;}
00059   const EndPoint& getTop() const {return Top;}
00060   
00061   //! Match pyramids based on their parameters.  (Virtual in BaseData.)
00062   virtual bool isMatchFor(const ShapeRoot& other) const;
00063 
00064   virtual void mergeWith(const ShapeRoot& other);
00065 
00066   virtual bool isAdmissible() const { return true; }
00067 
00068   virtual bool updateParams(const ShapeRoot& other, bool force=false);
00069 
00070   //! Print information about this shape. (Virtual in BaseData.)
00071   virtual void printParams() const;
00072   
00073   //! Transformations. (Virtual in BaseData.)
00074   void applyTransform(const fmat::Transform& Tmat, const ReferenceFrameType_t newref=unspecified);
00075   
00076   //! Project to ground
00077   void projectToGround(const fmat::Transform & camToBase, const PlaneEquation& groundplane);
00078     
00079   virtual unsigned short getDimension() const { return 3; }
00080 
00081   //! Extraction.
00082 
00083   static Shape<PyramidData> extractPyramid(ShapeSpace& space, std::vector<Shape<BlobData> > &blobs);
00084     
00085   static std::vector<Point> findBoundingTriangle(ShapeSpace& space, Shape<BlobData> blob, 
00086               Point centroid, Shape<LineData> parallel);
00087 private:
00088   //! Render into a sketch space and return reference. (Private.)
00089   Sketch<bool>* render() const;
00090 
00091 
00092   //@}
00093 
00094   PyramidData& operator=(const PyramidData&); //!< don't call
00095 };
00096 
00097 } // namespace
00098 
00099 #endif

DualCoding 5.1CVS
Generated Mon May 9 04:56:27 2016 by Doxygen 1.6.3