00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GEOS_ALGORITHM_CGALGORITHM_H
00022 #define GEOS_ALGORITHM_CGALGORITHM_H
00023
00024 #include <vector>
00025
00026
00027 namespace geos {
00028 namespace geom {
00029 class Coordinate;
00030 class CoordinateSequence;
00031 }
00032 }
00033
00034
00035 namespace geos {
00036 namespace 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 }
00204 }
00205
00206 #endif // GEOS_ALGORITHM_CGALGORITHM_H
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217