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 <geos/export.h>
00025 #include <vector>
00026
00027
00028 namespace geos {
00029 namespace geom {
00030 class Coordinate;
00031 class CoordinateSequence;
00032 }
00033 }
00034
00035
00036 namespace geos {
00037 namespace algorithm {
00038
00047 class GEOS_DLL CGAlgorithms {
00048
00049 public:
00050
00051 enum {
00052 CLOCKWISE=-1,
00053 COLLINEAR,
00054 COUNTERCLOCKWISE
00055 };
00056
00057 enum {
00058 RIGHT=-1,
00059 LEFT,
00060 STRAIGHT
00061 };
00062
00063 CGAlgorithms(){};
00064
00081 static bool isPointInRing(const geom::Coordinate& p,
00082 const geom::CoordinateSequence* ring);
00083
00085 static bool isPointInRing(const geom::Coordinate& p,
00086 const std::vector<const geom::Coordinate*>& ring);
00087
00102 static int locatePointInRing(const geom::Coordinate& p,
00103 const geom::CoordinateSequence& ring);
00104
00106 static int locatePointInRing(const geom::Coordinate& p,
00107 const std::vector<const geom::Coordinate*>& ring);
00108
00116 static bool isOnLine(const geom::Coordinate& p,
00117 const geom::CoordinateSequence* pt);
00118
00134 static bool isCCW(const geom::CoordinateSequence* ring);
00135
00148 static int computeOrientation(const geom::Coordinate& p1,
00149 const geom::Coordinate& p2,
00150 const geom::Coordinate& q);
00151
00162 static double distancePointLine(const geom::Coordinate& p,
00163 const geom::Coordinate& A,
00164 const geom::Coordinate& B);
00165
00175 static double distancePointLinePerpendicular(const geom::Coordinate& p,
00176 const geom::Coordinate& A,
00177 const geom::Coordinate& B);
00178
00189 static double distanceLineLine(const geom::Coordinate& A,
00190 const geom::Coordinate& B,
00191 const geom::Coordinate& C,
00192 const geom::Coordinate& D);
00193
00198 static double signedArea(const geom::CoordinateSequence* ring);
00199
00207 static double length(const geom::CoordinateSequence* pts);
00208
00221 static int orientationIndex(const geom::Coordinate& p1,
00222 const geom::Coordinate& p2,
00223 const geom::Coordinate& q);
00224
00225 };
00226
00227 }
00228 }
00229
00230 #endif // GEOS_ALGORITHM_CGALGORITHM_H
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241