From fc10fdb7db22c4f74d7a82e0351131ed85f44783 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Wed, 15 Sep 2021 08:55:12 +0100 Subject: [PATCH] Implement transposed_inverse for homogeneous plane transformations --- .../CGAL/Homogeneous/Aff_transformationH3.h | 55 +++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h index fa0ba377b4d..f0c74e0d883 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h @@ -70,6 +70,9 @@ public: virtual Plane_3 transform(const Plane_3&) const = 0; + virtual Plane_3 + transform(const Plane_3&, bool, const Aff_transformation_3&) const = 0; + virtual Aff_transformation_3 inverse() const = 0; @@ -134,6 +137,9 @@ public: virtual Plane_3 transform(const Plane_3& pl) const; + virtual Plane_3 + transform(const Plane_3& pl, bool is_even, const Aff_transformation_3& transposed_inverse) const; + virtual Aff_transformation_3 inverse() const; @@ -207,6 +213,10 @@ public: transform(const Plane_3& pl) const { return pl; } + virtual Plane_3 + transform(const Plane_3& pl, bool, const Aff_transformation_3&) const + { return pl; } + virtual Aff_transformation_3 inverse() const { return Aff_transformation_3( IDENTITY); } @@ -289,6 +299,12 @@ class Scaling_repH3 : public Aff_transformation_rep_baseH3 return Plane_3(p.a()*_sf_den, p.b()*_sf_den, p.c()*_sf_den, p.d()*_sf_num); } + virtual Plane_3 + transform(const Plane_3& p, bool, const Aff_transformation_3&) const + { + return transform(p); + } + virtual Aff_transformation_3 inverse() const { return Aff_transformation_3(SCALING, _sf_den, _sf_num); } @@ -386,6 +402,9 @@ public: virtual Plane_3 transform(const Plane_3& pl) const; + virtual Plane_3 + transform(const Plane_3& pl, bool is_even, const Aff_transformation_3& transposed_inverse) const; + virtual Aff_transformation_3 inverse() const; @@ -471,6 +490,9 @@ public: Plane_3 transform(const Plane_3& pl) const; + Plane_3 + transform(const Plane_3& pl, bool is_even, const Aff_transformation_3& transposed_inverse) const; + Aff_transformation_3 inverse() const; @@ -577,22 +599,31 @@ template < class R > CGAL_KERNEL_INLINE typename Aff_transformation_repH3::Plane_3 Aff_transformation_repH3:: -transform(const typename Aff_transformation_repH3::Plane_3& pl) const +transform(const typename Aff_transformation_repH3::Plane_3& pl, bool is_even, const typename Aff_transformation_repH3::Aff_transformation_3& transposed_inverse) const { - if ( is_even() ) + if ( is_even ) { return Plane_3( transform(pl.point() ), - transpose().inverse().transform(pl.orthogonal_direction() )); + transposed_inverse.transform(pl.orthogonal_direction() )); } else { return Plane_3( transform(pl.point() ), - -(transpose().inverse().transform(pl.orthogonal_direction() ))); + -(transposed_inverse.transform(pl.orthogonal_direction() ))); } } +template < class R > +CGAL_KERNEL_INLINE +typename Aff_transformation_repH3::Plane_3 +Aff_transformation_repH3:: +transform(const typename Aff_transformation_repH3::Plane_3& pl) const +{ + return transform(pl, is_even(), transpose().inverse()); +} + template < class R > CGAL_KERNEL_INLINE typename Aff_transformation_repH3::Aff_transformation_3 @@ -805,6 +836,15 @@ transform(const typename Translation_repH3::Plane_3& pl) const return Plane_3( transform( pl.point() ), pl.orthogonal_vector() ); } +template < class R > +inline +typename Translation_repH3::Plane_3 +Translation_repH3:: +transform(const typename Translation_repH3::Plane_3& pl, bool, const typename Translation_repH3::Aff_transformation_3&) const +{ + return transform(pl); +} + template < class R > inline typename Translation_repH3::Aff_transformation_3 @@ -1018,6 +1058,13 @@ Aff_transformationH3:: transform(const typename Aff_transformationH3::Plane_3& pl) const { return this->Ptr()->transform(pl); } +template < class R > +inline +typename Aff_transformationH3::Plane_3 +Aff_transformationH3:: +transform(const typename Aff_transformationH3::Plane_3& pl, bool is_even, const typename Aff_transformationH3::Aff_transformation_3& transposed_inverse) const +{ return this->Ptr()->transform(pl, is_even, transposed_inverse); } + template < class R > inline typename Aff_transformationH3::Aff_transformation_3