Polygon.hpp

00001 // This file is part of the imaging2 class library.
00002 //
00003 // University of Innsbruck, Infmath Imaging, 2009.
00004 // http://infmath.uibk.ac.at
00005 //
00006 // All rights reserved.
00007 
00008 
00009 #ifndef POLYTOPE_POLYGON_H
00010 #define POLYTOPE_POLYGON_H
00011 
00012 #include <polytope/SimplePolygon.hpp>
00013 
00014 namespace imaging
00015 {
00016 
00022   class Polygon
00023   {
00024     std::auto_ptr< std::vector<SimplePolygon> > _contours;
00025     std::auto_ptr< std::vector<SimplePolygon> > _holes;
00026     
00027   public:
00028     Polygon();
00029     
00031     Polygon(const Polygon & source);
00032     
00034     explicit Polygon(const SimplePolygon & simple_polygon);
00035     
00037     Polygon(std::auto_ptr< std::vector<SimplePolygon> > contours, std::auto_ptr< std::vector<SimplePolygon> > & holes);
00038     
00040     Polygon & operator=(const Polygon & source);
00041     
00043     void set_contours(std::auto_ptr< std::vector<SimplePolygon> > contours);
00044     
00046     void set_holes(std::auto_ptr< std::vector<SimplePolygon> > holes);
00047     
00049     const std::vector<SimplePolygon> & contours() const { return *_contours; }
00050     
00052     const std::vector<SimplePolygon> & holes() const { return *_holes; }
00053     
00055     size_t n_contours() const { return _contours->size(); }
00056     
00058     size_t n_holes() const { return _holes->size(); }
00059     
00061     const SimplePolygon & contour(size_t i) const { return (*_contours)[i]; }
00062     
00064     const SimplePolygon & hole(size_t i) const { return (*_holes)[i]; }
00065     
00067     void clear();
00068   };
00069   
00074   void polygon_union(const Polygon & poly_1, const Polygon & poly_2, Polygon & result);
00075 
00076 }
00077 
00078 #endif

Generated on Tue Feb 10 10:01:30 2009 for imaging2 by  doxygen 1.5.5