33#ifdef OGDF_INCLUDE_CGAL 
   46template<
typename Kernel>
 
   47bool has_collinear_pair(
const std::vector<Point_t<Kernel>>& points, 
const unsigned int v) {
 
   48    std::vector<typename Kernel::FT> angles;
 
   49    geometry::Vector_t<Kernel> x(1, 0);
 
   51    for (
unsigned int w = 0; w < points.size(); w++) {
 
   57            for (
unsigned int u = w + 1; u < points.size(); u++) {
 
   60                    if (CGAL::collinear(p_u, p_v, p_w) || p_u == p_v) {
 
   70template<
typename Kernel, 
typename Graph>
 
   71bool has_collinear_pair(
const graph::GeometricDrawing<Kernel, Graph>& d,
 
   72        const typename Graph::Node v) {
 
   73    std::vector<typename Kernel::FT> angles;
 
   74    geometry::Vector_t<Kernel> x(1, 0);
 
   75    auto p_v = d.get_point(v);
 
   76    for (
auto w : d.get_graph().nodes()) {
 
   78            auto p_w = d.get_point(w);
 
   82            for (
auto u : d.get_graph().nodes()) {
 
   83                if (u != v && u != w) {
 
   84                    auto p_u = d.get_point(u);
 
   85                    if (CGAL::collinear(p_u, p_v, p_w) || p_u == p_v) {
 
   95template<
typename Kernel, 
typename Graph>
 
   96bool has_collinear_triple(
const graph::GeometricDrawing<Kernel, Graph>& d) {
 
   97    for (
auto v : d.get_graph().nodes()) {
 
   98        if (has_collinear_pair(d, v)) {
 
  105template<
typename Kernel>
 
  106bool has_collinear_triple(
const std::vector<Point_t<Kernel>>& points) {
 
  107    for (
unsigned int v = 0; v < points.size(); ++v) {
 
  108        if (has_collinear_pair(points, v)) {
 
  115template<
typename Kernel>
 
  116void resolve_collinearity(std::vector<Point_t<Kernel>>& points) {
 
  117    if (!geometry::has_collinear_triple(points)) {
 
  123    std::uniform_real_distribution<double> distr(-1, 1);
 
  125    for (
unsigned int v = 0; v < points.size(); ++v) {
 
  126        bool col = geometry::has_collinear_pair(points, v);
 
  128            auto prev = points[v];
 
  129            auto x = prev.x() + distr(gen);
 
  130            auto y = prev.y() + distr(gen);
 
  131            points[v] = Point_t<Kernel>(x, y);
 
  132            col = geometry::has_collinear_pair(points, v);
 
long unsigned int randomSeed()
Returns a random value suitable as initial seed for a random number engine.
The namespace for all OGDF objects.