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

DualCoding 4.0
Generated Thu Nov 22 00:52:36 2007 by Doxygen 1.5.4