GEOS  3.13.0dev
PolygonNodeTopology.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://libgeos.org
5  *
6  * Copyright (c) 2021 Martin Davis
7  * Copyright (C) 2022 Paul Ramsey <pramsey@cleverlephant.ca>
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************/
15 
16 #pragma once
17 
18 #include <geos/export.h>
19 
20 
21 // Forward declarations
22 namespace geos {
23 namespace geom {
24 class CoordinateXY;
25 }
26 }
27 
28 using geos::geom::CoordinateXY;
29 
30 
31 namespace geos {
32 namespace algorithm { // geos::algorithm
33 
41 class GEOS_DLL PolygonNodeTopology {
42 
43 public:
44 
45  /*
46  * Check if the segments at a node between two rings (or one ring) cross.
47  * The node is topologically valid if the rings do not cross.
48  * This function assumes that the segments are not collinear.
49  *
50  * @param nodePt the node location
51  * @param a0 the previous segment endpoint in a ring
52  * @param a1 the next segment endpoint in a ring
53  * @param b0 the previous segment endpoint in the other ring
54  * @param b1 the next segment endpoint in the other ring
55  * @return true if the rings cross at the node
56  */
57  static bool
58  isCrossing(const CoordinateXY* nodePt,
59  const CoordinateXY* a0, const CoordinateXY* a1,
60  const CoordinateXY* b0, const CoordinateXY* b1);
61 
62 
76  static bool isInteriorSegment(const CoordinateXY* nodePt,
77  const CoordinateXY* a0, const CoordinateXY* a1, const CoordinateXY* b);
78 
79 
80 private:
81 
94  static bool isBetween(const CoordinateXY* origin,
95  const CoordinateXY* p,
96  const CoordinateXY* e0, const CoordinateXY* e1);
97 
107  static bool isAngleGreater(const CoordinateXY* origin, const CoordinateXY* p, const CoordinateXY* q);
108 
109  static int quadrant(const CoordinateXY* origin, const CoordinateXY* p);
110 
111 
112 };
113 
114 
115 } // namespace geos::algorithm
116 } // namespace geos
117 
Definition: PolygonNodeTopology.h:41
static bool isInteriorSegment(const CoordinateXY *nodePt, const CoordinateXY *a0, const CoordinateXY *a1, const CoordinateXY *b)
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25