21 #include <boost/range/adaptor/reversed.hpp> 22 #include <boost/polygon/voronoi.hpp> 32 typedef point_concept
type;
40 static inline coordinate_type
get(
const dcel2d::Point& point, orientation_2d orient)
42 return (orient == HORIZONTAL) ? std::get<1>(point) : std::get<0>(point);
54 fHalfEdgeList(halfEdgeList),
55 fVertexList(vertexList),
61 fVoronoiDiagramArea(0.)
96 double deltaX = std::get<0>(p1) - std::get<0>(p0);
97 double deltaY = std::get<1>(p1) - std::get<1>(p0);
98 double dCheckX = std::get<0>(p2) - std::get<0>(p0);
99 double dCheckY = std::get<1>(p2) - std::get<1>(p0);
101 return ((deltaX * dCheckY) - (deltaY * dCheckX));
121 if (point != lastPoint) area += 0.5 *
crossProduct(center,lastPoint,point);
147 std::cout <<
"******************************************************************************************************************" << std::endl;
148 std::cout <<
"******************************************************************************************************************" << std::endl;
149 std::cout <<
"******************************************************************************************************************" << std::endl;
150 std::cout <<
"==> # input points: " << pointList.size() << std::endl;
156 for(
const auto& point : pointList)
160 eventQueue.push(iEvent);
170 while(!eventQueue.empty())
172 IEvent*
event = eventQueue.top();
181 std::cout <<
"*******> # input points: " << pointList.size() <<
", remaining leaves: " << beachLine.
countLeaves() <<
", " << beachLine.
traverseBeach() <<
", # bad circles: " <<
fNumBadCircles << std::endl;
187 std::cout <<
" Range min/maxes, x: " <<
fXMin <<
", " <<
fXMax <<
", y: " <<
fYMin <<
", " <<
fYMax << std::endl;
195 std::map<int,int> edgeCountMap;
196 std::map<int,int> openCountMap;
207 if (halfEdge->getFace() != &face)
209 std::cout <<
" ===> halfEdge does not match face: " << halfEdge <<
", face: " << halfEdge->
getFace() <<
", base: " << &face << std::endl;
212 if (halfEdge == startEdge)
218 halfEdge = halfEdge->getNextHalfEdge();
226 if (halfEdge->getFace() != &face)
228 std::cout <<
" ===> halfEdge does not match face: " << halfEdge <<
", face: " << halfEdge->getFace() <<
", base: " << &face << std::endl;
231 if (halfEdge == startEdge)
237 halfEdge = halfEdge->getLastHalfEdge();
244 openCountMap[nEdges]++;
247 edgeCountMap[nEdges]++;
250 std::cout <<
"==> Found " << nOpenFaces <<
" open faces from total of " << fFaceList.size() << std::endl;
251 for(
const auto& edgeCount : edgeCountMap) std::cout <<
" -> all edges, # edges: " << edgeCount.first <<
", count: " << edgeCount.second << std::endl;
252 for(
const auto& edgeCount : openCountMap) std::cout <<
" -> open edges, # edges: " << edgeCount.first <<
", count: " << edgeCount.second << std::endl;
253 std::cout <<
"******************************************************************************************************************" << std::endl;
254 std::cout <<
"******************************************************************************************************************" << std::endl;
255 std::cout <<
"******************************************************************************************************************" << std::endl;
279 std::cout <<
"******************************************************************************************************************" << std::endl;
280 std::cout <<
"******************************************************************************************************************" << std::endl;
281 std::cout <<
"******************************************************************************************************************" << std::endl;
282 std::cout <<
"==> # input points: " << pointList.size() << std::endl;
285 boost::polygon::voronoi_diagram<double> vd;
286 boost::polygon::construct_voronoi(pointList.begin(),pointList.end(),&vd);
293 BoostEdgeToEdgeMap boostEdgeToEdgeMap;
298 for(
const auto& edge : vd.edges())
300 const boost::polygon::voronoi_edge<double>* twin = edge.twin();
302 boostTranslation(pointList, &edge, twin, boostEdgeToEdgeMap, boostVertexToVertexMap, boostCellToFaceMap);
303 boostTranslation(pointList, twin, &edge, boostEdgeToEdgeMap, boostVertexToVertexMap, boostCellToFaceMap);
310 std::cout <<
" " << vd.edges().size() <<
" edges, " << vd.cells().size() <<
" faces, " << vd.vertices().size() <<
" vertices" << std::endl;
311 std::cout <<
"******************************************************************************************************************" << std::endl;
312 std::cout <<
"******************************************************************************************************************" << std::endl;
313 std::cout <<
"******************************************************************************************************************" << std::endl;
324 const boost::polygon::voronoi_edge<double>* edge,
325 const boost::polygon::voronoi_edge<double>* twin,
333 if (boostEdgeToEdgeMap.find(edge) != boostEdgeToEdgeMap.end()) halfEdge = boostEdgeToEdgeMap.at(edge);
340 boostEdgeToEdgeMap[edge] = halfEdge;
343 if (boostEdgeToEdgeMap.find(twin) != boostEdgeToEdgeMap.end()) twinEdge = boostEdgeToEdgeMap.at(twin);
350 boostEdgeToEdgeMap[twin] = twinEdge;
354 const boost::polygon::voronoi_vertex<double>* boostVertex = edge->vertex1();
360 if (boostVertexToVertexMap.find(boostVertex) == boostVertexToVertexMap.end())
368 boostVertexToVertexMap[boostVertex] = vertex;
370 else vertex = boostVertexToVertexMap.at(boostVertex);
373 const boost::polygon::voronoi_cell<double>* boostCell = edge->cell();
376 if (boostCellToFaceMap.find(boostCell) == boostCellToFaceMap.end())
379 int pointIdx = boostCell->source_index();
381 std::advance(pointItr, pointIdx);
386 fFaceList.emplace_back(halfEdge,coords,std::get<2>(point));
390 boostCellToFaceMap[boostCell] = face;
398 if (boostEdgeToEdgeMap.find(edge->next()) != boostEdgeToEdgeMap.end())
406 if (boostEdgeToEdgeMap.find(edge->prev()) != boostEdgeToEdgeMap.end())
487 std::cout <<
">>>> Face mismatch in circle handling, left face: " << leftHalfEdge->
getFace() <<
", left twin: " << leftHalfEdge->
getTwinHalfEdge()->
getFace() <<
", right: " << rightHalfEdge->
getFace() <<
", right twin: " << rightHalfEdge->
getTwinHalfEdge()->
getFace() <<
", arc face: " << arcNode->
getFace() << std::endl;
599 eventQueue.push(circleEvent);
646 eventQueue.push(circleEvent);
673 double circleBottomX = center[0] -
radius;
676 if (beachLinePos >= circleBottomX - 10. * deltaR)
685 else if (circleBottomX - beachLinePos < 1.
e-4)
686 std::cout <<
"==> Circle close, beachLine: " << beachLinePos <<
", circleBottomX: " << circleBottomX <<
", deltaR: " << deltaR <<
", d: " << circleBottomX - beachLinePos << std::endl;
703 double xCoord = p1[0];
704 double yCoord = p1[1];
706 double x2 = p2[0] - xCoord;
707 double y2 = p2[1] - yCoord;
708 double x3 = p3[0] - xCoord;
709 double y3 = p3[1] - yCoord;
711 double det = x2 * y3 - x3 *
y2;
719 if (det > -std::numeric_limits<double>::epsilon())
720 std::cout <<
" --->Circle failure, det: " << det <<
", mid x: " << p2[0] <<
", y: " << p2[1]
721 <<
", l x: " << p1[0] <<
", y: " << p1[1]
722 <<
", r x: " << p3[0] <<
", y: " << p3[1] << std::endl;
727 double p2sqr = x2 * x2 + y2 *
y2;
728 double p3sqr = x3 * x3 + y3 * y3;
730 double cxpr = 0.5 * (y3 * p2sqr - y2 * p3sqr) / det;
731 double cypr = 0.5 * (x2 * p3sqr - x3 * p2sqr) / det;
733 radius = std::sqrt(cxpr * cxpr + cypr * cypr);
734 center[0] = cxpr + xCoord;
735 center[1] = cypr + yCoord;
745 std::vector<float> radSqrVec;
747 radSqrVec.push_back(p1Rad.norm());
748 radSqrVec.push_back(p2Rad.norm());
749 radSqrVec.push_back(p3Rad.norm());
751 double maxRadius = *std::max_element(radSqrVec.begin(),radSqrVec.end());
753 delta =
std::max(5.
e-7, maxRadius - radius);
772 double slope12 = (p2[1] - p1[1]) / (p2[0] - p1[0]);
773 double slope32 = (p3[1] - p2[1]) / (p3[0] - p2[0]);
775 if (std::abs(slope12 - slope32) <= std::numeric_limits<double>::epsilon())
777 std::cout <<
" >>>> Matching slopes! points: (" << p1[0] <<
"," << p1[1] <<
"), ("<< p2[0] <<
"," << p2[1] <<
"), ("<< p3[0] <<
"," << p3[1] <<
")" << std::endl;
782 center[0] = (slope12 * slope32 * (p3[1] - p1[1]) + slope12 * (p2[0] + p3[0]) - slope32 * (p1[0] + p2[0])) / (2. * (slope12 - slope32));
783 center[1] = 0.5 * (p1[1] + p2[1]) - (center[0] - 0.5 * (p1[0] + p2[0])) / slope12;
785 radius = std::sqrt(std::pow((p2[0] - center[0]),2) + std::pow((p2[1] - center[1]),2));
789 std::cout <<
" ***> Rad2 = " << radius <<
", circ x,y: " << center[0] <<
"," << center[1] <<
", p1: " << p1[0] <<
"," << p1[1] <<
", p2: " << p2[0] <<
"," << p2[1] <<
", p3: " << p3[0] <<
", " << p3[1] << std::endl;
803 double temp = p2[0] * p2[0] + p2[1] * p2[1];
804 double p1p2 = (p1[0] * p1[0] + p1[1] * p1[1] - temp) / 2.0;
805 double p2p3 = (temp - p3[0] * p3[0] - p3[1] * p3[1]) / 2.0;
806 double det = (p1[0] - p2[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p2[1]);
808 if (std::abs(det) < 10. * std::numeric_limits<double>::epsilon())
810 std::cout <<
" >>>> Determinant zero! points: (" << p1[0] <<
"," << p1[1] <<
"), ("<< p2[0] <<
"," << p2[1] <<
"), ("<< p3[0] <<
"," << p3[1] <<
")" << std::endl;
817 center[0] = (p1p2 * (p2[1] - p3[1]) - p2p3 * (p1[1] - p2[1])) * det;
818 center[1] = (p2p3 * (p1[0] - p2[0]) - p1p2 * (p2[0] - p3[0])) * det;
821 radius = std::sqrt(std::pow((p1[0] - center[0]),2) + std::pow((p1[1] - center[1]),2));
825 std::cout <<
" ***> Rad3 = " << radius <<
", circ x,y: " << center[0] <<
"," << center[1] <<
", p1: " << p1[0] <<
"," << p1[1] <<
", p2: " << p2[0] <<
"," << p2[1] <<
", p3: " << p3[0] <<
", " << p3[1] << std::endl;
849 double lastBreakPoint = std::numeric_limits<double>::lowest();
855 std::cout <<
"--------------------------------------------------------------------------------------------" << std::endl;
874 std::cout <<
"node " << nodeCount <<
" has break: " << breakPoint <<
", beachPos: " << beachLinePos <<
" (last: " << lastBreakPoint <<
"), leftArcVal: " << leftArcVal <<
", rightArcVal: " << rightArcVal << std::endl;
875 if (lastBreakPoint > breakPoint) std::cout <<
" ***** lastBreakPoint larger than current break point *****" << std::endl;
877 std::cout <<
" halfEdge: " << halfEdge <<
", target vtx: " << vertex <<
", face: " << halfEdge->
getFace() <<
", twin: " << halfTwin <<
", twin tgt: " << halfTwin->
getTargetVertex() <<
", twin face: " << halfTwin->
getFace() <<
", next: " << halfEdge->
getNextHalfEdge() <<
", last: " << halfEdge->
getLastHalfEdge() << std::endl;
881 Eigen::Vector3f lrPosDiff = rightLeafPos - leftLeafPos;
882 Eigen::Vector3f lrPosSum = rightLeafPos + leftLeafPos;
884 lrPosDiff.normalize();
898 double arcLenToLine = breakToLeafPos.dot(breakDir);
901 dcel2d::Coords breakVertexPos = vertexPos + arcLenToLine * breakDir;
903 std::cout <<
" halfEdge position: " << breakPos[0] <<
"/" << breakPos[1] <<
", vertex: " << vertexPos[0] <<
"/" << vertexPos[1] <<
", end: " << breakVertexPos[0] <<
"/" << breakVertexPos[1] <<
", dir: " << breakDir[0] <<
"/" << breakDir[1] <<
", arclen: " << arcLenToLine << std::endl;
914 std::cout <<
"****** null vertex!!! Skipping to next node... *********" << std::endl;
917 if (lastBreakPoint > breakPoint) nBadBreaks++;
919 lastBreakPoint = breakPoint;
927 std::cout <<
" -> associated circle: " << iEvent->
isCircle() <<
", is valid: " << iEvent->
isValid() << std::endl;
958 std::cout <<
"Loop over beachline done, saved " <<
fConvexHullList.size() <<
" arcs, encountered " << nBadBreaks <<
" bad break points" << std::endl;
959 std::cout <<
"-- started with " << nVerticesInitial <<
" vertices, found " <<
fVertexList.size() <<
" inside convex hull" << std::endl;
983 Eigen::Vector3f prevVec(0.,0.,0.);
999 Eigen::Vector3f curVec = nextPoint - lastPoint;
1003 double dotProd = prevVec.dot(curVec);
1005 std::cout <<
"--> lastPoint: " << lastPoint[0] <<
"/" << lastPoint[1] <<
", tan: " << std::atan2(lastPoint[1],lastPoint[0]) <<
", curPoint: " << nextPoint[0] <<
"/" << nextPoint[1] <<
", tan: " << std::atan2(nextPoint[1],nextPoint[0]) <<
", dot: " << dotProd << std::endl;
1008 lastPoint = nextPoint;
1017 for(
const auto& edgePoint :
fConvexHullList) localList.emplace_back(std::get<0>(edgePoint),std::get<1>(edgePoint),std::get<2>(edgePoint));
1020 localList.sort([](
const auto&
left,
const auto&
right){
return (std::abs(std::get<0>(
left) - std::get<0>(
right)) > std::numeric_limits<float>::epsilon()) ? std::get<0>(
left) < std::get<0>(
right) : std::get<1>(
left) < std::get<1>(
right);});
1028 std::cout <<
"~~~>> there are " << convexHull.
getConvexHull().size() <<
" convex hull points and " << fConvexHullList.size() <<
" infinite cells" << std::endl;
1035 std::cout <<
"~~~ Convex hull Point: " << std::get<0>(hullPoint) <<
", " << std::get<1>(hullPoint) << std::endl;
1047 float maxSeparation(0.);
1056 Eigen::Vector2f firstEdge(std::get<0>(*firstPointItr) - std::get<0>(firstPoint), std::get<1>(*firstPointItr) - std::get<1>(firstPoint));
1059 firstEdge.normalize();
1066 Eigen::Vector2f nextEdge(std::get<0>(endPoint) - std::get<0>(nextPoint), std::get<1>(endPoint) - std::get<1>(nextPoint));
1069 nextEdge.normalize();
1072 if (firstEdge.dot(nextEdge) < 0.)
1074 Eigen::Vector2f separation(std::get<0>(nextPoint) - std::get<0>(firstPoint), std::get<1>(nextPoint) - std::get<1>(firstPoint));
1075 float separationDistance = separation.norm();
1077 if (separationDistance > maxSeparation)
1079 extremePoints.first = firstPoint;
1080 extremePoints.second = nextPoint;
1081 maxSeparation = separationDistance;
1089 nextPointItr = endPointItr;
1090 nextPoint = endPoint;
1098 if (firstPointItr == nextPointItr) nextPointItr++;
1101 return extremePoints;
1106 bool insideHull(
true);
1121 if (!
isLeft(firstPoint,secondPoint,vertexPos))
1127 firstPoint = secondPoint;
1136 double& distToConvexHull)
const 1138 bool outsideHull(
false);
1153 double xPrevToPoint = (std::get<0>(vertexPos) - std::get<0>(*firstPointItr));
1154 double yPrevToPoint = (std::get<1>(vertexPos) - std::get<1>(*firstPointItr));
1155 double xPrevToCur = (std::get<0>(*secondPointItr) - std::get<0>(*firstPointItr));
1156 double yPrevToCur = (std::get<1>(*secondPointItr) - std::get<1>(*firstPointItr));
1157 double edgeLength = std::sqrt(xPrevToCur * xPrevToCur + yPrevToCur * yPrevToCur);
1160 double projection = ((xPrevToPoint * xPrevToCur) + (yPrevToPoint * yPrevToCur)) / edgeLength;
1163 dcel2d::Point docaPoint(std::get<0>(*firstPointItr) + projection * xPrevToCur / edgeLength,
1164 std::get<1>(*firstPointItr) + projection * yPrevToCur / edgeLength, 0);
1166 if (projection > edgeLength) docaPoint = *secondPointItr;
1167 if (projection < 0) docaPoint = *firstPointItr;
1169 double xDocaDist = std::get<0>(vertexPos) - std::get<0>(docaPoint);
1170 double yDocaDist = std::get<1>(vertexPos) - std::get<1>(docaPoint);
1171 double docaDist = xDocaDist * xDocaDist + yDocaDist * yDocaDist;
1173 if (docaDist < distToConvexHull)
1175 firstHullPointItr = firstPointItr;
1176 intersection =
dcel2d::Coords(std::get<0>(docaPoint),std::get<1>(docaPoint),0.);
1177 distToConvexHull = docaDist;
1181 if (
isLeft(*firstPointItr,*secondPointItr,vertexPos)) outsideHull =
true;
1183 firstPointItr = secondPointItr;
1203 if (vtxPosDiff.norm() < 1.e-3)
1227 double totalArea(0.);
1228 int nNonInfiniteFaces(0);
1230 double largestArea(0.);
1232 std::vector<std::pair<double,const dcel2d::Face*>> areaFaceVec;
1240 double faceArea(0.);
1261 if (halfEdge == face.getHalfEdge()) doNext =
false;
1264 faceCenter /= numEdges;
1266 halfEdge = face.getHalfEdge();
1284 double dp1p0X = p1[0] - faceCenter[0];
1285 double dp1p0Y = p1[1] - faceCenter[1];
1286 double dp2p0X = p2[0] - faceCenter[0];
1287 double dp2p0Y = p2[1] - faceCenter[1];
1290 double crossProduct = dp1p0X * dp2p0Y - dp1p0Y * dp2p0X;
1294 if (crossProduct < 0.)
1297 std::cout <<
"--- negative cross: " << crossProduct <<
", edgeLen: " << edgeVec.norm() <<
", x/y: " << edgeVec[0] <<
"/" << edgeVec[1] << std::endl;
1310 if (halfEdge == face.getHalfEdge()) doNext =
false;
1313 areaFaceVec.emplace_back(faceArea,&face);
1317 nNonInfiniteFaces++;
1318 totalArea += faceArea;
1319 smallestArea =
std::min(faceArea,smallestArea);
1320 largestArea =
std::max(faceArea,largestArea);
1323 if (faceArea < 1.
e-4) std::cout <<
"---> face area <= 0: " << faceArea <<
", with " << numEdges <<
" edges" << std::endl;
1325 face.setFaceArea(faceArea);
1329 std::sort(areaFaceVec.begin(),areaFaceVec.end(),[](
const auto&
left,
const auto&
right){
return left.first <
right.first;});
1331 std::vector<std::pair<double,const dcel2d::Face*>>
::iterator firstItr = std::find_if(areaFaceVec.begin(),areaFaceVec.end(),[](
const auto& val){
return val.first > 0.;});
1334 size_t nToKeep = 0.8 * std::distance(firstItr,lastItr);
1336 std::cout <<
">>>>> nToKeep: " << nToKeep <<
", last non infinite entry: " << std::distance(areaFaceVec.begin(),lastItr) << std::endl;
1338 double totalTruncArea = std::accumulate(firstItr,firstItr+nToKeep,0.,[](
auto sum,
const auto& val){
return sum+val.first;});
1339 double aveTruncArea = totalTruncArea / double(nToKeep);
1341 if (nNonInfiniteFaces > 0) std::cout <<
">>>> Face area for " << nNonInfiniteFaces <<
", ave area: " << totalArea / nNonInfiniteFaces <<
", ave trunc area: " << aveTruncArea <<
", ratio: " << totalTruncArea / totalArea <<
", smallest: " << smallestArea <<
", largest: " << largestArea << std::endl;
1342 else std::cout <<
">>>>> there are no non infinite faces" << std::endl;
1351 std::pair<dcel2d::VertexList::const_iterator,dcel2d::VertexList::const_iterator> minMaxItrX = std::minmax_element(vertexList.begin(),vertexList.end(),[](
const auto&
left,
const auto&
right){
return left.getCoords()[0] <
right.getCoords()[0];});
1353 fXMin = minMaxItrX.first->getCoords()[0];
1354 fXMax = minMaxItrX.second->getCoords()[0];
1357 std::pair<dcel2d::VertexList::const_iterator,dcel2d::VertexList::const_iterator> minMaxItrY = std::minmax_element(vertexList.begin(),vertexList.end(),[](
const auto&
left,
const auto&
right){
return left.getCoords()[1] <
right.getCoords()[1];});
1359 fYMin = minMaxItrY.first->getCoords()[1];
1360 fYMax = minMaxItrY.second->getCoords()[1];
1376 PointPair closestEdge(prevPoint,curPoint);
1383 if (curPoint != prevPoint)
1386 double xPrevToPoint = (std::get<0>(point) - std::get<0>(prevPoint));
1387 double yPrevToPoint = (std::get<1>(point) - std::get<1>(prevPoint));
1388 double xPrevToCur = (std::get<0>(curPoint) - std::get<0>(prevPoint));
1389 double yPrevToCur = (std::get<1>(curPoint) - std::get<1>(prevPoint));
1390 double edgeLength = std::sqrt(xPrevToCur * xPrevToCur + yPrevToCur * yPrevToCur);
1393 double projection = ((xPrevToPoint * xPrevToCur) + (yPrevToPoint * yPrevToCur)) / edgeLength;
1396 dcel2d::Point docaPoint(std::get<0>(prevPoint) + projection * xPrevToCur / edgeLength,
1397 std::get<1>(prevPoint) + projection * yPrevToCur / edgeLength, 0);
1399 if (projection > edgeLength) docaPoint = curPoint;
1400 if (projection < 0) docaPoint = prevPoint;
1402 double xDocaDist = std::get<0>(point) - std::get<0>(docaPoint);
1403 double yDocaDist = std::get<1>(point) - std::get<1>(docaPoint);
1404 double docaDist = xDocaDist * xDocaDist + yDocaDist * yDocaDist;
1406 if (docaDist < closestDistance)
1408 closestEdge =
PointPair(prevPoint,curPoint);
1409 closestDistance = docaDist;
1413 prevPoint = curPoint;
1414 curPoint = *curPointItr++;
1417 closestDistance = std::sqrt(closestDistance);
1421 if (
isLeft(closestEdge.first,closestEdge.second,point)) closestDistance = -closestDistance;
1428 double closestDistance;
1432 return closestDistance;
This defines the actual beach line. The idea is to implement this as a self balancing binary search t...
bool computeCircleCenter2(const dcel2d::Coords &, const dcel2d::Coords &, const dcel2d::Coords &, dcel2d::Coords &, double &, double &) const
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
HalfEdge * getLastHalfEdge() const
HalfEdge * getNextHalfEdge() const
dcel2d::HalfEdgeList & fHalfEdgeList
std::list< HalfEdge > HalfEdgeList
void setHalfEdge(HalfEdge *half)
HalfEdge * getTwinHalfEdge() const
BSTNode class definiton specifically for use in constructing Voronoi diagrams. We are trying to follo...
std::list< Point > PointList
The list of the projected points.
bool isInsideConvexHull(const dcel2d::Vertex &) const
Is a vertex inside the convex hull - meant to be a fast check.
double Area() const
Computes the area of the enclosed convext hull.
virtual BSTNode * getBSTNode() const =0
dcel2d::FaceList & fFaceList
std::list< BSTNode > BSTNodeList
virtual ~VoronoiDiagram()
Destructor.
void makeLeftCircleEvent(EventQueue &, BSTNode *, double)
double computeArcVal(const double, const double, const IEvent *) const
Float_t y2[n_points_geant4]
bool computeCircleCenter(const dcel2d::Coords &, const dcel2d::Coords &, const dcel2d::Coords &, dcel2d::Coords &, double &, double &) const
virtual const dcel2d::Coords & circleCenter() const =0
BSTNodeList fCircleNodeList
void setLastHalfEdge(HalfEdge *last)
BSTNode * getAssociated() const
void setTwinHalfEdge(HalfEdge *twin)
Implements a ConvexHull for use in clustering.
double fVoronoiDiagramArea
IEvent * makeCircleEvent(BSTNode *, BSTNode *, BSTNode *, double)
There are two types of events in the queue, here we handle circle events.
void handleCircleEvents(BeachLine &, EventQueue &, IEvent *)
There are two types of events in the queue, here we handle circle events.
std::list< Face > FaceList
CircleEventList fCircleEventList
SiteEventList fSiteEventList
double ComputeFaceArea()
Compute the area of the faces.
EventUtilities fUtilities
std::priority_queue< IEvent *, std::vector< IEvent * >, bool(*)(const IEvent *, const IEvent *)> EventQueue
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
BSTNode * insertNewLeaf(IEvent *)
void buildVoronoiDiagram(const dcel2d::PointList &)
Given an input set of 2D points construct a 2D voronoi diagram.
bool compareSiteEventPtrs(const IEvent *left, const IEvent *right)
double findNearestDistance(const dcel2d::Point &) const
Given an input point, find the distance to the nearest edge/point.
virtual double yPos() const =0
void findBoundingBox(const dcel2d::VertexList &)
Find the min/max values in x-y to use as a bounding box.
dcel2d::VertexList & fVertexList
BSTNode * getRightChild() const
void mergeDegenerateVertices()
merge degenerate vertices (found by zero length edges)
const PointList & getConvexHull() const
recover the list of convex hull vertices
dcel2d::Coords fConvexHullCenter
virtual bool isCircle() const =0
void makeRightCircleEvent(EventQueue &, BSTNode *, double)
BSTNode * removeLeaf(BSTNode *)
void setAssociated(BSTNode *node)
virtual bool isValid() const =0
dcel2d::PointList fPointList
const BSTNode * getTopNode() const
ConvexHull class definiton.
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.
virtual double xPos() const =0
PointPair findNearestEdge(const dcel2d::Point &, double &) const
Given an input Point, find the nearest edge.
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
const HalfEdge * getHalfEdge() const
int traverseBeach() const
dcel2d::PointList fConvexHullList
void setNextHalfEdge(HalfEdge *next)
std::pair< dcel2d::Point, dcel2d::Point > PointPair
double computeBreak(const double, const IEvent *, const IEvent *, RootsPair &) const
void setHalfEdge(HalfEdge *half)
const dcel2d::PointList & getConvexHull() const
recover the point list representing the convex hull
void boostTranslation(const dcel2d::PointList &, const boost::polygon::voronoi_edge< double > *, const boost::polygon::voronoi_edge< double > *, BoostEdgeToEdgeMap &, BoostVertexToVertexMap &, BoostCellToFaceMap &)
PointPair getExtremePoints() const
Given an input Point, find the nearest edge.
BSTNode * getPredecessor() const
std::map< const boost::polygon::voronoi_edge< double > *, dcel2d::HalfEdge * > BoostEdgeToEdgeMap
Translate boost to dcel.
std::map< const boost::polygon::voronoi_vertex< double > *, dcel2d::Vertex * > BoostVertexToVertexMap
bool computeCircleCenter3(const dcel2d::Coords &, const dcel2d::Coords &, const dcel2d::Coords &, dcel2d::Coords &, double &, double &) const
std::pair< double, double > RootsPair
void terminateInfiniteEdges(BeachLine &, double)
this aims to process remaining elements in the beachline after the event queue has been depleted ...
dcel2d::Face * getFace() const
std::list< Point > PointList
void buildVoronoiDiagramBoost(const dcel2d::PointList &)
void setFace(dcel2d::Face *face)
dcel2d::HalfEdge * getHalfEdge() const
Vertex * getTargetVertex() const
Float_t x2[n_points_geant4]
const Coords & getCoords() const
std::list< Vertex > VertexList
virtual void setInvalid() const =0
Interface for configuring the particular algorithm tool.
void setTargetVertex(Vertex *vertex)
IEvent * getEvent() const
BSTNode * getSuccessor() const
BSTNode * getLeftChild() const
std::map< const boost::polygon::voronoi_cell< double > *, dcel2d::Face * > BoostCellToFaceMap
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
virtual const dcel2d::Coords & getCoords() const =0
Event finding and building.
void setHalfEdge(dcel2d::HalfEdge *half)
virtual const dcel2d::Point & getPoint() const =0
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.
void handleSiteEvents(BeachLine &, EventQueue &, IEvent *)
There are two types of events in the queue, here we handle site events.