GEOS  3.4.2
Angle.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2009-2011  Sandro Santilli <strk@keybit.net>
00007  *
00008  * This is free software; you can redistribute and/or modify it under
00009  * the terms of the GNU Lesser General Public Licence as published
00010  * by the Free Software Foundation. 
00011  * See the COPYING file for more information.
00012  *
00013  **********************************************************************
00014  *
00015  * Last port: algorithm/Angle.java r378 (JTS-1.12)
00016  *
00017  **********************************************************************/
00018 
00019 #ifndef GEOS_ALGORITHM_ANGLE_H
00020 #define GEOS_ALGORITHM_ANGLE_H
00021 
00022 #include <geos/export.h>
00023 #include <geos/algorithm/CGAlgorithms.h> // for constants
00024 
00025 // Forward declarations
00026 namespace geos {
00027         namespace geom {
00028                 class Coordinate;
00029         }
00030 }
00031 
00032 namespace geos {
00033 namespace algorithm { // geos::algorithm
00034 
00036 //
00039 class GEOS_DLL Angle
00040 {
00041 public:
00042 
00043         static const double PI_TIMES_2; // 2.0 * PI;
00044         static const double PI_OVER_2; // PI / 2.0;
00045         static const double PI_OVER_4; // PI / 4.0;
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 } // namespace geos::algorithm
00225 } // namespace geos
00226 
00227 
00228 #endif // GEOS_ALGORITHM_ANGLE_H