00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_ALGORITHM_ANGLE_H
00021 #define GEOS_ALGORITHM_ANGLE_H
00022
00023 #include <geos/algorithm/CGAlgorithms.h>
00024
00025
00026 namespace geos {
00027 namespace geom {
00028 class Coordinate;
00029 }
00030 }
00031
00032 namespace geos {
00033 namespace algorithm {
00034
00036
00039 class Angle
00040 {
00041 public:
00042
00043 static const double PI_TIMES_2;
00044 static const double PI_OVER_2;
00045 static const double PI_OVER_4;
00046
00048 static const int COUNTERCLOCKWISE = CGAlgorithms::COUNTERCLOCKWISE;
00049
00051 static const int CLOCKWISE = CGAlgorithms::CLOCKWISE;
00052
00054 static const int NONE = CGAlgorithms::COLLINEAR;
00055
00057
00061 static double toDegrees(double radians);
00062
00064
00068 static double toRadians(double angleDegrees);
00069
00073
00079 static double angle(const geom::Coordinate& p0,
00080 const geom::Coordinate& p1);
00081
00085
00091 static double angle(const geom::Coordinate& p);
00092
00094
00104 static bool isAcute(const geom::Coordinate& p0,
00105 const geom::Coordinate& p1,
00106 const geom::Coordinate& p2);
00107
00109
00119 static bool isObtuse(const geom::Coordinate& p0,
00120 const geom::Coordinate& p1,
00121 const geom::Coordinate& p2);
00122
00124
00132 static double angleBetween(const geom::Coordinate& tip1,
00133 const geom::Coordinate& tail,
00134 const geom::Coordinate& tip2);
00135
00137
00148 static double angleBetweenOriented(const geom::Coordinate& tip1,
00149 const geom::Coordinate& tail,
00150 const geom::Coordinate& tip2);
00151
00153
00165 static double interiorAngle(const geom::Coordinate& p0,
00166 const geom::Coordinate& p1,
00167 const geom::Coordinate& p2);
00168
00178 static int getTurn(double ang1, double ang2);
00179
00187 static double normalize(double angle);
00188
00207 static double normalizePositive(double angle);
00208
00209
00211
00220 static double diff(double ang1, double ang2);
00221 };
00222
00223
00224 }
00225 }
00226
00227
00228 #endif // GEOS_ALGORITHM_ANGLE_H