GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

Angle.h
1 /**********************************************************************
2 * $Id: Angle.h 3363 2011-05-13 16:17:38Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2009-2011 Sandro Santilli <strk@keybit.net>
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: algorithm/Angle.java r378 (JTS-1.12)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_ALGORITHM_ANGLE_H
21 #define GEOS_ALGORITHM_ANGLE_H
22
23 #include <geos/export.h>
24 #include <geos/algorithm/CGAlgorithms.h> // for constants
25
26 // Forward declarations
27 namespace geos {
28 namespace geom {
29 class Coordinate;
30 }
31 }
32
33 namespace geos {
34 namespace algorithm { // geos::algorithm
35
37 //
40 class GEOS_DLL Angle
41 {
42 public:
43
44 static const double PI_TIMES_2; // 2.0 * PI;
45 static const double PI_OVER_2; // PI / 2.0;
46 static const double PI_OVER_4; // PI / 4.0;
47
49 static const int COUNTERCLOCKWISE = CGAlgorithms::COUNTERCLOCKWISE;
50
52 static const int CLOCKWISE = CGAlgorithms::CLOCKWISE;
53
55 static const int NONE = CGAlgorithms::COLLINEAR;
56
58 //
62 static double toDegrees(double radians);
63
65 //
69 static double toRadians(double angleDegrees);
70
74 //
80 static double angle(const geom::Coordinate& p0,
81 const geom::Coordinate& p1);
82
86 //
92 static double angle(const geom::Coordinate& p);
93
95 //
105 static bool isAcute(const geom::Coordinate& p0,
106 const geom::Coordinate& p1,
107 const geom::Coordinate& p2);
108
110 //
120 static bool isObtuse(const geom::Coordinate& p0,
121 const geom::Coordinate& p1,
122 const geom::Coordinate& p2);
123
125 //
133 static double angleBetween(const geom::Coordinate& tip1,
134 const geom::Coordinate& tail,
135 const geom::Coordinate& tip2);
136
138 //
149 static double angleBetweenOriented(const geom::Coordinate& tip1,
150 const geom::Coordinate& tail,
151 const geom::Coordinate& tip2);
152
154 //
166 static double interiorAngle(const geom::Coordinate& p0,
167 const geom::Coordinate& p1,
168 const geom::Coordinate& p2);
169
179 static int getTurn(double ang1, double ang2);
180
188 static double normalize(double angle);
189
208 static double normalizePositive(double angle);
209
210
212 //
221 static double diff(double ang1, double ang2);
222 };
223
224
225 } // namespace geos::algorithm
226 } // namespace geos
227
228
229 #endif // GEOS_ALGORITHM_ANGLE_H