# CGAlgorithms.h

    00001 /**********************************************************************
    00002  * $Id: CGAlgorithms.h 1820 2006-09-06 16:54:23Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2005-2006 Refractions Research Inc.
    00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************
    00016  *
    00017  * Last port: algorithm/CGAlgorithms.java rev. 1.34 (JTS-1.7.1)
    00018  *
    00019  **********************************************************************/
    00020
    00021 #ifndef GEOS_ALGORITHM_CGALGORITHM_H
    00022 #define GEOS_ALGORITHM_CGALGORITHM_H
    00023
    00024 #include <vector>
    00025
    00026 // Forward declarations
    00027 namespace geos {
    00028         namespace geom {
    00029                 class Coordinate;
    00030                 class CoordinateSequence;
    00031         }
    00032 }
    00033
    00034
    00035 namespace geos {
    00036 namespace algorithm { // geos::algorithm
    00037
    00046 class CGAlgorithms {
    00047
    00048 public:
    00049
    00050         enum {
    00051                 CLOCKWISE=-1,
    00052                 COLLINEAR,
    00053                 COUNTERCLOCKWISE
    00054         };
    00055
    00056         enum {
    00057                 RIGHT=-1,
    00058                 LEFT,
    00059                 STRAIGHT
    00060         };
    00061
    00062         CGAlgorithms(){};
    00063
    00078         static bool isPointInRing(const geom::Coordinate& p,
    00079                         const geom::CoordinateSequence* ring);
    00080
    00082         static bool isPointInRing(const geom::Coordinate& p,
    00083                         const std::vector<const geom::Coordinate*>& ring);
    00084
    00092         static bool isOnLine(const geom::Coordinate& p,
    00093                 const geom::CoordinateSequence* pt);
    00094
    00110         static bool isCCW(const geom::CoordinateSequence* ring);
    00111
    00124         static int computeOrientation(const geom::Coordinate& p1,
    00125                         const geom::Coordinate& p2,
    00126                         const geom::Coordinate& q);
    00127
    00138         static double distancePointLine(const geom::Coordinate& p,
    00139                         const geom::Coordinate& A,
    00140                         const geom::Coordinate& B);
    00141
    00151         static double distancePointLinePerpendicular(const geom::Coordinate& p,
    00152                         const geom::Coordinate& A,
    00153                         const geom::Coordinate& B);
    00154
    00165         static double distanceLineLine(const geom::Coordinate& A,
    00166                         const geom::Coordinate& B,
    00167                         const geom::Coordinate& C,
    00168                         const geom::Coordinate& D);
    00169
    00174         static double signedArea(const geom::CoordinateSequence* ring);
    00175
    00183         static double length(const geom::CoordinateSequence* pts);
    00184
    00197         static int orientationIndex(const geom::Coordinate& p1,
    00198                         const geom::Coordinate& p2,
    00199                         const geom::Coordinate& q);
    00200
    00201 };
    00202
    00203 } // namespace geos::algorithm
    00204 } // namespace geos
    00205
    00206 #endif // GEOS_ALGORITHM_CGALGORITHM_H
    00207
    00208 /**********************************************************************
    00209  * $Log$
    00210  * Revision 1.2  2006/05/02 14:51:53  strk
    00211  * Added port info and fixed doxygen comments for CGAlgorithms class
    00212  *
    00213  * Revision 1.1  2006/03/09 16:46:48  strk
    00214  * geos::geom namespace definition, first pass at headers split
    00215  *
    00216  **********************************************************************/
    00217