26 #include "utility/geom/d2/2d_polygons/PolygonalSurface2d.h" 41 template <
class inputIterator>
42 bool Overlap(inputIterator begin, inputIterator end)
const;
44 inline bool In(
const CGPoint_2 &p)
const 45 {
return In(
Pos2d(p)); }
46 inline bool Overlap(
const CGPoint_2 &p)
const 47 {
return Overlap(
Pos2d(p)); }
50 typedef CGPolygon_2::Vertex_iterator vertex_iterator;
51 typedef CGPolygon_2::Vertex_circulator vertex_circulator;
52 typedef CGPolygon_2::Edge_const_iterator edge_const_iterator;
53 typedef CGPolygon_2::Edge_const_circulator edge_const_circulator;
58 explicit Polygon2d(
const std::list<Polygon2d> &lp);
60 explicit Polygon2d(
const boost::python::list &);
62 const CGPolygon_2 &ToCGAL(
void)
const 65 inline virtual unsigned int getNumVertices(
void)
const 66 {
return cgpol.size(); }
67 inline void push_back(
const Pos2d &p)
68 { cgpol.push_back(p.ToCGAL()); }
70 inline vertex_iterator
insert(vertex_iterator i,
const Pos2d &q)
71 {
return cgpol.insert(i,q.ToCGAL()); }
74 template <
class InputIterator>
75 inline void insert(vertex_iterator i,
78 { cgpol.insert(i,first,last); }
81 void set(vertex_iterator i,
const Pos2d &p)
82 { cgpol.set(i,p.ToCGAL()); }
83 void erase(vertex_iterator i)
87 void erase(vertex_iterator first,vertex_iterator last)
88 { cgpol.erase(first,last); }
91 { cgpol.erase(cgpol.vertices_begin(),cgpol.vertices_end()); }
93 vertex_iterator vertices_begin(
void)
const 96 {
return cgpol.vertices_begin(); }
97 vertex_iterator vertices_end(
void)
const 99 {
return cgpol.vertices_end(); }
100 vertex_circulator vertices_circulator(
void)
103 {
return cgpol.vertices_circulator(); }
104 edge_const_iterator edges_begin(
void)
const 107 {
return cgpol.edges_begin(); }
108 edge_const_iterator edges_end(
void)
110 {
return cgpol.edges_end(); }
111 edge_const_circulator edges_circulator(
void)
const 114 {
return cgpol.edges_circulator(); }
122 inline bool clockwise(
void)
const 123 {
return (cgpol.is_clockwise_oriented());}
124 inline bool counterclockwise(
void)
const 125 {
return (cgpol.is_counterclockwise_oriented()); }
126 inline void swap(
void)
127 { cgpol.reverse_orientation(); }
133 inline GEOM_FT AreaSigno(
void)
const 134 {
return cgpol.area(); }
135 virtual GEOM_FT
getArea(
void)
const;
138 virtual GEOM_FT
GetMax(
unsigned short int i)
const;
139 virtual GEOM_FT
GetMin(
unsigned short int i)
const;
140 virtual bool In(
const Pos2d &p,
const double &tol= 0.0)
const;
141 template <
class inputIterator>
142 bool In(inputIterator begin, inputIterator end)
const;
145 bool Overlap(
const Pos2d &)
const;
146 bool Overlap(
const Line2d &r)
const;
147 bool Overlap(
const Ray2d &sr)
const;
149 bool Overlap(
const BND2d &)
const;
152 bool Overlap(
const std::list<Polygon2d> &)
const;
154 bool intersects(
const T &t)
const 155 {
return Overlap(t); }
162 {
return Pos2d(cgpol.vertex(j)); }
172 void une(
const std::list<Polygon2d> &l);
177 std::list<Polygon2d>
Clip(
const BND2d &bnd)
const;
200 {
return getTransformed(pol2d,trf2d); }
212 template <
class inputIterator>
213 bool Polygon2d::In(inputIterator begin, inputIterator end)
const 216 for(inputIterator i= begin;i!=end;i++)
227 template <
class inputIterator>
228 bool Polygon2d::Overlap(inputIterator begin, inputIterator end)
const 231 for(inputIterator i= begin;i!=end;i++)
"boundary" en dos dimensiones.
Definition: BND2d.h:38
Base class for position lists.
Definition: PolyPos.h:35
Posición en dos dimensiones.
Definition: Pos2d.h:41
Pos2d Vertice(unsigned int i) const
Return the position of the i-th vertex.
Definition: Polygon2d.h:157
Line in a two-dimensional space.
Definition: Line2d.h:61
Base class for two-dimensional transformations.
Definition: Trf2d.h:40
vertex_iterator insert(vertex_iterator i, const Pos2d &q)
Insert vertex q before the vertex pointed by i.
Definition: Polygon2d.h:70
Pos2d Vertice0(unsigned int j) const
Return the position of the i-th vertex (0 based: j=0..getNumVertices()-1).
Definition: Polygon2d.h:161
void clipBy(const Polygon2d &)
Clip this polygont with the polygon argument.
Definition: Polygon2d.cc:499
std::list< Polygon2d > getBayazitDecomposition(void) const
Return the decomposition obtained using the Mark Bayazit algorithm.
Definition: Polygon2d.cc:543
boost::python::list ClipPy(const BND2d &) const
Return the polygons that result from clipping this one with the BND argument in a Python list...
Definition: Polygon2d.cc:473
Base class for the polygonal surfaces.
Definition: PolygonalSurface2d.h:38
void Transform(const Trf2d &trf2d)
Aplica a los vértices la transformación que se pasa como parámetro.
Definition: Polygon2d.cc:362
void erase(vertex_iterator first, vertex_iterator last)
Elimina el vértice los vértices del rango [first,last).
Definition: Polygon2d.h:87
const Pos2d center_of_mass(InputIter begin, InputIter end)
Return the center of mass of the objects.
Definition: center_of_mass.h:30
Polygon2d getUnion(const Polygon2d &other) const
Return the union of this polygon with the argument.
Definition: Polygon2d.cc:551
Polígono en dos dimensiones.
Definition: Polygon2d.h:38
Segment in a two-dimensional space.
Definition: Segment2d.h:38
boost::python::list getVertexListPy(void) const
Return a Python list containing the positions of the polygon vertices.
Definition: Polygon2d.cc:351
std::vector< Polygon2d > getTributaryPolygons(void) const
Return the polygons that form the tributary area of each vertex.
Definition: Polygon2d.cc:387
std::deque< GEOM_FT > & getCovers(const Pos2dList &) const
Return the cover of the positions in the argument.
Definition: Polygon2d.cc:426
void makeCounterClockWise(void)
Makes the polygon counter clockwise.
Definition: Polygon2d.cc:215
Polygon2d(void)
Default constructor.
Definition: Polygon2d.cc:52
virtual GEOM_FT GetMax(unsigned short int i) const
Return the maximum value of the i-th coordinate.
Definition: Polygon2d.cc:315
std::vector< double > getTributaryAreas(void) const
Return the areas of the tributary polygons (one for each vertex).
Definition: Polygon2d.cc:415
virtual GeomObj * getCopy(void) const
Constructor virtual.
Definition: Polygon2d.cc:99
virtual GEOM_FT GetMin(unsigned short int i) const
Return the minimum value of the i-th coordinate.
Definition: Polygon2d.cc:328
Half plane in a two-dimensional space.
Definition: HalfPlane2d.h:38
Segment2d Clip(const Line2d &) const
Return the intersection of the polygon with the line.
Definition: Polygon2d.cc:455
Polygon2d buffer(const GEOM_FT &d) const
Returns the buffer (a polygon being the spatial point set collection within a specified maximum dista...
Definition: Polygon2d.cc:134
Polygon2d offset(const GEOM_FT &d) const
Return a polygon parallel to this one at the given distance.
Definition: Polygon2d.cc:104
void insert(vertex_iterator i, InputIterator first, InputIterator last)
Insert the vertices between [first,last) before the vertex pointed by i.
Definition: Polygon2d.h:75
void erase(void)
Elimina el vértice los vértices del rango [first,last).
Definition: Polygon2d.h:90
Segment2d getIntersection(const Line2d &) const
Return the intersection of the polygon with the given line.
Definition: Polygon2d.cc:503
Polyline in a two-dimensional space.
Definition: Polyline2d.h:41
virtual GEOM_FT getArea(void) const
Return the polygon area.
Definition: Polygon2d.cc:383
boost::python::list getIntersectionPy(const HalfPlane2d &) const
Return the intersection with the given half plane in a Python list.
Definition: Polygon2d.cc:519
Clase base para las entidades geométricas.
Definition: GeomObj.h:40
Ray in a two-dimensional space.
Definition: Ray2d.h:35
List of 2D positions.
Definition: Pos2dList.h:33