Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ShapeFuns.cc

Go to the documentation of this file.
00001 //-*-c++-*-
00002 
00003 #include "ShapeRoot.h"
00004 #include "ShapeLine.h"
00005 #include "ShapeBlob.h"
00006 
00007 #include "ShapeFuns.h"
00008 
00009 namespace DualCoding {
00010 
00011 // ================
00012 
00013 bool IsLeftOf::operator() (const ShapeRoot &s1, const ShapeRoot &s2) const {
00014   const Point c1 = s1->getCentroid();
00015   const Point c2 = s2->getCentroid();
00016   return c1.isLeftOf(c2,dist);
00017 }
00018 
00019 bool IsAbove::operator() (const ShapeRoot &s1, const ShapeRoot &s2) const {
00020   const Point c1 = s1->getCentroid();
00021   const Point c2 = s2->getCentroid();
00022   return c1.isAbove(c2,dist);
00023 }
00024 
00025 ShapeRoot find_shape(const std::vector<ShapeRoot> &vec, const std::string &name) {
00026   for ( std::vector<ShapeRoot>::const_iterator it = vec.begin();
00027         it != vec.end(); it++ )
00028     if ( (*it)->getName() == name )
00029       return *it;
00030   return ShapeRoot();
00031 }
00032 
00033 } // namespace

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