/********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.osgeo.org * * Copyright (C) 2021 Paul Ramsey * * 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 #include #include #include namespace geos { namespace geom { class Geometry; class GeometryFactory; class Coordinate; } namespace triangulate { namespace quadedge { class QuadEdge; class QuadEdgeSubdivision; } } } using geos::geom::Geometry; using geos::geom::GeometryFactory; using geos::geom::Coordinate; using geos::triangulate::tri::Tri; using geos::triangulate::tri::TriList; using geos::triangulate::quadedge::QuadEdge; using geos::triangulate::quadedge::QuadEdgeSubdivision; using geos::triangulate::quadedge::TriangleVisitor; namespace geos { namespace algorithm { // geos::algorithm namespace hull { // geos::algorithm::hull class HullTriangulation { private: static void toTris( QuadEdgeSubdivision& subdiv, TriList& triList); /** * Extracts the coordinates of the edges along the boundary of a triangulation, * by tracing CW around the border triangles. * Assumption: there are at least 2 tris, they are connected, * and there are no holes. * So each tri has at least one non-boundary edge, and there is only one boundary. * * @param triList the triangulation * @return the points in the boundary of the triangulation */ static geom::CoordinateSequence traceBoundary( TriList& triList); static HullTri* findBorderTri( TriList& triList); public: HullTriangulation() {}; static void createDelaunayTriangulation( const Geometry* geom, TriList& triList); /** * Creates a Polygon representing the area of a triangulation * which is connected and contains no holes. * * @param triList the triangulation * @param geomFactory the geometry factory to use * @return the area polygon */ static std::unique_ptr traceBoundaryPolygon( TriList& triList, const GeometryFactory* factory); static HullTri* nextBorderTri(HullTri* triStart); /** * Creates a polygonal geometry representing the area of a triangulation * which may be disconnected or contain holes. * * @param triList the triangulation * @param geomFactory the geometry factory to use * @return the area polygonal geometry */ static std::unique_ptr geomunion( TriList& triList, const GeometryFactory* factory); class HullTriVisitor : public TriangleVisitor { private: TriList& triList; public: HullTriVisitor(TriList& p_triList) : triList(p_triList) {}; void visit(std::array& triEdges); }; // HullTriVisitor }; // HullTriangulation } // geos::algorithm::hull } // geos::algorithm } // geos