Loading [MathJax]/extensions/tex2jax.js

Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
PerturbPolygon.h
Go to the documentation of this file.
1
31#pragma once
32
33#ifdef OGDF_INCLUDE_CGAL
34
36
37namespace ogdf {
38namespace internal {
39namespace gcm {
40namespace geometry {
41
45template<typename Kernel>
46Polygon_t<Kernel> peturb(const Polygon_t<Kernel>& polygon, double eps = 1e-5) {
48
49 auto bisector = [&](const Segment& s1, const Segment& s2) {
50 const auto& v_in = s1.to_vector();
51 const auto& v_out = s2.to_vector();
52 auto bisected = bisect(-v_in, v_out);
53 if (geometry::right_turn(v_in, bisected)) {
55 }
56
57 return bisected;
58 };
59
61 auto itr = polygon.edges_circulator();
62 for (unsigned int i = 0; i < polygon.size(); ++i) {
63 perturbed.push_back(polygon[i] + bisector(*(itr - 1), *itr) * eps);
64 ++itr;
65 }
66 return perturbed;
67}
68
69}
70}
71}
72}
73
74#endif
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.