GEOS  3.4.2
CGAlgorithms.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: algorithm/CGAlgorithms.java r378 (JTS-1.12)
18  *
19  **********************************************************************/
20 
21 #ifndef GEOS_ALGORITHM_CGALGORITHM_H
22 #define GEOS_ALGORITHM_CGALGORITHM_H
23 
24 #include <geos/export.h>
25 #include <vector>
26 
27 // Forward declarations
28 namespace geos {
29  namespace geom {
30  class Coordinate;
31  class CoordinateSequence;
32  }
33 }
34 
35 
36 namespace geos {
37 namespace algorithm { // geos::algorithm
38 
47 class GEOS_DLL CGAlgorithms {
48 
49 public:
50 
51  enum {
52  CLOCKWISE=-1,
53  COLLINEAR,
54  COUNTERCLOCKWISE
55  };
56 
57  enum {
58  RIGHT=-1,
59  LEFT,
60  STRAIGHT
61  };
62 
63  CGAlgorithms(){}
64 
81  static bool isPointInRing(const geom::Coordinate& p,
82  const geom::CoordinateSequence* ring);
83 
85  static bool isPointInRing(const geom::Coordinate& p,
86  const std::vector<const geom::Coordinate*>& ring);
87 
102  static int locatePointInRing(const geom::Coordinate& p,
103  const geom::CoordinateSequence& ring);
104 
106  static int locatePointInRing(const geom::Coordinate& p,
107  const std::vector<const geom::Coordinate*>& ring);
108 
116  static bool isOnLine(const geom::Coordinate& p,
117  const geom::CoordinateSequence* pt);
118 
134  static bool isCCW(const geom::CoordinateSequence* ring);
135 
148  static int computeOrientation(const geom::Coordinate& p1,
149  const geom::Coordinate& p2,
150  const geom::Coordinate& q);
151 
162  static double distancePointLine(const geom::Coordinate& p,
163  const geom::Coordinate& A,
164  const geom::Coordinate& B);
165 
175  static double distancePointLinePerpendicular(const geom::Coordinate& p,
176  const geom::Coordinate& A,
177  const geom::Coordinate& B);
178 
189  static double distanceLineLine(const geom::Coordinate& A,
190  const geom::Coordinate& B,
191  const geom::Coordinate& C,
192  const geom::Coordinate& D);
193 
198  static double signedArea(const geom::CoordinateSequence* ring);
199 
207  static double length(const geom::CoordinateSequence* pts);
208 
221  static int orientationIndex(const geom::Coordinate& p1,
222  const geom::Coordinate& p2,
223  const geom::Coordinate& q);
224 
225 };
226 
227 } // namespace geos::algorithm
228 } // namespace geos
229 
230 #endif // GEOS_ALGORITHM_CGALGORITHM_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
Specifies and implements various fundamental Computational Geometric algorithms. The algorithms suppl...
Definition: CGAlgorithms.h:47