GEOS 3.11.2
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 Coordinate;
25}
26}
27
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 Coordinate* nodePt,
59 const Coordinate* a0, const Coordinate* a1,
60 const Coordinate* b0, const Coordinate* b1);
61
62
76 static bool isInteriorSegment(const Coordinate* nodePt,
77 const Coordinate* a0, const Coordinate* a1, const Coordinate* b);
78
79
80private:
81
94 static bool isBetween(const Coordinate* origin,
95 const Coordinate* p,
96 const Coordinate* e0, const Coordinate* e1);
97
107 static bool isAngleGreater(const Coordinate* origin, const Coordinate* p, const Coordinate* q);
108
109 static int quadrant(const Coordinate* origin, const Coordinate* p);
110
111
112};
113
114
115} // namespace geos::algorithm
116} // namespace geos
117
Definition: PolygonNodeTopology.h:41
static bool isInteriorSegment(const Coordinate *nodePt, const Coordinate *a0, const Coordinate *a1, const Coordinate *b)
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Basic namespace for all GEOS functionalities.
Definition: geos.h:39