33#ifdef OGDF_INCLUDE_CGAL
35# ifndef OGDF_GEOMETRIC_INEXACT_NUMBER_TYPE
36# define OGDF_GEOMETRIC_INEXACT_NUMBER_TYPE false
48# include <CGAL/Segment_2.h>
56template<
typename kernel>
63template<
typename kernel>
67 return geometry::angle(
l1.to_vector(),
l2.to_vector());
74template<
typename kernel>
82template<
typename kernel>
84 return turn(
ls.to_vector(),
l.to_vector());
87template<
typename kernel>
92template<
typename kernel>
97template<
typename kernel>
99 return turn(
ls.supporting_line(), p);
102template<
typename kernel>
107template<
typename kernel>
112template<
typename kernel>
116 return (
ls.source() - p).squared_length() /
ls.to_vector().squared_length();
119template<
typename kernel>
127template<
typename kernel>
130 return ls.source() + (
ls.to_vector() *
l);
133template<
typename kernel>
135 if (
ls.supporting_line().is_vertical()) {
136 return std::numeric_limits<typename kernel::FT>::infinity();
138 return ls.supporting_line().y_at_x(x);
142template<
typename kernel>
144 if (
ls.supporting_line().is_vertical()) {
147 return ls.supporting_line().y_at_x(p.x());
151template<
bool closed,
typename kernel>
154 return ls.has_on(point) &&
ls.target() != point;
156 return ls.has_on(point);
160template<
typename kernel>
165template<
typename kernel>
167 const bool parallel = CGAL::parallel(
l1.supporting_line(),
l2.supporting_line());
173template<
typename kernel>
178 const bool on_line = line.has_on(
ls.source()) || line.has_on(
ls.target());
182template<
typename kernel>
184 return CGAL::do_intersect(
l1,
l2) && !
l1.has_on(
l2.target()) && !
l2.has_on(
l1.target());
187template<
typename kernel>
189 return CGAL::do_intersect(
l1,
l2) && !
l1.has_on(
l2.target()) && !
l2.has_on(
l1.target())
190 && !
l1.has_on(
l2.source()) && !
l2.has_on(
l1.source());
193template<
typename kernel>
195 return CGAL::do_intersect(
l1,
l) && !
l.has_on(
l1.target());
198template<
typename kernel>
200 return geometry::do_intersect_wo_target(
l1,
l);
203template<
typename kernel>
205 return CGAL::do_intersect(
l1,
r) && !
r.has_on(
l1.target());
208template<
typename kernel>
210 return geometry::do_intersect_wo_target(
l1,
r);
213template<
typename kernel>
215 return l1.source() ==
l2.source() ||
l1.source() ==
l2.target() ||
l1.target() ==
l1.source()
216 ||
l1.target() ==
l2.target();
219template<
typename kernel>
224 if (
l1.source() ==
l2.source() ||
l1.source() ==
l2.target()) {
231template<
typename kernel>
236 auto result = CGAL::intersection(
l1,
l2);
239 std::numeric_limits<double>::max());
244 auto s = boost::get<LineSegment_t<kernel>>(&*result);
245 intersection = s->source();
247 intersection = *boost::get<Point_t<kernel>>(&*result);
255template<
typename kernel>
259 auto result = CGAL::intersection(
l1,
l2);
262 std::numeric_limits<unsigned int>::max());
267 auto s = boost::get<LineSegment_t<kernel>>(&*result);
268 intersection = s->source();
270 intersection = *boost::get<Point_t<kernel>>(&*result);
277template<
typename kernel>
279 return intersect(
l2,
l1);
282template<
typename kernel>
287 auto result = CGAL::intersection(
l1,
r);
290 std::numeric_limits<unsigned int>::max());
296 auto s = boost::get<LineSegment_t<kernel>>(&*result);
297 intersection = s->source();
299 intersection = *boost::get<Point_t<kernel>>(&*result);
306template<
typename kernel>
308 return intersect(
l2,
l1);
311template<
typename kernel>
320 auto s = reference.target() - reference.source();
324 auto c_1 = cross(reference.source() -
l_1.source(), s);
325 auto c_2 = cross(reference.source() -
l_2.source(), s);
333template<
typename kernel>
339template<
typename kernel>
341 return l1.source() <
l2.source() || (
l1.source() ==
l2.source() &&
l1.target() <
l2.target());
344template<
typename Kernel,
typename T>
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
bool operator<(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
The namespace for all OGDF objects.