33 #ifdef OGDF_INCLUDE_CGAL
38 # include <CGAL/Line_2.h>
45 using namespace tools;
46 template<
typename kernel>
47 using Line_t = CGAL::Line_2<kernel>;
49 template<
typename kernel>
50 inline bool turn(
const Line_t<kernel>& l1,
const Line_t<kernel>& l2) {
51 return turn(l1.to_vector(), l2.to_vector());
54 template<
typename kernel>
55 inline bool left_turn(
const Line_t<kernel>& l1,
const Line_t<kernel>& l2) {
56 return left_turn(l1.to_vector(), l2.to_vector());
59 template<
typename kernel>
60 inline bool right_turn(
const Line_t<kernel>& l1,
const Line_t<kernel>& l2) {
61 return right_turn(l1.to_vector(), l2.to_vector());
64 template<
typename kernel>
65 inline bool turn(
const Line_t<kernel>& l,
const Point_t<kernel>& p) {
66 return turn(l.to_vector(), p - l.point(0));
69 template<
typename kernel>
70 inline bool left_turn(
const Line_t<kernel>& l,
const Point_t<kernel>& p) {
71 return left_turn(l.to_vector(), p - l.point(0));
74 template<
typename kernel>
75 inline bool right_turn(
const Line_t<kernel>& l,
const Point_t<kernel>& p) {
76 return right_turn(l.to_vector(), p - l.point(0));
79 template<
typename kernel>
80 inline Point_t<kernel> intersect(
const Line_t<kernel>& l1,
const Line_t<kernel>& l2) {
83 auto result = CGAL::intersection(l1, l2);
85 return Point_t<kernel>(std::numeric_limits<unsigned int>::max(),
86 std::numeric_limits<unsigned int>::max());
89 Point_t<kernel> intersection;
90 if (boost::get<Line_t<kernel>>(&*result)) {
91 auto s = boost::get<Line_t<kernel>>(&*result);
92 intersection = s->point(0);
94 intersection = *boost::get<Point_t<kernel>>(&*result);