33#ifdef OGDF_INCLUDE_CGAL
41# include <CGAL/Aff_transformation_2.h>
42# include <CGAL/Point_2.h>
43# include <CGAL/aff_transformation_tags.h>
44# include <CGAL/squared_distance_2.h>
51template<
typename kernel>
52using Point_t = CGAL::Point_2<kernel>;
54template<
typename kernel>
56 return p1.x() == p2.x() && p1.y() == p2.y();
59template<
typename kernel>
61 return CGAL::sqrt(CGAL::to_double(CGAL::squared_distance(p1, p2)));
64template<
typename kernel,
typename precision>
66 CGAL::Aff_transformation_2<kernel> rotate(CGAL::ROTATION,
sin(angle),
cos(angle));
67 return std::move(rotate(p));
70template<
typename kernel>
73 return CGAL::is_finite(p.x()) && CGAL::is_finite(p.y()) && CGAL::is_valid(p.x())
74 && CGAL::is_valid(p.y());
77template<
typename kernel>
79 os.write(
reinterpret_cast<const char*
>(&p.x()),
sizeof(p.x()));
80 os.write(
reinterpret_cast<const char*
>(&p.y()),
sizeof(p.y()));
83template<
typename kernel>
85 in.read(
reinterpret_cast<char*
>(&p.x()),
sizeof(p.x()));
86 in.read(
reinterpret_cast<char*
>(&p.y()),
sizeof(p.y()));
89template<
typename Kernel>
93 static bool equal(
const Point& p1,
const Point& p2) {
return is_the_same(p1, p2); }
95 static bool less(
const Point& p1,
const Point& p2) {
96 return p1.x() < p2.x() || (p1.x() == p2.x() && p1.y() < p2.y());
99 static bool less_equal(
const Point& p1,
const Point& p2) {
100 return p1.x() < p2.x() || (p1.x() == p2.x() && p1.y() <= p2.y());
103 static bool greater(
const Point& p1,
const Point& p2) {
104 return p1.x() > p2.x() || (p1.x() == p2.x() && p1.y() > p2.y());
107 static bool greater_equal(
const Point& p1,
const Point& p2) {
108 return p1.x() > p2.x() || (p1.x() == p2.x() && p1.y() >= p2.y());
111 bool operator()(
const Point& p1,
const Point& p2)
const {
return less(p1, p2); }
114template<
typename Kernel,
typename T>
115inline geometry::Point_t<Kernel>
cast(
const geometry::Point_t<T>& p) {
116 return {(
typename Kernel::FT)(p.x()), (
typename Kernel::FT)(p.y())};
121 return {p1.x() + p2.x(), p1.y() + p2.y()};
124template<
typename kernel>
126 CGAL::Aff_transformation_2<kernel> scale(CGAL::SCALING, v);
127 return std::move(scale(p));
130template<
typename kernel>
132 return std::move(p * v);
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
MDMFLengthAttribute operator+(MDMFLengthAttribute x, const MDMFLengthAttribute &y)
The namespace for all OGDF objects.