00001
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"
00012 #include "Point.h"
00013 #include "ShapeTypes.h"
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
00038 PyramidData(ShapeSpace& _space,
00039 const EndPoint &FL, const EndPoint &FR, const EndPoint &BL, const EndPoint &BR,
00040 const EndPoint &Top);
00041
00042
00043
00044
00045
00046 static ShapeType_t getStaticType() { return pyramidDataType; }
00047 DATASTUFF_H(PyramidData);
00048
00049
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
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
00068 virtual void printParams() const;
00069
00070
00071 void applyTransform(const NEWMAT::Matrix& Tmat, const ReferenceFrameType_t newref=unspecified);
00072
00073
00074 void projectToGround(const NEWMAT::Matrix & camToBase,
00075 const NEWMAT::ColumnVector& groundplane);
00076
00077 virtual unsigned short getDimension() const { return 3; }
00078
00079
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
00087 Sketch<bool>* render() const;
00088
00089
00090
00091
00092 PyramidData& operator=(const PyramidData&);
00093 };
00094
00095 }
00096
00097 #endif