Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

DominoData.h

Go to the documentation of this file.
00001 #ifndef _DOMINODATA_H_
00002 #define _DOMINODATA_H_
00003 
00004 #include "BrickData.h"
00005 
00006 namespace DualCoding {
00007 
00008 //! Subclass of Brick that describes a Domino
00009 class DominoData : public BrickData {
00010 
00011 public:
00012   DominoData(ShapeSpace& _space, int _lowValue, int _highValue,
00013              const fmat::SubVector<3,const fmat::fmatReal>& _centroid,
00014              const fmat::Column<3> _extents,
00015              const fmat::SubMatrix<3,3,const fmat::fmatReal> &_orient) :
00016     BrickData(_space, _centroid, _extents, _orient), lowValue(_lowValue), highValue(_highValue),
00017     length(2*_extents[0]), width(2*_extents[1]), height(2*_extents[2]), lineColor()
00018     {
00019       type = dominoDataType;
00020     }
00021 
00022   DATASTUFF_H(DominoData);
00023 
00024   static ShapeType_t getStaticType() { return dominoDataType; }
00025 
00026   int getLowValue() const { return lowValue; }
00027   int getHighValue() const { return highValue; }
00028   void setValues(int low, int high) { lowValue=low; highValue=high; }
00029 
00030   float getLength() const { return length; }
00031   float getWidth()  const { return width; }
00032   float getHeight() const { return height; }
00033 
00034   rgb getLineColor() const { return lineColor; }
00035   void setLineColor(rgb _lineColor) { lineColor = _lineColor; }
00036 
00037   //! Match dominoes based on their parameters.  (Virtual in BaseData.)
00038   virtual bool isMatchFor(const ShapeRoot& other) const;
00039 
00040   void flipLeftRight(); //! Helper function for domino construction
00041 
00042   enum ObjectFeature { none=0, center, lowEnd, highEnd, leftSide, rightSide };
00043 
00044   //! Compute an object grasp point based on some feature of the object, e.g., the low end of a domino.
00045   void computeGraspPoint(const ObjectFeature pos,
00046                          Point &location,
00047                          AngTwoPi &orient) const;
00048 
00049   //! Compute a point on the destination target based on some feature of the target, e.g., the left side of a domino.
00050   void computeTargetPosition(const ObjectFeature pos,
00051                              Point &location,
00052                              AngTwoPi &orient) const;
00053 
00054 protected:
00055   int lowValue;   //!< number of dots on low side
00056   int highValue;  //!< number of dots on high side
00057   float length; //!< length of the domino (longest dimension)
00058   float width; //!< width of the domino (smaller than length);
00059   float height; //!< height of the domino
00060   rgb lineColor; //!< color of the dividing line
00061 };
00062 
00063 } // namespace
00064 
00065 #endif

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