GEOS  3.8.0dev
Orientation.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2018 Paul Ramsey <pramsey@cleverlephant.ca>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: algorithm/Orientation.java @ 2017-09-04
16  *
17  **********************************************************************/
18
19 #ifndef GEOS_ALGORITHM_ORIENTATION_H
20 #define GEOS_ALGORITHM_ORIENTATION_H
21
22 #include <geos/export.h>
23 #include <geos/geom/Coordinate.h>
24 #include <geos/geom/CoordinateSequence.h>
25
26 namespace geos {
27 namespace algorithm { // geos::algorithm
28
43 class GEOS_DLL Orientation {
44 public:
45
46  /* A value that indicates an orientation or turn */
47  enum {
48  CLOCKWISE = -1,
49  COLLINEAR = 0,
50  COUNTERCLOCKWISE = 1,
51  RIGHT = -1,
52  LEFT = 1,
53  STRAIGHT = 0
54  };
55
56  /*
57  * Returns the orientation index of the direction of the point q relative to
58  * a directed infinite line specified by p1-p2.
59  * The index indicates whether the point lies to the
60  * {@link #Orientation::LEFT} or {@link #Orientation::RIGHT}
61  * of the line, or lies on it {@link #Orientation::COLLINEAR}.
62  * The index also indicates the orientation of the triangle formed
63  * by the three points
64  * ( {@link #Orientation::COUNTERCLOCKWISE},
65  * {@link #Orientation::CLOCKWISE}, or {@link #Orientation::STRAIGHT} )
66  */
67  static int index(const geom::Coordinate& p1, const geom::Coordinate& p2,
68  const geom::Coordinate& q);
69
87  static bool isCCW(const geom::CoordinateSequence* ring);
88
89 };
90
91
92 } // namespace geos::algorithm
93 } // namespace geos
94
95
96 #endif // GEOS_ALGORITHM_ORIENTATION_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Definition: Orientation.h:43
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58