2017-10-11 11 views
-1

+ 연산자를 사용하여 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; 
     ~~~~~~~~~~~~~~^~~~~~~~~~~~ 
+0

당신은 함수 내부에'표준 : cout'statements을 넣어해야합니다. 어쩌면'int main()'? – Galik

+1

수학적으로 정확하지 않습니다. 'Vector_2 '를 사용하면 유효합니다. – sloriot

+0

어쩌면 나는 그것을 놓치고 있지만, 문서에서 두 점을 더할 수 있다고 말하는 곳은 어디입니까? 수학적으로 허용해서는 안됩니다. – templatetypedef

답변

0

:

는 그러나 나는 다음과 같은 오류가 발생합니다. 점에 벡터 만 추가 할 수 있습니다. 문서에서

을 (만드는 완전히 물론, 감지) :

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