PolygonNodeTopology.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://libgeos.org
*
* Copyright (c) 2021 Martin Davis
* Copyright (C) 2022 Paul Ramsey <pramsey@cleverlephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#pragma once
#include <geos/export.h>
// Forward declarations
namespace geos {
namespace geom {
class CoordinateXY;
}
}
namespace geos {
namespace algorithm { // geos::algorithm
class GEOS_DLL PolygonNodeTopology {
using CoordinateXY = geos::geom::CoordinateXY;
public:
/*
* Check if the segments at a node between two rings (or one ring) cross.
* The node is topologically valid if the rings do not cross.
* This function assumes that the segments are not collinear.
*
* @param nodePt the node location
* @param a0 the previous segment endpoint in a ring
* @param a1 the next segment endpoint in a ring
* @param b0 the previous segment endpoint in the other ring
* @param b1 the next segment endpoint in the other ring
* @return true if the rings cross at the node
*/
static bool
isCrossing(const CoordinateXY* nodePt,
const CoordinateXY* a0, const CoordinateXY* a1,
const CoordinateXY* b0, const CoordinateXY* b1);
static bool isInteriorSegment(const CoordinateXY* nodePt,
const CoordinateXY* a0, const CoordinateXY* a1, const CoordinateXY* b);
static int compareAngle(
const CoordinateXY* origin,
const CoordinateXY* p,
const CoordinateXY* q);
private:
static bool isBetween(const CoordinateXY* origin,
const CoordinateXY* p,
const CoordinateXY* e0, const CoordinateXY* e1);
static int compareBetween(const CoordinateXY* origin, const CoordinateXY* p,
const CoordinateXY* e0, const CoordinateXY* e1);
static bool isAngleGreater(const CoordinateXY* origin, const CoordinateXY* p, const CoordinateXY* q);
static int quadrant(const CoordinateXY* origin, const CoordinateXY* p);
};
} // namespace geos::algorithm
} // namespace geos
geos::algorithm::PolygonNodeTopology
Definition PolygonNodeTopology.h:38
geos::algorithm::PolygonNodeTopology::compareAngle
static int compareAngle(const CoordinateXY *origin, const CoordinateXY *p, const CoordinateXY *q)
geos::algorithm::PolygonNodeTopology::isInteriorSegment
static bool isInteriorSegment(const CoordinateXY *nodePt, const CoordinateXY *a0, const CoordinateXY *a1, const CoordinateXY *b)
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::geom
Definition Angle.h:26
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38