GEOS 3.6.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
28namespace geos {
29 namespace geom {
30 class Coordinate;
32 }
33}
34
35
36namespace geos {
37namespace algorithm { // geos::algorithm
38
47class GEOS_DLL CGAlgorithms {
48
49public:
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
103 const geom::CoordinateSequence& ring);
104
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
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
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
static int locatePointInRing(const geom::Coordinate &p, const std::vector< const geom::Coordinate * > &ring)
Same as above, but taking a vector of const Coordinates.
static double distancePointLinePerpendicular(const geom::Coordinate &p, const geom::Coordinate &A, const geom::Coordinate &B)
Computes the perpendicular distance from a point p to the (infinite) line containing the points AB.
static int computeOrientation(const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q)
Computes the orientation of a point q to the directed line segment p1-p2.
static bool isOnLine(const geom::Coordinate &p, const geom::CoordinateSequence *pt)
Test whether a point lies on the given line segment.
static double distancePointLine(const geom::Coordinate &p, const geom::Coordinate &A, const geom::Coordinate &B)
Computes the distance from a point p to a line segment AB.
static bool isPointInRing(const geom::Coordinate &p, const std::vector< const geom::Coordinate * > &ring)
Same as above, but taking a vector of const Coordinates (faster).
static int orientationIndex(const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q)
Returns the index of the direction of the point q relative to a vector specified by p1-p2.
static double distanceLineLine(const geom::Coordinate &A, const geom::Coordinate &B, const geom::Coordinate &C, const geom::Coordinate &D)
Computes the distance from a line segment AB to a line segment CD.
static double signedArea(const geom::CoordinateSequence *ring)
Returns the signed area for a ring. The area is positive if the ring is oriented CW.
static double length(const geom::CoordinateSequence *pts)
Computes the length of a linestring specified by a sequence of points.
static bool isCCW(const geom::CoordinateSequence *ring)
Computes whether a ring defined by an array of Coordinate is oriented counter-clockwise.
static int locatePointInRing(const geom::Coordinate &p, const geom::CoordinateSequence &ring)
Determines whether a point lies in the interior, on the boundary, or in the exterior of a ring.
static bool isPointInRing(const geom::Coordinate &p, const geom::CoordinateSequence *ring)
Tests whether a point lies inside a ring.
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:33
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25