GEOS 3.13.1
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
22namespace geos {
23namespace geom {
24class CoordinateXY;
25}
26}
27
28using geos::geom::CoordinateXY;
29
30
31namespace geos {
32namespace algorithm { // geos::algorithm
33
41class GEOS_DLL PolygonNodeTopology {
42
43public:
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
89 static int compareAngle(
90 const CoordinateXY* origin,
91 const CoordinateXY* p,
92 const CoordinateXY* q);
93
94
95private:
96
109 static bool isBetween(const CoordinateXY* origin,
110 const CoordinateXY* p,
111 const CoordinateXY* e0, const CoordinateXY* e1);
112
126 static int compareBetween(const CoordinateXY* origin, const CoordinateXY* p,
127 const CoordinateXY* e0, const CoordinateXY* e1);
128
129
139 static bool isAngleGreater(const CoordinateXY* origin, const CoordinateXY* p, const CoordinateXY* q);
140
141 static int quadrant(const CoordinateXY* origin, const CoordinateXY* p);
142
143
144};
145
146
147} // namespace geos::algorithm
148} // namespace geos
149
Definition PolygonNodeTopology.h:41
static int compareAngle(const CoordinateXY *origin, const CoordinateXY *p, const CoordinateXY *q)
static bool isInteriorSegment(const CoordinateXY *nodePt, const CoordinateXY *a0, const CoordinateXY *a1, const CoordinateXY *b)
Basic namespace for all GEOS functionalities.
Definition geos.h:39