GEOS 3.9.1
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.
11 * See the COPYING file for more information.
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
26namespace geos {
27namespace geom {
28class Coordinate;
29}
30}
31
32namespace geos {
33namespace algorithm { // geos::algorithm
34
36//
39class GEOS_DLL Angle {
40public:
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
60 static double toDegrees(double radians);
61
67 static double toRadians(double angleDegrees);
68
78 static double angle(const geom::Coordinate& p0,
79 const geom::Coordinate& p1);
80
84 //
90 static double angle(const geom::Coordinate& p);
91
103 static bool isAcute(const geom::Coordinate& p0,
104 const geom::Coordinate& p1,
105 const geom::Coordinate& p2);
106
118 static bool isObtuse(const geom::Coordinate& p0,
119 const geom::Coordinate& p1,
120 const geom::Coordinate& p2);
121
131 static double angleBetween(const geom::Coordinate& tip1,
132 const geom::Coordinate& tail,
133 const geom::Coordinate& tip2);
134
147 static double angleBetweenOriented(const geom::Coordinate& tip1,
148 const geom::Coordinate& tail,
149 const geom::Coordinate& tip2);
150
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
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
Utility functions for working with angles.
Definition: Angle.h:39
static double diff(double ang1, double ang2)
static double angle(const geom::Coordinate &p0, const geom::Coordinate &p1)
Returns the angle of the vector from p0 to p1, relative to the positive X-axis.
static double angleBetween(const geom::Coordinate &tip1, const geom::Coordinate &tail, const geom::Coordinate &tip2)
static bool isObtuse(const geom::Coordinate &p0, const geom::Coordinate &p1, const geom::Coordinate &p2)
static int getTurn(double ang1, double ang2)
Returns whether an angle must turn clockwise or counterclockwise to overlap another angle.
static double interiorAngle(const geom::Coordinate &p0, const geom::Coordinate &p1, const geom::Coordinate &p2)
static bool isAcute(const geom::Coordinate &p0, const geom::Coordinate &p1, const geom::Coordinate &p2)
static double toDegrees(double radians)
static double normalizePositive(double angle)
Computes the normalized positive value of an angle, which is the equivalent angle in the range [ 0,...
static double normalize(double angle)
Computes the normalized value of an angle, which is the equivalent angle in the range ( -Pi,...
static double toRadians(double angleDegrees)
static double angle(const geom::Coordinate &p)
Returns the angle that the vector from (0,0) to p, relative to the positive X-axis.
static double angleBetweenOriented(const geom::Coordinate &tip1, const geom::Coordinate &tail, const geom::Coordinate &tip2)
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26