00001 #ifndef Impala_Core_Geometry_InterestPoint_h 00002 #define Impala_Core_Geometry_InterestPoint_h 00003 00004 #include <algorithm> 00005 #include "Core/Vector/VectorTem.h" 00006 00007 namespace Impala 00008 { 00009 namespace Core 00010 { 00011 namespace Geometry 00012 { 00013 00016 class InterestPoint { 00017 public: 00018 00019 Real64 mX; 00020 Real64 mY; 00021 std::vector<Real64> mDescriptor; 00022 00023 InterestPoint() 00024 : mX(0), mY(0) 00025 { 00026 } 00027 00028 InterestPoint(Real64 xCoord, Real64 yCoord) 00029 : mX(xCoord), mY(yCoord) 00030 { 00031 } 00032 00033 virtual ~InterestPoint() {} 00034 00035 bool 00036 operator== (const InterestPoint & rhs) const 00037 { 00038 return mX==rhs.mX && mY==rhs.mY; 00039 } 00040 00041 virtual std::string 00042 geometryType() 00043 { 00044 return "PointZ"; 00045 } 00046 00047 virtual std::string 00048 Serialize(Real64 shiftX=0, Real64 shiftY=0) 00049 { 00050 std::ostringstream os; 00051 os << "<POINT " << mX+shiftX << " " << mY+shiftY << ">;"; 00052 return os.str(); 00053 } 00054 00055 virtual Vector::VectorTem<Real64>* 00056 PointAsVector(Real64 shiftX=0, Real64 shiftY=0) 00057 { 00058 Vector::VectorTem<Real64>* temp = new Vector::VectorTem<Real64>(2); 00059 temp->Elem(0) = mX + shiftX; 00060 temp->Elem(1) = mY + shiftY; 00061 return temp; 00062 } 00063 }; 00064 00065 bool 00066 InterestPointsEqual(InterestPoint* p1, InterestPoint* p2) 00067 { 00068 if(p1 == 0 || 00069 p2 == 0) 00070 return false; 00071 if(p1->mX != p2->mX || 00072 p1->mY != p2->mY || 00073 p1->mDescriptor.size() != p2->mDescriptor.size()) 00074 return false; 00075 return std::equal(p1->mDescriptor.begin(), p1->mDescriptor.end(), 00076 p2->mDescriptor.begin()); 00077 } 00078 00079 } // namespace Geometry 00080 } // namespace Core 00081 } // namespace Impala 00082 00083 #endif