Instancing a CGAL::Transformation of type Reflection -


i new cgal , i'm trying instantiate 2d reflection.

having defined typedef cgal::aff_transformation_2<k> transformation, works others transformations, :

transformation rational_rotate(cgal::rotation,  1, 100); //ok transformation translate(cgal::translation, vector_2(-2, 0));//ok 

i have error message when trying this:

cgal::line_2<cgal::cartesian<double>> liner(a,b); transformation reflection(cgal::reflection, liner); 

i've tried many kernels, i'm not sure problem in direction.

any hint appreciated.

an exemple of answer (no waranty):

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();     } } 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -