LArSoft
v07_13_02
Liquid Argon Software toolkit - http://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... | |
virtual | ~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 &, double &) const |
bool | computeCircleCenter3 (const dcel2d::Coords &, const dcel2d::Coords &, const dcel2d::Coords &, dcel2d::Coords &, double &, 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 53 of file Voronoi.cxx.
References Area(), fCircleEventList, fCircleNodeList, fConvexHullList, fFaceList, fHalfEdgeList, fPointList, fSiteEventList, fVertexList, and fVoronoiDiagramArea.
|
virtual |
|
private |
Computes the area of the enclosed convext hull.
Definition at line 106 of file Voronoi.cxx.
References crossProduct(), and fPointList.
Referenced by VoronoiDiagram().
|
private |
Definition at line 323 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 267 of file Voronoi.cxx.
References boostTranslation(), fCircleEventList, fCircleNodeList, fFaceList, fHalfEdgeList, fNumBadCircles, fPointList, fSiteEventList, and fVertexList.
|
private |
Definition at line 692 of file Voronoi.cxx.
References e, fNumBadCircles, max, x2, and y2.
Referenced by makeCircleEvent().
|
private |
Definition at line 764 of file Voronoi.cxx.
|
private |
Definition at line 795 of file Voronoi.cxx.
|
private |
Compute the area of the faces.
Definition at line 1217 of file Voronoi.cxx.
References crossProduct(), e, fFaceList, dcel2d::Vertex::getCoords(), dcel2d::HalfEdge::getNextHalfEdge(), dcel2d::HalfEdge::getTargetVertex(), dcel2d::HalfEdge::getTwinHalfEdge(), art::left(), max, min, and art::right().
Referenced by terminateInfiniteEdges().
|
private |
Gets the cross product of line from p0 to p1 and p0 to p2.
Definition at line 93 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 1348 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 1426 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 1365 of file Voronoi.cxx.
References fPointList, isLeft(), and max.
Referenced by findNearestDistance(), and getConvexHull().
|
inline |
recover the point list representing the convex hull
Definition at line 78 of file Voronoi.h.
References fConvexHullList, findNearestDistance(), findNearestEdge(), and getExtremePoints().
Referenced by terminateInfiniteEdges().
|
private |
this function recovers the convex hull
Definition at line 965 of file Voronoi.cxx.
References 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 1042 of file Voronoi.cxx.
References fConvexHullList.
Referenced by getConvexHull().
|
inline |
|
inline |
|
inline |
recover the area of the convex hull
Definition at line 73 of file Voronoi.h.
References fVoronoiDiagramArea.
|
private |
There are two types of events in the queue, here we handle circle events.
Definition at line 474 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 417 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 1104 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 84 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 1133 of file Voronoi.cxx.
References fConvexHullList, dcel2d::Vertex::getCoords(), isLeft(), and max.
|
private |
There are two types of events in the queue, here we handle circle events.
Definition at line 655 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 559 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 608 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 1189 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 831 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 193 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), buildVoronoiDiagramBoost(), makeCircleEvent(), and VoronoiDiagram().
|
private |
Definition at line 194 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), buildVoronoiDiagramBoost(), makeLeftCircleEvent(), makeRightCircleEvent(), and VoronoiDiagram().
|
private |
Definition at line 197 of file Voronoi.h.
Referenced by getConvexHull().
|
private |
Definition at line 196 of file Voronoi.h.
Referenced by getConvexHull(), getExtremePoints(), isInsideConvexHull(), isOutsideConvexHull(), terminateInfiniteEdges(), and VoronoiDiagram().
|
private |
Definition at line 189 of file Voronoi.h.
Referenced by boostTranslation(), buildVoronoiDiagram(), buildVoronoiDiagramBoost(), ComputeFaceArea(), getFaceList(), handleSiteEvents(), and VoronoiDiagram().
|
private |
Definition at line 187 of file Voronoi.h.
Referenced by boostTranslation(), buildVoronoiDiagram(), buildVoronoiDiagramBoost(), handleCircleEvents(), handleSiteEvents(), mergeDegenerateVertices(), and VoronoiDiagram().
|
mutableprivate |
Definition at line 203 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), buildVoronoiDiagramBoost(), and computeCircleCenter().
|
private |
Definition at line 191 of file Voronoi.h.
Referenced by Area(), buildVoronoiDiagram(), buildVoronoiDiagramBoost(), findNearestEdge(), and VoronoiDiagram().
|
private |
Definition at line 192 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), buildVoronoiDiagramBoost(), and VoronoiDiagram().
|
private |
Definition at line 206 of file Voronoi.h.
Referenced by terminateInfiniteEdges().
|
private |
Definition at line 188 of file Voronoi.h.
Referenced by boostTranslation(), buildVoronoiDiagram(), buildVoronoiDiagramBoost(), getVertexList(), handleCircleEvents(), terminateInfiniteEdges(), and VoronoiDiagram().
|
private |
Definition at line 204 of file Voronoi.h.
Referenced by getVoronoiDiagramArea(), and VoronoiDiagram().
|
private |
Definition at line 200 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), and findBoundingBox().
|
private |
Definition at line 199 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), and findBoundingBox().
|
private |
Definition at line 202 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), and findBoundingBox().
|
private |
Definition at line 201 of file Voronoi.h.
Referenced by buildVoronoiDiagram(), and findBoundingBox().