HullTri.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2021 Paul Ramsey <pramsey@cleverelephant.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/geom/Triangle.h>
#include <geos/triangulate/tri/Tri.h>
#include <geos/triangulate/tri/TriList.h>
#include <geos/triangulate/quadedge/TriangleVisitor.h>
#include <queue>
#include <deque>
namespace geos {
namespace geom {
class Coordinate;
}
namespace triangulate {
namespace quadedge {
}
}
}
namespace geos {
namespace algorithm { // geos::algorithm
namespace hull { // geos::algorithm::hull
class HullTri : public geos::triangulate::tri::Tri {
using Coordinate = geos::geom::Coordinate;
using Triangle = geos::geom::Triangle;
using Tri = geos::triangulate::tri::Tri;
template<typename TriType>
using TriList = geos::triangulate::tri::TriList<TriType>;
private:
double m_size;
bool m_isMarked = false;
bool isBoundaryTouch(TriIndex index) const;
public:
HullTri(const Coordinate& c0, const Coordinate& c1, const Coordinate& c2)
: Tri(c0, c1, c2)
, m_size(Triangle::longestSideLength(c0, c1, c2))
{};
class HullTriCompare {
public:
HullTriCompare() {};
bool operator()(const HullTri* a, const HullTri* b)
{
if (a->getSize() == b->getSize())
return a->getArea() < b->getArea();
else
return a->getSize() < b->getSize();
}
};
double getSize() const;
void setSizeToBoundary();
void setSizeToLongestEdge();
void setSizeToCircumradius();
bool isMarked() const;
void setMarked(bool marked);
bool isRemoved();
TriIndex boundaryIndex() const;
TriIndex boundaryIndexCCW() const;
TriIndex boundaryIndexCW() const;
bool isConnecting() const;
int adjacent2VertexIndex() const;
TriIndex isolatedVertexIndex(TriList<HullTri>& triList) const;
double lengthOfLongestEdge() const;
bool hasBoundaryTouch() const;
static HullTri* findTri(TriList<HullTri>& triList, Tri* exceptTri);
static bool isAllMarked(TriList<HullTri>& triList);
static void clearMarks(TriList<HullTri>& triList);
static void markConnected(HullTri* triStart, HullTri* exceptTri);
static bool isConnected(TriList<HullTri>& triList, HullTri* exceptTri);
friend std::ostream& operator<<(std::ostream& os, const HullTri& ht);
double lengthOfBoundary() const;
void remove(TriList<HullTri>& triList);
}; // HullTri
} // geos::algorithm::hull
} // geos::algorithm
} // geos
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::triangulate::tri::Tri::remove
void remove()
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::geom
Definition Angle.h:26
geos::triangulate::quadedge
Classes to implement a topological subdivision of quadeges, to support creating triangulations and Vo...
Definition ConcaveHull.h:33
geos::triangulate
Classes to compute Delaunay triangulations.
Definition ConcaveHull.h:32
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38