33 #ifdef OGDF_INCLUDE_CGAL
39 # include <CGAL/IO/io.h>
40 # include <CGAL/Ray_2.h>
46 using namespace tools;
48 template<
typename kernel>
49 using Ray_t = CGAL::Ray_2<kernel>;
51 template<
typename kernel,
typename type>
52 inline Point_t<kernel> rel_point_at(
const Ray_t<kernel>&
r,
const type l) {
53 return r.source() +
r.to_vector() * l;
56 template<
typename kernel>
57 inline typename kernel::FT squared_convex_parameter_directed(
const Ray_t<kernel>&
r,
58 const Point_t<kernel>& p) {
60 return (
r.source() - p).squared_length() /
r.to_vector().squared_length();
63 template<
typename kernel>
64 inline Point_t<kernel> intersect(
const Line_t<kernel>& l,
const Ray_t<kernel>&
r) {
67 auto result = CGAL::intersection(l,
r);
69 return Point_t<kernel>(std::numeric_limits<unsigned int>::max(),
70 std::numeric_limits<unsigned int>::max());
72 Point_t<kernel> intersection;
73 if (boost::get<Ray_t<kernel>>(&*result)) {
74 auto s = boost::get<Ray_t<kernel>>(&*result);
75 intersection = s->point(0);
77 intersection = *boost::get<Point_t<kernel>>(&*result);