Triangle.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/geometry/Triangle.h
22 
23  \brief Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary.
24 */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_TRIANGLE_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_TRIANGLE_H
28 
29 // TerraLib
30 #include "Polygon.h"
31 
32 namespace te
33 {
34  namespace gm
35  {
36  /*!
37  \class Triangle
38 
39  \brief Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary.
40 
41  \ingroup geometry
42 
43  \sa Geometry,
44  AbstractPoint, Point, PointM, PointZ, PointZM, PointKd,
45  Curve, LineString, LinearRing, Line, CircularString, CompoundCurve,
46  Surface, CurvePolygon, Polygon, PolyhedralSurface, TIN,
47  GeometryCollection, MultiSurface, MultiCurve,
48  MultiPoint, MultiLineString, MultiPolygon
49  */
50  class TEGEOMEXPORT Triangle : public Polygon
51  {
52  public:
53 
55 
56  /** @name Initializer methods on geometric objects
57  * Methods for initializing a geometric object.
58  */
59  //@{
60 
61  /*!
62  \brief It initializes the Geometry with the specified spatial reference system id and envelope.
63 
64  \param nRings The number of rings forming the triangle.
65  \param t The internal type of the Geometry.
66  \param srid The Spatial Reference System ID associated to the Geometry.
67  \param mbr The minimum bounding rectangle of this geometry (i.e., its envelope). It may be a NULL value.
68 
69  \note The Geometry will take the ownership of the given mbr.
70  \note The nRing informed should be 0 or 1.
71 
72  \warning Set all nRing informed, otherwise you can not use methods like computeMBR().
73  */
74  Triangle(std::size_t nRings, GeomType t, int srid = 0, Envelope* mbr = 0);
75 
76  /*!
77  \brief It initializes the Geometry with the specified spatial reference system id and envelope.
78 
79  \param t The internal type of the Geometry.
80  \param srid The Spatial Reference System ID associated to the Geometry.
81  \param mbr The minimum bounding rectangle of this geometry (i.e., its envelope).
82 
83  \note The Geometry will take the ownership of the given mbr.
84  */
85  Triangle(GeomType t, int srid = 0, Envelope* mbr = 0);
86 
87  /*!
88  \brief Copy constructor.
89 
90  \param rhs The other geometry.
91  */
92  Triangle(const Triangle& rhs);
93 
94  /*! \brief Destructor. */
95  ~Triangle() {}
96 
97  /*!
98  \brief Assignment operator.
99 
100  \param rhs The other geometry.
101 
102  \return A reference for this.
103  */
104  Triangle& operator=(const Triangle& rhs);
105 
106  //@}
107 
108  public:
109  std::size_t number_of_children; //!< number of children of the triangle
110  std::size_t number_of_parents; //!< number of parents of the triangle
111  std::vector<Triangle> children; //!< references to the children of the triangle
112  Triangle *adjacent[3]; //!< references to the adjacentof the triangle
113  Triangle *parents[2]; //!< references to the parents of the triangle
114  int triangle_index; //!< triangle index in vector
115  double xc, yc; //!< circumcenter coordinates of the circunference defined from the 3 points of the triangle
116  double r; //!< circunference radius
117  bool processed, visited; //!< flags
118  };
119 
120  } // end namespace gm
121 } // end namespace te
122 
123 #endif // __TERRALIB_GEOMETRY_INTERNAL_TRIANGLE_H
124 
125 
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
std::vector< Triangle > children
references to the children of the triangle
Definition: Triangle.h:111
int triangle_index
triangle index in vector
Definition: Triangle.h:114
double r
circunference radius
Definition: Triangle.h:116
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary.
Definition: Triangle.h:50
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
double yc
circumcenter coordinates of the circunference defined from the 3 points of the triangle ...
Definition: Triangle.h:115
#define TE_DEFINE_VISITABLE
Definition: BaseVisitable.h:75
bool visited
flags
Definition: Triangle.h:117
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
std::size_t number_of_parents
number of parents of the triangle
Definition: Triangle.h:110
~Triangle()
Destructor.
Definition: Triangle.h:95
std::size_t number_of_children
number of children of the triangle
Definition: Triangle.h:109