Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Ray.h
Go to the documentation of this file.
1 
31 #pragma once
32 
33 #ifdef OGDF_INCLUDE_CGAL
34 
38 
39 # include <CGAL/IO/io.h>
40 # include <CGAL/Ray_2.h>
41 
42 namespace ogdf {
43 namespace internal {
44 namespace gcm {
45 namespace geometry {
46 using namespace tools;
47 
48 template<typename kernel>
49 using Ray_t = CGAL::Ray_2<kernel>;
50 
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;
54 }
55 
56 template<typename kernel>
57 inline typename kernel::FT squared_convex_parameter_directed(const Ray_t<kernel>& r,
58  const Point_t<kernel>& p) {
59  OGDF_ASSERT(r.has_on(p));
60  return (r.source() - p).squared_length() / r.to_vector().squared_length();
61 }
62 
63 template<typename kernel>
64 inline Point_t<kernel> intersect(const Line_t<kernel>& l, const Ray_t<kernel>& r) {
65  OGDF_ASSERT(!l.is_degenerate());
66  OGDF_ASSERT(!r.is_degenerate());
67  auto result = CGAL::intersection(l, r);
68  if (!result) {
69  return Point_t<kernel>(std::numeric_limits<unsigned int>::max(),
70  std::numeric_limits<unsigned int>::max());
71  }
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);
76  } else {
77  intersection = *boost::get<Point_t<kernel>>(&*result);
78  }
79  return intersection;
80 }
81 
82 } //namespace
83 }
84 }
85 }
86 
87 #endif
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
Point.h
Vector.h
r
int r[]
Definition: hierarchical-ranking.cpp:13
backward::Color::type
type
Definition: backward.hpp:1716
Line.h