33#ifdef OGDF_INCLUDE_CGAL
42# include <CGAL/Exact_predicates_exact_constructions_kernel.h>
44# ifndef OGDF_GEOMETRIC_INEXACT_NUMBER_TYPE
45# define OGDF_GEOMETRIC_INEXACT_NUMBER_TYPE false
59 unsigned int seg_a = -1;
60 unsigned int seg_b = -1;
68 bool is_incident(
const unsigned int segment)
const {
72 unsigned int opposite(
const unsigned int segment)
const {
73 if (
seg_a == segment) {
80 unsigned int pos(
const unsigned int segment)
const {
81 if (
seg_a == segment) {
91template<
typename Kernel,
bool OPEN = true>
94 using LineSegment = geometry::LineSegment_t<Kernel>;
95 using Point = geometry::Point_t<Kernel>;
96 using Polygon = geometry::Polygon_t<Kernel>;
97 using Line = geometry::Line_t<Kernel>;
98 using Ray = geometry::Ray_t<Kernel>;
99 using Direction = geometry::Direction_t<Kernel>;
101 using ExactKernel = CGAL::Exact_predicates_exact_constructions_kernel;
103 using ExactPoint = geometry::Point_t<ExactKernel>;
120 using LCGEdge = std::tuple<unsigned int, unsigned int, unsigned int>;
126 template<
typename IntersectionEvent>
129 std::vector<unsigned int> active;
138 std::swap(active[
active_id], active.back());
143 std::vector<Event>
events;
147 for (
unsigned int i = 0; i <
segments.size(); ++i) {
157 return a.p < b.p || (a.p == b.p && a.event == EventType::Start);
163 if (e.event == EventType::Start) {
184 void subdivision(std::vector<LineSegment>& segment,
211 for (
unsigned int i = 0; i < segment.size(); ++i) {
212 auto& s = segment[i];
226 for (
unsigned int i = 0; i <
same.size(); ++i) {
231 [&](
unsigned int a,
unsigned int b) { return intersections[a] < intersections[b]; });
233 for (
unsigned int i = 0; i + 1 <
same.size(); ++i) {
234 unsigned int u =
same[i];
235 unsigned int v =
same[i + 1];
242 for (
unsigned int i = 0; i < segment.size(); ++i) {
245 std::sort(
is.begin(),
is.end(), [&](
const unsigned int a,
unsigned int b) {
246 const Point& p_a = intersections[a];
247 const Point& p_b = intersections[b];
249 auto d_a = CGAL::squared_distance(segment[i].source(), p_a);
250 auto d_b = CGAL::squared_distance(segment[i].source(),
254 for (
unsigned int j = 0;
j + 1 <
is.size(); ++
j) {
270 std::vector<Intersection>
subdivision(std::vector<LineSegment>& segment) {
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.