Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

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"    // superclass
00007 #include "Point.h"       // Point data member
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     //! Constructor
00033     CrossData(ShapeSpace& _space, const LineData& line1, const LineData& line2, const fmat::Column<3>& extents);
00034 
00035     //! Destructor
00036     ~CrossData() {};
00037 
00038     static ShapeType_t getStaticType() { return crossDataType; }
00039 
00040     DATASTUFF_H(CrossData);
00041 
00042     //! get and set for basic parameters (center, armWidth, 
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     //! Line1. (Virtual in BaseData.)
00055     const LineData& getLine1() const { return line1; } 
00056     void setLine1(const LineData& newLine1) { line1 = newLine1; }
00057 
00058     //! Line2. (Virtual in BaseData.)
00059     const LineData& getLine2() const { return line2; } 
00060     void setLine2(const LineData& newLine2) { line2 = newLine2; }
00061 
00062     //! Returns the bounding box of the Cross object in the camera reference frame; not the same as getTopLeft() etc.
00063     virtual BoundingBox2D getBoundingBox() const;
00064 
00065     //! Bounding box points
00066     Point getTopLeft() const;
00067     Point getTopRight() const;
00068     Point getBottomLeft() const;
00069     Point getBottomRight() const;
00070 
00071     //! Match Cross objects based on their parameters.  (Virtual in BaseData.)
00072     virtual bool isMatchFor(const ShapeRoot& other) const;
00073     bool isMatchFor(const CrossData& other) const;
00074 
00075     //! Updates cross given  a new cross
00076     virtual bool updateParams(const ShapeRoot& other, bool force=false);
00077     virtual bool updateParams(const CrossData &ground_cross, bool force);
00078 
00079     //! Print information about this shape. (Virtual in BaseData.)
00080     virtual void printParams() const;
00081   
00082     //! Transformations. (Virtual in BaseData.)
00083     void applyTransform(const fmat::Transform& Tmat, const ReferenceFrameType_t newref=unspecified);
00084 
00085     //! Project to ground
00086     virtual void projectToGround(const fmat::Transform& camToBase, const PlaneEquation& groundplane);
00087 
00088     virtual unsigned short getDimension() const { return 2; }
00089     
00090     //TODO: write documentation for which arm is which and possibly rename
00091     enum ObjectFeature { none=0, arm1, arm2, arm3, arm4 };
00092     
00093     //! Compute a point on the destination target based on some feature of the target, e.g., the left side of a domino.
00094     std::vector<Point> computeGraspPoints() const;
00095 
00096 
00097   private:
00098     //! Render into a sketch space and return pointer. (Private.)
00099     virtual Sketch<bool>* render() const;
00100     CrossData& operator=(const CrossData&); //!< don't call
00101   };
00102 
00103 
00104 } // namespace
00105 
00106 #endif
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 

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