GEOS  3.8.0dev
Angle.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2009-2011 Sandro Santilli <strk@kbt.io>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
12  *
13  **********************************************************************
14  *
15  * Last port: algorithm/Angle.java r378 (JTS-1.12)
16  *
17  **********************************************************************/
18
19 #ifndef GEOS_ALGORITHM_ANGLE_H
20 #define GEOS_ALGORITHM_ANGLE_H
21
22 #include <geos/export.h>
23 #include <geos/algorithm/Orientation.h> // for constants
24
25 // Forward declarations
26 namespace geos {
27 namespace geom {
28 class Coordinate;
29 }
30 }
31
32 namespace geos {
33 namespace algorithm { // geos::algorithm
34
36 //
39 class GEOS_DLL Angle {
40 public:
41
42  static const double PI_TIMES_2; // 2.0 * PI;
43  static const double PI_OVER_2; // PI / 2.0;
44  static const double PI_OVER_4; // PI / 4.0;
45
47  static const int COUNTERCLOCKWISE = Orientation::COUNTERCLOCKWISE;
48
50  static const int CLOCKWISE = Orientation::CLOCKWISE;
51
53  static const int NONE = Orientation::COLLINEAR;
54
56  //
61
63  //
68
72  //
78  static double angle(const geom::Coordinate& p0,
79  const geom::Coordinate& p1);
80
84  //
90  static double angle(const geom::Coordinate& p);
91
93  //
103  static bool isAcute(const geom::Coordinate& p0,
104  const geom::Coordinate& p1,
105  const geom::Coordinate& p2);
106
108  //
118  static bool isObtuse(const geom::Coordinate& p0,
119  const geom::Coordinate& p1,
120  const geom::Coordinate& p2);
121
123  //
131  static double angleBetween(const geom::Coordinate& tip1,
132  const geom::Coordinate& tail,
133  const geom::Coordinate& tip2);
134
136  //
147  static double angleBetweenOriented(const geom::Coordinate& tip1,
148  const geom::Coordinate& tail,
149  const geom::Coordinate& tip2);
150
152  //
164  static double interiorAngle(const geom::Coordinate& p0,
165  const geom::Coordinate& p1,
166  const geom::Coordinate& p2);
167
177  static int getTurn(double ang1, double ang2);
178
186  static double normalize(double angle);
187
206  static double normalizePositive(double angle);
207
208
210  //
219  static double diff(double ang1, double ang2);
220 };
221
222
223 } // namespace geos::algorithm
224 } // namespace geos
225
226
227 #endif // GEOS_ALGORITHM_ANGLE_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Utility functions for working with angles.
Definition: Angle.h:39