CrossData.h
Go to the documentation of this file.00001 #ifndef _CROSSDATA_H_
00002 #define _CROSSDATA_H_
00003
00004 #include <vector>
00005 #include <iostream>
00006 #include "BaseData.h"
00007 #include "Point.h"
00008 #include "ShapeFuns.h"
00009 #include "Sketch.h"
00010 #include "LineData.h"
00011
00012 namespace DualCoding {
00013
00014 class ShapeRoot;
00015 class SketchSpace;
00016 template<typename T> class Sketch;
00017
00018 class CrossData : public BaseData {
00019
00020 private:
00021 Point center;
00022 float armWidth;
00023 float crossHeight;
00024 LineData line1;
00025 LineData line2;
00026
00027 friend class ShapeSpace;
00028 friend class Shape<CrossData>;
00029
00030 public:
00031
00032
00033 CrossData(ShapeSpace& _space, const LineData& line1, const LineData& line2, const fmat::Column<3>& extents);
00034
00035
00036 ~CrossData() {};
00037
00038 static ShapeType_t getStaticType() { return crossDataType; }
00039
00040 DATASTUFF_H(CrossData);
00041
00042
00043 Point getCentroid() const { return center; }
00044 void setCentroid(const Point& other) { center.setCoords(other); }
00045
00046 float getArmWidth() const { return armWidth; }
00047 void setArmWidth(float newWidth) { armWidth = newWidth; }
00048
00049 float getcrossHeight() const { return crossHeight; }
00050 void setcrossHeight(float newHeight) { crossHeight = newHeight; }
00051
00052 float getArmSemiLength() const { return (line1.getLength() + line2.getLength()) / 4.0; }
00053
00054
00055 const LineData& getLine1() const { return line1; }
00056 void setLine1(const LineData& newLine1) { line1 = newLine1; }
00057
00058
00059 const LineData& getLine2() const { return line2; }
00060 void setLine2(const LineData& newLine2) { line2 = newLine2; }
00061
00062
00063 virtual BoundingBox2D getBoundingBox() const;
00064
00065
00066 Point getTopLeft() const;
00067 Point getTopRight() const;
00068 Point getBottomLeft() const;
00069 Point getBottomRight() const;
00070
00071
00072 virtual bool isMatchFor(const ShapeRoot& other) const;
00073 bool isMatchFor(const CrossData& other) const;
00074
00075
00076 virtual bool updateParams(const ShapeRoot& other, bool force=false);
00077 virtual bool updateParams(const CrossData &ground_cross, bool force);
00078
00079
00080 virtual void printParams() const;
00081
00082
00083 void applyTransform(const fmat::Transform& Tmat, const ReferenceFrameType_t newref=unspecified);
00084
00085
00086 virtual void projectToGround(const fmat::Transform& camToBase, const PlaneEquation& groundplane);
00087
00088 virtual unsigned short getDimension() const { return 2; }
00089
00090
00091 enum ObjectFeature { none=0, arm1, arm2, arm3, arm4 };
00092
00093
00094 std::vector<Point> computeGraspPoints() const;
00095
00096
00097 private:
00098
00099 virtual Sketch<bool>* render() const;
00100 CrossData& operator=(const CrossData&);
00101 };
00102
00103
00104 }
00105
00106 #endif
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124