Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
CrossingMinimalPosition.h
Go to the documentation of this file.
1
31#pragma once
32
33#ifdef OGDF_INCLUDE_CGAL
34
39
40namespace ogdf {
41namespace internal {
42namespace gcm {
43namespace graph {
44
45template<typename Kernel, typename Graph>
46class CrossingMinimalPosition {
47private:
48 using Point = geometry::Point_t<Kernel>;
49 using Segment = geometry::LineSegment_t<Kernel>;
50 using Polygon = geometry::Polygon_t<Kernel>;
51 using Drawing = graph::GeometricDrawing<Kernel, Graph>;
52 using Node = typename Graph::Node;
53 using Edge = typename Graph::Edge;
54
55public:
56 static Point compute(const Drawing& d, const Node& v, const std::vector<Edge>& sample,
57 geometry::Rectangle_t<Kernel>& rect_box) {
58 unsigned int dump_a, dump_b;
59 auto region = CrossingMinimalRegion<Kernel, Graph>::compute(d, v, sample, rect_box, dump_a,
60 dump_b);
61 if (geometry::is_clockwise(region)) {
62 region = geometry::reverse(region);
63 }
64
65 Point p = d.get_point(v);
66 if (region.size() > 2) {
67 if (!region.is_convex()) {
68 p = geometry::largest_circle_in_polygon(region, 1e-5);
69 } else {
70 p = geometry::centroid(region);
71 }
72 }
73
74 //round
75 OGDF_ASSERT(rect_box.has_on_bounded_side(p));
76 p = Point(CGAL::to_double(p.x()), CGAL::to_double(p.y()));
77 OGDF_ASSERT(rect_box.has_on_bounded_side(p));
78 return p;
79 }
80};
81
82}
83}
84}
85}
86
87#endif
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:41
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.