LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
VoronoiDiagram class definiton. More...
#include "Voronoi.h"
Public Types | |
using | PointPair = std::pair< dcel2d::Point, dcel2d::Point > |
using | MinMaxPointPair = std::pair< PointPair, PointPair > |
Public Member Functions | |
VoronoiDiagram (dcel2d::HalfEdgeList &, dcel2d::VertexList &, dcel2d::FaceList &) | |
Constructor. More... | |
~VoronoiDiagram () | |
Destructor. More... | |
void | buildVoronoiDiagram (const dcel2d::PointList &) |
Given an input set of 2D points construct a 2D voronoi diagram. More... | |
void | buildVoronoiDiagramBoost (const dcel2d::PointList &) |
const dcel2d::FaceList & | getFaceList () const |
Recover the list of faces. More... | |
const dcel2d::VertexList & | getVertexList () const |
Recover the list of vertices. More... | |
double | getVoronoiDiagramArea () const |
recover the area of the convex hull More... | |
const dcel2d::PointList & | getConvexHull () const |
recover the point list representing the convex hull More... | |
PointPair | getExtremePoints () const |
Given an input Point, find the nearest edge. More... | |
PointPair | findNearestEdge (const dcel2d::Point &, double &) const |
Given an input Point, find the nearest edge. More... | |
double | findNearestDistance (const dcel2d::Point &) const |
Given an input point, find the distance to the nearest edge/point. More... | |
Private Types | |
using | EventQueue = std::priority_queue< IEvent *, std::vector< IEvent * >, bool(*)(const IEvent *, const IEvent *)> |
using | BoostEdgeToEdgeMap = std::map< const boost::polygon::voronoi_edge< double > *, dcel2d::HalfEdge * > |
Translate boost to dcel. More... | |
using | BoostVertexToVertexMap = std::map< const boost::polygon::voronoi_vertex< double > *, dcel2d::Vertex * > |
using | BoostCellToFaceMap = std::map< const boost::polygon::voronoi_cell< double > *, dcel2d::Face * > |
Private Member Functions | |
void | handleSiteEvents (BeachLine &, EventQueue &, IEvent *) |
There are two types of events in the queue, here we handle site events. More... | |
void | handleCircleEvents (BeachLine &, EventQueue &, IEvent *) |
There are two types of events in the queue, here we handle circle events. More... | |
void | makeLeftCircleEvent (EventQueue &, BSTNode *, double) |
void | makeRightCircleEvent (EventQueue &, BSTNode *, double) |
IEvent * | makeCircleEvent (BSTNode *, BSTNode *, BSTNode *, double) |
There are two types of events in the queue, here we handle circle events. More... | |
bool | computeCircleCenter (const dcel2d::Coords &, const dcel2d::Coords &, const dcel2d::Coords &, dcel2d::Coords &, double &, double &) const |
bool | computeCircleCenter2 (const dcel2d::Coords &, const dcel2d::Coords &, const dcel2d::Coords &, dcel2d::Coords &, double &) const |
bool | computeCircleCenter3 (const dcel2d::Coords &, const dcel2d::Coords &, const dcel2d::Coords &, dcel2d::Coords &, double &) const |
void | getConvexHull (const BSTNode *) |
this function recovers the convex hull More... | |
void | terminateInfiniteEdges (BeachLine &, double) |
this aims to process remaining elements in the beachline after the event queue has been depleted More... | |
bool | isInsideConvexHull (const dcel2d::Vertex &) const |
Is a vertex inside the convex hull - meant to be a fast check. More... | |
bool | isOutsideConvexHull (const dcel2d::Vertex &, dcel2d::PointList::const_iterator, dcel2d::Coords &, double &) const |
is vertex outside the convex hull and if so return some useful information More... | |
void | findBoundingBox (const dcel2d::VertexList &) |
Find the min/max values in x-y to use as a bounding box. More... | |
void | boostTranslation (const dcel2d::PointList &, const boost::polygon::voronoi_edge< double > *, const boost::polygon::voronoi_edge< double > *, BoostEdgeToEdgeMap &, BoostVertexToVertexMap &, BoostCellToFaceMap &) |
void | mergeDegenerateVertices () |
merge degenerate vertices (found by zero length edges) More... | |
double | ComputeFaceArea () |
Compute the area of the faces. More... | |
double | crossProduct (const dcel2d::Point &p0, const dcel2d::Point &p1, const dcel2d::Point &p2) const |
Gets the cross product of line from p0 to p1 and p0 to p2. More... | |
double | Area () const |
Computes the area of the enclosed convext hull. More... | |
bool | isLeft (const dcel2d::Point &p0, const dcel2d::Point &p1, const dcel2d::Point &pCheck) const |
Determines whether a point is to the left, right or on line specifiec by p0 and p1. More... | |
Private Attributes | |
dcel2d::HalfEdgeList & | fHalfEdgeList |
dcel2d::VertexList & | fVertexList |
dcel2d::FaceList & | fFaceList |
dcel2d::PointList | fPointList |
SiteEventList | fSiteEventList |
CircleEventList | fCircleEventList |
BSTNodeList | fCircleNodeList |
dcel2d::PointList | fConvexHullList |
dcel2d::Coords | fConvexHullCenter |
double | fXMin |
double | fXMax |
double | fYMin |
double | fYMax |
int | fNumBadCircles |
double | fVoronoiDiagramArea |
EventUtilities | fUtilities |
VoronoiDiagram class definiton.
|
private |
|
private |
|
private |
|
private |
using voronoi2d::VoronoiDiagram::MinMaxPointPair = std::pair<PointPair, PointPair> |
using voronoi2d::VoronoiDiagram::PointPair = std::pair<dcel2d::Point, dcel2d::Point> |
voronoi2d::VoronoiDiagram::VoronoiDiagram | ( | dcel2d::HalfEdgeList & | halfEdgeList, |
dcel2d::VertexList & | vertexList, | ||
dcel2d::FaceList & | faceList | ||
) |
Constructor.
pset |
Definition at line 47 of file Voronoi.cxx.
References Area(), fCircleEventList, fCircleNodeList, fConvexHullList, fFaceList, fHalfEdgeList, fPointList, fSiteEventList, fVertexList, and fVoronoiDiagramArea.
voronoi2d::VoronoiDiagram::~VoronoiDiagram | ( | ) |
|
private |
Computes the area of the enclosed convext hull.
Definition at line 104 of file Voronoi.cxx.
References crossProduct(), and fPointList.
Referenced by VoronoiDiagram().
|
private |
Definition at line 355 of file Voronoi.cxx.
References fFaceList, fHalfEdgeList, fVertexList, dcel2d::HalfEdge::setFace(), dcel2d::HalfEdge::setLastHalfEdge(), dcel2d::HalfEdge::setNextHalfEdge(), dcel2d::HalfEdge::setTargetVertex(), and dcel2d::HalfEdge::setTwinHalfEdge().
Referenced by buildVoronoiDiagramBoost().
void voronoi2d::VoronoiDiagram::buildVoronoiDiagram | ( | const dcel2d::PointList & | pointList | ) |
Given an input set of 2D points construct a 2D voronoi diagram.
PointList | The input list of 2D points |
Definition at line 135 of file Voronoi.cxx.
References voronoi2d::compareSiteEventPtrs(), voronoi2d::BeachLine::countLeaves(), fCircleEventList, fCircleNodeList, fFaceList, fHalfEdgeList, findBoundingBox(), fNumBadCircles, fPointList, fSiteEventList, fVertexList, fXMax, fXMin, fYMax, fYMin, dcel2d::HalfEdge::getFace(), dcel2d::HalfEdge::getLastHalfEdge(), dcel2d::HalfEdge::getNextHalfEdge(), handleCircleEvents(), handleSiteEvents(), terminateInfiniteEdges(), and voronoi2d::BeachLine::traverseBeach().
Referenced by lar_cluster3d::ClusterPathFinder::buildVoronoiDiagram(), and lar_cluster3d::VoronoiPathFinder::buildVoronoiDiagram().
void voronoi2d::VoronoiDiagram::buildVoronoiDiagramBoost | ( | const dcel2d::PointList & | pointList | ) |
Definition at line 282 of file Voronoi.cxx.
References boostTranslation(), fCircleEventList, fCircleNodeList, fFaceList, fHalfEdgeList, fNumBadCircles, fPointList, fSiteEventList, and fVertexList.
|
private |
Definition at line 714 of file Voronoi.cxx.
References e, fNumBadCircles, x2, x3, y2, and y3.
Referenced by makeCircleEvent().
|
private |
Definition at line 785 of file Voronoi.cxx.
References util::abs().
|
private |
Definition at line 818 of file Voronoi.cxx.
References util::abs().
|
private |
Compute the area of the faces.
Definition at line 1270 of file Voronoi.cxx.
References crossProduct(), e, fFaceList, dcel2d::Vertex::getCoords(), dcel2d::HalfEdge::getNextHalfEdge(), dcel2d::HalfEdge::getTargetVertex(), dcel2d::HalfEdge::getTwinHalfEdge(), art::left(), art::right(), and sum.
Referenced by terminateInfiniteEdges().
|
private |
Gets the cross product of line from p0 to p1 and p0 to p2.
Definition at line 89 of file Voronoi.cxx.
Referenced by Area(), ComputeFaceArea(), and isLeft().
|
private |
Find the min/max values in x-y to use as a bounding box.
Definition at line 1408 of file Voronoi.cxx.
References fXMax, fXMin, fYMax, fYMin, art::left(), and art::right().
Referenced by buildVoronoiDiagram().
double voronoi2d::VoronoiDiagram::findNearestDistance | ( | const dcel2d::Point & | point | ) | const |
Given an input point, find the distance to the nearest edge/point.
Definition at line 1494 of file Voronoi.cxx.
References findNearestEdge().
Referenced by getConvexHull().
VoronoiDiagram::PointPair voronoi2d::VoronoiDiagram::findNearestEdge | ( | const dcel2d::Point & | point, |
double & | closestDistance | ||
) | const |
Given an input Point, find the nearest edge.
Definition at line 1433 of file Voronoi.cxx.
References fPointList, and isLeft().
Referenced by findNearestDistance(), and getConvexHull().
|
inline |
recover the point list representing the convex hull
Definition at line 74 of file Voronoi.h.
References fConvexHullList, findNearestDistance(), findNearestEdge(), and getExtremePoints().
Referenced by terminateInfiniteEdges().
|
private |
this function recovers the convex hull
Definition at line 1009 of file Voronoi.cxx.
References util::abs(), fConvexHullCenter, fConvexHullList, lar_cluster3d::ConvexHull::getConvexHull(), voronoi2d::IEvent::getCoords(), voronoi2d::BSTNode::getEvent(), voronoi2d::BSTNode::getFace(), voronoi2d::BSTNode::getLeftChild(), voronoi2d::IEvent::getPoint(), voronoi2d::BSTNode::getPredecessor(), voronoi2d::BSTNode::getRightChild(), art::left(), art::right(), and dcel2d::Face::setOnConvexHull().
VoronoiDiagram::PointPair voronoi2d::VoronoiDiagram::getExtremePoints | ( | ) | const |
Given an input Point, find the nearest edge.
Definition at line 1097 of file Voronoi.cxx.
References fConvexHullList.
Referenced by getConvexHull().
|
inline |
|
inline |
|
inline |
recover the area of the convex hull
Definition at line 69 of file Voronoi.h.
References fVoronoiDiagramArea.
|
private |
There are two types of events in the queue, here we handle circle events.
Definition at line 503 of file Voronoi.cxx.
References voronoi2d::IEvent::circleCenter(), fHalfEdgeList, fVertexList, voronoi2d::BSTNode::getAssociated(), voronoi2d::IEvent::getBSTNode(), voronoi2d::BSTNode::getFace(), dcel2d::HalfEdge::getFace(), voronoi2d::BSTNode::getHalfEdge(), voronoi2d::BSTNode::getPredecessor(), voronoi2d::BSTNode::getSuccessor(), dcel2d::HalfEdge::getTwinHalfEdge(), makeLeftCircleEvent(), makeRightCircleEvent(), voronoi2d::BeachLine::removeLeaf(), dcel2d::HalfEdge::setFace(), dcel2d::Vertex::setHalfEdge(), voronoi2d::BSTNode::setHalfEdge(), dcel2d::HalfEdge::setLastHalfEdge(), dcel2d::HalfEdge::setNextHalfEdge(), dcel2d::HalfEdge::setTargetVertex(), dcel2d::HalfEdge::setTwinHalfEdge(), and voronoi2d::IEvent::xPos().
Referenced by buildVoronoiDiagram().
|
private |
There are two types of events in the queue, here we handle site events.
Definition at line 445 of file Voronoi.cxx.
References fFaceList, fHalfEdgeList, voronoi2d::IEvent::getCoords(), voronoi2d::BSTNode::getFace(), dcel2d::Face::getHalfEdge(), voronoi2d::IEvent::getPoint(), voronoi2d::BSTNode::getPredecessor(), voronoi2d::BSTNode::getSuccessor(), voronoi2d::BeachLine::insertNewLeaf(), makeLeftCircleEvent(), makeRightCircleEvent(), voronoi2d::BSTNode::setFace(), dcel2d::HalfEdge::setFace(), voronoi2d::BSTNode::setHalfEdge(), dcel2d::Face::setHalfEdge(), dcel2d::HalfEdge::setTwinHalfEdge(), and voronoi2d::IEvent::xPos().
Referenced by buildVoronoiDiagram().
|
private |
Is a vertex inside the convex hull - meant to be a fast check.
Definition at line 1158 of file Voronoi.cxx.
References fConvexHullList, dcel2d::Vertex::getCoords(), and isLeft().
Referenced by terminateInfiniteEdges().
|
private |
Determines whether a point is to the left, right or on line specifiec by p0 and p1.
Definition at line 78 of file Voronoi.cxx.
References crossProduct().
Referenced by findNearestEdge(), isInsideConvexHull(), and isOutsideConvexHull().
|
private |
is vertex outside the convex hull and if so return some useful information
Definition at line 1185 of file Voronoi.cxx.
References fConvexHullList, dcel2d::Vertex::getCoords(), and isLeft().
|
private |
There are two types of events in the queue, here we handle circle events.
Definition at line 673 of file Voronoi.cxx.
References computeCircleCenter(), e, fCircleEventList, voronoi2d::IEvent::getCoords(), voronoi2d::BSTNode::getEvent(), and radius.
Referenced by makeLeftCircleEvent(), and makeRightCircleEvent().
|
private |
Definition at line 591 of file Voronoi.cxx.
References fCircleNodeList, voronoi2d::BSTNode::getAssociated(), voronoi2d::BSTNode::getEvent(), voronoi2d::IEvent::getPoint(), voronoi2d::BSTNode::getPredecessor(), makeCircleEvent(), voronoi2d::BSTNode::setAssociated(), and voronoi2d::IEvent::setInvalid().
Referenced by handleCircleEvents(), and handleSiteEvents().
|
private |
Definition at line 633 of file Voronoi.cxx.
References fCircleNodeList, voronoi2d::BSTNode::getAssociated(), voronoi2d::BSTNode::getEvent(), voronoi2d::IEvent::getPoint(), voronoi2d::BSTNode::getSuccessor(), makeCircleEvent(), voronoi2d::BSTNode::setAssociated(), and voronoi2d::IEvent::setInvalid().
Referenced by handleCircleEvents(), and handleSiteEvents().
|
private |
merge degenerate vertices (found by zero length edges)
Definition at line 1240 of file Voronoi.cxx.
References fHalfEdgeList, dcel2d::Vertex::getCoords(), dcel2d::HalfEdge::getTargetVertex(), and dcel2d::HalfEdge::getTwinHalfEdge().
Referenced by terminateInfiniteEdges().
|
private |
this aims to process remaining elements in the beachline after the event queue has been depleted
Definition at line 854 of file Voronoi.cxx.
References voronoi2d::EventUtilities::computeArcVal(), voronoi2d::EventUtilities::computeBreak(), ComputeFaceArea(), fConvexHullList, fUtilities, fVertexList, voronoi2d::BSTNode::getAssociated(), getConvexHull(), voronoi2d::IEvent::getCoords(), dcel2d::Vertex::getCoords(), voronoi2d::BSTNode::getEvent(), voronoi2d::BSTNode::getFace(), dcel2d::HalfEdge::getFace(), voronoi2d::BSTNode::getHalfEdge(), dcel2d::HalfEdge::getLastHalfEdge(), voronoi2d::BSTNode::getLeftChild(), dcel2d::HalfEdge::getNextHalfEdge(), voronoi2d::BSTNode::getPredecessor(), voronoi2d::BSTNode::getRightChild(), voronoi2d::BSTNode::getSuccessor(), dcel2d::HalfEdge::getTargetVertex(), voronoi2d::BeachLine::getTopNode(), dcel2d::HalfEdge::getTwinHalfEdge(), voronoi2d::IEvent::isCircle(), isInsideConvexHull(), voronoi2d::IEvent::isValid(), mergeDegenerateVertices(), dcel2d::HalfEdge::setTargetVertex(), voronoi2d::IEvent::xPos(), and voronoi2d::IEvent::yPos().
Referenced by buildVoronoiDiagram().
|
private |
Definition at line 211 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), buildVoronoiDiagramBoost(), makeCircleEvent(), and VoronoiDiagram().
|
private |
Definition at line 212 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), buildVoronoiDiagramBoost(), makeLeftCircleEvent(), makeRightCircleEvent(), and VoronoiDiagram().
|
private |
Definition at line 215 of file Voronoi.h.
Referenced by getConvexHull().
|
private |
Definition at line 214 of file Voronoi.h.
Referenced by getConvexHull(), getExtremePoints(), isInsideConvexHull(), isOutsideConvexHull(), terminateInfiniteEdges(), and VoronoiDiagram().
|
private |
Definition at line 207 of file Voronoi.h.
Referenced by boostTranslation(), buildVoronoiDiagram(), buildVoronoiDiagramBoost(), ComputeFaceArea(), getFaceList(), handleSiteEvents(), and VoronoiDiagram().
|
private |
Definition at line 205 of file Voronoi.h.
Referenced by boostTranslation(), buildVoronoiDiagram(), buildVoronoiDiagramBoost(), handleCircleEvents(), handleSiteEvents(), mergeDegenerateVertices(), and VoronoiDiagram().
|
mutableprivate |
Definition at line 221 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), buildVoronoiDiagramBoost(), and computeCircleCenter().
|
private |
Definition at line 209 of file Voronoi.h.
Referenced by Area(), buildVoronoiDiagram(), buildVoronoiDiagramBoost(), findNearestEdge(), and VoronoiDiagram().
|
private |
Definition at line 210 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), buildVoronoiDiagramBoost(), and VoronoiDiagram().
|
private |
Definition at line 224 of file Voronoi.h.
Referenced by terminateInfiniteEdges().
|
private |
Definition at line 206 of file Voronoi.h.
Referenced by boostTranslation(), buildVoronoiDiagram(), buildVoronoiDiagramBoost(), getVertexList(), handleCircleEvents(), terminateInfiniteEdges(), and VoronoiDiagram().
|
private |
Definition at line 222 of file Voronoi.h.
Referenced by getVoronoiDiagramArea(), and VoronoiDiagram().
|
private |
Definition at line 218 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), and findBoundingBox().
|
private |
Definition at line 217 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), and findBoundingBox().
|
private |
Definition at line 220 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), and findBoundingBox().
|
private |
Definition at line 219 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), and findBoundingBox().