2016-06-28 5 views
0

私はCGALを初めて使用しており、2D Reflectionをインスタンス化しようとしています。 typedef CGAL::Aff_transformation_2<K> Transformationを定義したタイプリフレクションのCGAL ::変換の変換

、他人Transformationsのために働く 、同様にこれをしようとしたとき、私はエラーメッセージを持っている

Transformation rational_rotate(CGAL::ROTATION, 1, 100); //OK 
Transformation translate(CGAL::TRANSLATION, Vector_2(-2, 0));//OK 

CGAL::Line_2<CGAL::Cartesian<double>> LineR(A,B); 
Transformation Reflection(CGAL::REFLECTION, LineR); 

私はKernels多くを試みたが、私は」問題がこの方向にあるのかどうかわからない。

ご了承ください。

+0

奇妙な、それはデカルトのカーネルに欠けているように見える(しかし、ラッパーに存在します)。同種のカーネルはもう少し進んでいますが、おそらくバグの可能性はあります。完全な例(#include、typedef、私たちは問題を再現するためにコピー・ペーストとコンパイルができるはずです)を使って、CGALのgithubに問題を提出してください。 –

+0

こんにちは、ありがとうございました。 LAB.proとLAB.cppの2つのファイルをTree:1e7becd11fにタグ付けしました。 – democrie

+1

こんにちは、木を忘れてください、あなたは問題#1216を見ているかもしれません – democrie

答えて

0

答え(ノーwaranty)のexemple:

Transformation getReflection(Line_2 droite) 
{ 
    if(droite.is_degenerate()) 
     std::cout<< "Droite dégénérée, tester avant l'appel de la fonction ..."<< std::endl; 

    if(droite.is_vertical()) 
    { 
     double Xd = - droite.c()/droite.b(); 
     return Transformation(-1, 0, 2*Xd, 0, 1, 0, 1.0); 
    } 
    else 
    { 
     double x = droite.x_at_y(0); 
     Transformation translation (CGAL::TRANSLATION, CGAL::ORIGIN - Point_2(-x, 0)); 
     double pente = droite.direction().dy()/droite.direction().dx(); 
     double angle = atan(pente); 
     Transformation rotation(CGAL::ROTATION, sin(angle), cos(angle)); 
     Transformation comp = translation * rotation; 
     return comp * Transformation(1, 0, 0, -1) * comp.inverse(); 
    } 
}