diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_3.h index 7a04f837092..dce2d467b1e 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_3.h @@ -161,6 +161,9 @@ public: bool is_even() const { return this->Ptr()->is_even(); } bool is_odd() const { return ! (this->Ptr()->is_even()); } + bool is_translation() const { return this->Ptr()->is_translation(); } + + FT cartesian(int i, int j) const { return this->Ptr()->cartesian(i,j); } FT homogeneous(int i, int j) const { return cartesian(i,j); } FT m(int i, int j) const { return cartesian(i,j); } diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_3.h index 406cb7accca..2af5a97cedd 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_3.h @@ -54,6 +54,7 @@ public: virtual Aff_transformation_3 inverse() const = 0; virtual Aff_transformation_3 transpose() const = 0; virtual bool is_even() const = 0; + virtual bool is_translation() const = 0; virtual FT cartesian(int i, int j) const = 0; virtual std::ostream &print(std::ostream &os) const = 0; }; @@ -144,6 +145,12 @@ public: t31, t32, t33) == POSITIVE; } + + virtual bool is_translation() const + { + return false; + } + virtual FT cartesian(int i, int j) const { switch (i) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_3.h index 061f1806a9e..d90928efddb 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_3.h @@ -121,6 +121,12 @@ public: return true; } + virtual bool is_translation() const + { + return false; + } + + virtual FT cartesian(int i, int j) const { if (i!=j) return FT(0); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_3.h index 6377c1a3d8a..9f0d718a64e 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_3.h @@ -125,6 +125,11 @@ public: return true; } + virtual bool is_translation() const + { + return true; + } + virtual FT cartesian(int i, int j) const { if (j==i) return FT(1); diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h index b67c4f024a3..1ee88421490 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h @@ -87,6 +87,9 @@ public: virtual FT cartesian(int i, int j) const = 0; + + virtual bool + is_translation() const = 0; }; template < class R_ > @@ -212,6 +215,12 @@ public: is_even() const { return true; } + virtual bool + is_translation() const + { + return false; + } + virtual RT homogeneous(int i, int j) const { return (i==j) ? RT(1) : RT(0); } @@ -693,6 +702,12 @@ bool Translation_repH3::is_even() const { return true; } +template < class R > +inline +bool +Translation_repH3::is_translation() const +{ return true; } + template < class R > CGAL_KERNEL_LARGE_INLINE typename Translation_repH3::RT diff --git a/Nef_3/include/CGAL/Nef_polyhedron_3.h b/Nef_3/include/CGAL/Nef_polyhedron_3.h index 8a2e1e16520..c1a0791152f 100644 --- a/Nef_3/include/CGAL/Nef_polyhedron_3.h +++ b/Nef_3/include/CGAL/Nef_polyhedron_3.h @@ -1710,6 +1710,8 @@ protected: bool ninety = is_90degree_rotation(aff); bool scale = is_scaling(aff); + bool translate = aff.is_translation(); + Vertex_iterator vi; CGAL_forall_vertices( vi, snc()) { @@ -1726,8 +1728,10 @@ protected: vertex_list.push_back(vi); } else { vi->point() = vi->point().transform( aff); - SM_decorator sdeco(&*vi); - sdeco.transform( linear); + if(! translate){ + SM_decorator sdeco(&*vi); + sdeco.transform( linear); + } } }