33#ifdef OGDF_INCLUDE_CGAL
40# include <CGAL/Aff_transformation_2.h>
41# include <CGAL/Cartesian.h>
42# include <CGAL/Vector_2.h>
43# include <CGAL/aff_transformation_tags.h>
52template<
typename kernel>
53using Vector_t = CGAL::Vector_2<kernel>;
55template<
typename kernel>
57 return v1.x() ==
v2.x() &&
v1.y() ==
v2.y();
60template<
typename kernel>
62 CGAL::Aff_transformation_2<kernel>
rotation(CGAL::ROTATION, std::sin(angle), std::cos(angle));
66template<
typename kernel>
71template<
typename kernel>
73 return CGAL::determinant(
v1,
v2);
76template<
typename kernel>
78 return cross(
v1,
v2) >= 0;
81template<
typename kernel>
83 return CGAL::orientation(
v1,
v2) == CGAL::LEFT_TURN;
86template<
typename kernel>
88 return CGAL::orientation(
v1,
v2) == CGAL::RIGHT_TURN;
91template<
typename kernel>
93 return CGAL::orientation(
v1,
v2) == CGAL::COLLINEAR;
96template<
typename kernel>
99 return v * CGAL::inverse(tools::approx_sqrt(v.squared_length()));
102template<
typename kernel>
104 return v.perpendicular(CGAL::POSITIVE);
107template<
typename kernel>
109 if ((-
v1).direction() ==
v2.direction()) {
110 return normalize(normal(
v1));
112 return (normalize(
v1) + normalize(
v2)) * 0.5;
115template<
typename kernel>
117 OGDF_ASSERT(!isZero(
v1.squared_length()) && !isZero(
v2.squared_length()));
118 typename kernel::FT v =
v1 *
v2;
119 return v * CGAL::inverse(tools::approx_sqrt(
v1.squared_length() *
v2.squared_length()));
122template<
typename kernel>
128template<
typename kernel>
130 using type =
typename kernel::FT;
131 const type alpha = geometry::angle(
v1,
v2);
133 return (type)left * alpha + (
type)(1.0 - left) * ((
type)2.0 * tools::const_pi<type>() - alpha);
136template<
typename kernel>
141template<
typename kernel>
143 os.write(
reinterpret_cast<const char*
>(&v.x()),
sizeof(v.x()));
144 os.write(
reinterpret_cast<const char*
>(&v.y()),
sizeof(v.y()));
147template<
typename kernel>
149 in.read(
reinterpret_cast<char*
>(&v.x()),
sizeof(v.x()));
150 in.read(
reinterpret_cast<char*
>(&v.y()),
sizeof(v.y()));
153template<
typename Vector>
155 bool operator()(
const Vector& a,
const Vector& b)
const {
156 return a.x() < b.x() || (a.x() == b.x() && a.y() < b.y());
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.