xc
LineSegmentArrangement.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 //LineSegmentArrangement.h
22 
23 #ifndef LINESEGMENTARRANGEMENT_H
24 #define LINESEGMENTARRANGEMENT_H
25 
26 #include "utility/geom/d2/Surface2d.h"
27 #include <list>
28 #include "../../cgal_types.h"
29 #include "utility/geom/d1/Segment2d.h"
30 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
31 #include <CGAL/Arr_segment_traits_2.h>
32 #include <CGAL/Arrangement_2.h>
33 
34 //Arrangement of intersecting line segments.
35 
36 typedef CGAL::Exact_predicates_exact_constructions_kernel ArrKernel;
37 typedef CGAL::Arr_segment_traits_2<ArrKernel> ArrTraits_2;
38 typedef CGAL::Arrangement_2<ArrTraits_2> Arrangement_2;
39 
41 //
44  {
45  Arrangement_2 cgarr; // CGAL arrangement.
46  public:
48  LineSegmentArrangement(const std::list<Segment2d> &);
49  virtual GeomObj *getCopy(void) const;
50 
51  size_t getNumberOfVertices(void) const;
52  size_t getNumberOfEdges(void) const;
53  size_t getNumberOfFaces(void) const;
54 
55  GEOM_FT GetMax(unsigned short int i) const;
56  GEOM_FT GetMin(unsigned short int i) const;
57  Pos2d getCenterOfMass(void) const;
58  bool In(const Pos2d &p, const double &tol) const;
59  GEOM_FT Ix(void) const;
60  GEOM_FT Iy(void) const;
61  GEOM_FT Pxy(void) const;
62  void Transform(const Trf2d &);
63 
64  void Print(std::ostream &os) const;
65  };
66 
67 #endif
68 
69 
70 
71 
72 
73 
74 
size_t getNumberOfVertices(void) const
Return the number of vertices.
Definition: LineSegmentArrangement.cc:67
Posición en dos dimensiones.
Definition: Pos2d.h:41
GEOM_FT GetMax(unsigned short int i) const
Return the maximum value of the i-th coordinate.
Definition: LineSegmentArrangement.cc:88
Pos2d getCenterOfMass(void) const
Return the center of mass.
Definition: LineSegmentArrangement.cc:79
Base class for two-dimensional transformations.
Definition: Trf2d.h:40
bool In(const Pos2d &p, const double &tol) const
Return true if the point is inside the object.
Definition: LineSegmentArrangement.cc:104
void Transform(const Trf2d &)
Applies the transformation being passed as parameter.
Definition: LineSegmentArrangement.cc:142
Base class for surfaces in a two-dimensional space.
Definition: Surface2d.h:33
GEOM_FT Ix(void) const
Compute moment of inertia with respect to an axis parallel to the x axis that passes through thecente...
Definition: LineSegmentArrangement.cc:114
Base class for the polygonal surfaces.
Definition: LineSegmentArrangement.h:43
virtual GeomObj * getCopy(void) const
Virtual constructor.
Definition: LineSegmentArrangement.cc:63
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: LineSegmentArrangement.cc:124
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: LineSegmentArrangement.cc:134
Clase base para las entidades geométricas.
Definition: GeomObj.h:40
GEOM_FT GetMin(unsigned short int i) const
Return the minimum value of the i-th coordinate.
Definition: LineSegmentArrangement.cc:96
size_t getNumberOfEdges(void) const
Return the number of edges.
Definition: LineSegmentArrangement.cc:71
size_t getNumberOfFaces(void) const
Return the number of faces.
Definition: LineSegmentArrangement.cc:75