From 5aa34c9106c3d5bd3d7d9d5259e738a3549f4c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 2 Dec 2021 20:11:18 +0100 Subject: [PATCH] Add Aff_transformation_2 conversion, simplify Aff_tr_3's --- .../include/CGAL/Cartesian_converter.h | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian_converter.h b/Cartesian_kernel/include/CGAL/Cartesian_converter.h index b890e3b5f77..89595b5ef34 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian_converter.h +++ b/Cartesian_kernel/include/CGAL/Cartesian_converter.h @@ -396,24 +396,25 @@ public: return std::make_pair(operator()(pp.first), operator()(pp.second)); } - typename K2::Aff_transformation_3 - operator()(const typename K1::Aff_transformation_3 &a) const + typename K2::Aff_transformation_2 + operator()(const typename K1::Aff_transformation_2& a) const { - typedef typename K2::Aff_transformation_3 Aff_transformation_3; - typename K2::FT t[12]; - for(int i=0; i< 3; ++i) - { - for(int j=0; j<4; ++j) - { - t[i*4+j] = a.m(i,j); - } - } - return Aff_transformation_3( - t[0],t[1],t[2],t[3], - t[4],t[5],t[6],t[7], - t[8],t[9],t[10],t[11], - a.m(3,3)); + typedef typename K2::Aff_transformation_2 Aff_transformation_2; + return Aff_transformation_2(c(a.m(0,0)), c(a.m(0,1)), c(a.m(0,2)), + c(a.m(1,0)), c(a.m(1,1)), c(a.m(1,2)), + c(a.m(2,2))); } + + typename K2::Aff_transformation_3 + operator()(const typename K1::Aff_transformation_3& a) const + { + typedef typename K2::Aff_transformation_3 Aff_transformation_3; + return Aff_transformation_3(c(a.m(0,0)), c(a.m(0,1)), c(a.m(0,2)), c(a.m(0,3)), + c(a.m(1,0)), c(a.m(1,1)), c(a.m(1,2)), c(a.m(1,3)), + c(a.m(2,0)), c(a.m(2,1)), c(a.m(2,2)), c(a.m(2,3)), + c(a.m(3,3))); + } + private: Converter c; K2 k;