I am trying to add two points in CGAL using the +
operator.
#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;
Which I assume to be possible considering the documentation.
But I get the following error:
/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;
~~~~~~~~~~~~~~^~~~~~~~~~~~
I was misreading the documentation. You can only add vectors to points. (Which makes totally sense, of course)
From the documentation :
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