2017-10-11 7 views
-1

+演算子を使用してCGALに2つのポイントを追加しようとしています。なぜCGALでポイントを追加できない

私は documentationを考慮可能であることを前提とし
#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; 

。私はドキュメントを読み違えた

/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

あなたは関数の内部で、あなたの 'のstd :: cout'statementsを配置する必要があります:ドキュメントから(どのもちろん、完全に理にかなって)

。おそらく 'int main()'ですか? – Galik

+1

数学的には正しくありません。 'Vector_2'は有効です。 – sloriot

+0

たぶん私はそれを紛失していますが、ドキュメンテーションのどこで2つのポイントを追加できますか?数学的には、これは許されるべきではありません。 – 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

関連する問題