1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /**
- * \file Polygon.cpp
- * \brief a polygon class
- * \author Gapchich Vladislav, Sven Sickert
- * \date 23/10/2011 (07/10/2015)
- */
- #ifndef __POLYGON_H__
- #define __POLYGON_H__
- #include "core/image/CoordT.h"
- #include <list>
- typedef std::list< NICE::CoordT< int > > PointsList;
- namespace OBJREC
- {
- //! \brief Contains category ID and point list of the polygon
- class Polygon
- {
- public:
- Polygon();
- Polygon ( const Polygon © );
- ~Polygon();
- void push ( const NICE::CoordT< int > &aPoint );
- void push ( const int &x, const int &y );
- void setID ( const int &anID );
- const PointsList * points() const;
- NICE::CoordT< int > pop();
- int id() const;
- // check whether point is inside polygon or not
- bool insidePolygon ( const NICE::CoordT< int > &aPoint );
- bool insidePolygon ( const int &px, const int &py );
- private:
- PointsList points_;
- /// id interpreted as a class label
- int id_;
- // helper function for point in polygon test
- bool handleEdge ( const int px, const int py,
- const int x1, const int y1,
- const int x2, const int y2,
- int & lastdir, int & c );
- public:
- /// unique id that distinguishs this particular bounding box object from all others
- int unique_id_;
- };
- } //namespace
- #endif /* __POLYGON_H__ */
|