xc
PolygonWithHoles2d.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //PolYgonoWithHoles2d.h
22 
23 #ifndef POLYGON_WITH_HOLES_2D_H
24 #define POLYGON_WITH_HOLES_2D_H
25 
26 #include "utility/geom/d2/Surface2d.h"
27 
28 class Line2d;
29 class Ray2d;
30 class Segment2d;
31 class Polygon2d;
32 class Polyline2d;
33 
34 
36 //
39  {
40  CGPolygonWithHoles_2 cgpol; //CGAL polygon.
41  public:
42  typedef CGPolygonWithHoles_2::Hole_const_iterator Hole_const_iterator;
43 
44  PolygonWithHoles2d(void);
45  explicit PolygonWithHoles2d(const Polygon2d &);
46  virtual GeomObj *getCopy(void) const;
47 
48  bool In(const Pos2d &p, const double &tol) const;
49  GEOM_FT getLength(void) const;
50  inline GEOM_FT getPerimeter(void) const
51  { return getLength(); }
52  GEOM_FT getArea(void) const;
53  GEOM_FT GetMax(unsigned short int i) const;
54  GEOM_FT GetMin(unsigned short int i) const;
55  Pos2d getCenterOfMass(void) const;
56  GEOM_FT Ix(void) const;
57  GEOM_FT Iy(void) const;
58  GEOM_FT Pxy(void) const;
59 
61  void Transform(const Trf2d &);
62 
63  void add_hole(const Polygon2d &);
64  void contour(const Polygon2d &);
65 
66  void Print(std::ostream &) const;
67  };
68 
69 #endif
70 
71 
72 
Polígono que puede tener huecos.
Definition: PolygonWithHoles2d.h:38
virtual GeomObj * getCopy(void) const
Constructor virtual.
Definition: PolygonWithHoles2d.cc:38
GEOM_FT getArea(void) const
Return the object area.
Definition: PolygonWithHoles2d.cc:62
GEOM_FT Pxy(void) const
Calcula el product of inertia with respect to the axis parallel to the x and y that passes through th...
Definition: PolygonWithHoles2d.cc:226
bool In(const Pos2d &p, const double &tol) const
Return true if the point is inside the object.
Definition: PolygonWithHoles2d.cc:124
Posición en dos dimensiones.
Definition: Pos2d.h:41
Line in a two-dimensional space.
Definition: Line2d.h:61
void add_hole(const Polygon2d &)
Hace un agujero en este polígono con la forma del que se le pasa como parámetro.
Definition: PolygonWithHoles2d.cc:253
PolygonWithHoles2d getTransformed(const Trf2d &)
Applies the transformation being passed as parameter.
Definition: PolygonWithHoles2d.cc:257
GEOM_FT Iy(void) const
Calcula el moment of inertia with respect to an axis parallel to the y axis que pasa por el polygon c...
Definition: PolygonWithHoles2d.cc:202
Base class for two-dimensional transformations.
Definition: Trf2d.h:40
Pos2d getCenterOfMass(void) const
Return the center of mass.
Definition: PolygonWithHoles2d.cc:151
Base class for surfaces in a two-dimensional space.
Definition: Surface2d.h:33
Polígono en dos dimensiones.
Definition: Polygon2d.h:38
Segment in a two-dimensional space.
Definition: Segment2d.h:38
GEOM_FT GetMax(unsigned short int i) const
Return the maximum value of the i-th coordinate.
Definition: PolygonWithHoles2d.cc:82
GEOM_FT GetMin(unsigned short int i) const
Return the minimum value of the i-th coordinate.
Definition: PolygonWithHoles2d.cc:103
void Transform(const Trf2d &)
Applies the transformation being passed as parameter.
Definition: PolygonWithHoles2d.cc:280
Polyline in a two-dimensional space.
Definition: Polyline2d.h:41
Clase base para las entidades geométricas.
Definition: GeomObj.h:40
GEOM_FT getLength(void) const
Return object length.
Definition: PolygonWithHoles2d.cc:45
Ray in a two-dimensional space.
Definition: Ray2d.h:35
PolygonWithHoles2d(void)
Default constructor.
Definition: PolygonWithHoles2d.cc:30
GEOM_FT Ix(void) const
Compute moment of inertia with respect to an axis parallel to the x axis that passes through thecente...
Definition: PolygonWithHoles2d.cc:178