为什么我不能在CGAL中加分

Why can I not add points in CGAL

我正在尝试使用 + 运算符在 CGAL 中添加两个点。

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Point_2.h>

typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_2 Point;

using namespace std;

cout << Point(8.9, 9) + Point(1,1) << endl;
cout << Point(8.9, 9) + Point(2,2) * .5 << endl;

考虑到 documentation,我认为这是可能的。

但我收到以下错误:

/path_to_file/main.cpp:25: error: no match for ‘operator+’ (operand types are ‘Point {aka CGAL::Point_2<CGAL::Simple_cartesian<double> >}’ and ‘Point {aka CGAL::Point_2<CGAL::Simple_cartesian<double> >}’)
 cout << Point(8.9, 9) + Point(1,1) << endl;
         ~~~~~~~~~~~~~~^~~~~~~~~~~~

我误读了文档。您只能将矢量添加到点。 (当然,这完全有道理)

来自文档:

Point_2< Kernel > operator+ (const Point_2< Kernel > &p, const Vector_2< Kernel > &v) returns the point obtained by translating p by the vector v