GEOS: Angle.h Source File

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

- File List

# Angle.h

    00001 /**********************************************************************
    00002  * $Id: Angle.h 2809 2009-12-06 01:05:24Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2009  Sandro Santilli <strk@keybit.net>
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************
    00015  *
    00016  * Last port: algorithm/Angle.java rev. 1.6 (JTS-1.9)
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_ALGORITHM_ANGLE_H
    00021 #define GEOS_ALGORITHM_ANGLE_H
    00022
    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 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