1 // Copyright (c) 1999
2 // Utrecht University (The Netherlands),
3 // ETH Zurich (Switzerland),
4 // INRIA Sophia-Antipolis (France),
5 // Max-Planck-Institute Saarbruecken (Germany),
6 // and Tel-Aviv University (Israel).  All rights reserved.
7 //
8 // This file is part of CGAL (www.cgal.org)
9 //
10 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Kernel_23/include/CGAL/Aff_transformation_2.h $
11 // $Id: Aff_transformation_2.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot
12 // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
13 //
14 // Author(s)     : Andreas Fabri, Stefan Schirra
15 
16 #ifndef CGAL_AFF_TRANSFORMATION_2_H
17 #define CGAL_AFF_TRANSFORMATION_2_H
18 
19 #include <CGAL/config.h>
20 #include <CGAL/Dimension.h>
21 #include <CGAL/aff_transformation_tags.h>
22 
23 namespace CGAL {
24 
25 template <class R_>
26 class Aff_transformation_2 : public R_::Kernel_base::Aff_transformation_2
27 {
28   typedef typename R_::RT                    RT;
29   typedef typename R_::FT                    FT;
30   typedef typename R_::Line_2                Line_2;
31   typedef typename R_::Direction_2           Direction_2;
32   typedef typename R_::Vector_2              Vector_2;
33   typedef typename R_::Kernel_base::Aff_transformation_2 RAff_transformation_2;
34 public:
35 
36   typedef CGAL::Dimension_tag<2>            Ambient_dimension;
37 
38   typedef  R_                               R;
39 
Aff_transformation_2()40   Aff_transformation_2() {}
41 
Aff_transformation_2(const RAff_transformation_2 & t)42   Aff_transformation_2(const RAff_transformation_2& t)
43     : RAff_transformation_2(t)
44   {}
45 
Aff_transformation_2(const Identity_transformation tag)46   Aff_transformation_2(const Identity_transformation tag)
47     : RAff_transformation_2(tag)
48   {}
49 
Aff_transformation_2(const Translation tag,const Vector_2 & v)50   Aff_transformation_2(const Translation tag, const Vector_2 &v)
51     : RAff_transformation_2(tag, v)
52   {}
53 
54   // Rational Rotation:
55   Aff_transformation_2(const Rotation tag,
56                        const Direction_2 &d,
57                        const RT &num,
58                        const RT &den = RT(1))
RAff_transformation_2(tag,d,num,den)59     : RAff_transformation_2(tag, d, num, den)
60   {}
61 
62   Aff_transformation_2(const Rotation tag,
63                        const RT &sin,
64                        const RT &cos,
65                        const RT &den = RT(1))
RAff_transformation_2(tag,sin,cos,den)66     : RAff_transformation_2(tag, sin, cos, den)
67   {}
68 
Aff_transformation_2(const Reflection tag,const Line_2 & l)69   Aff_transformation_2(const Reflection tag, const Line_2& l )
70     : RAff_transformation_2(tag, l)
71   {}
72 
73   Aff_transformation_2(const Scaling tag,
74                        const RT &s,
75                        const RT &w= RT(1))
RAff_transformation_2(tag,s,w)76     : RAff_transformation_2(tag, s, w)
77   {}
78 
79   // The general case:
80   Aff_transformation_2(const RT & m11,
81                        const RT & m12,
82                        const RT & m13,
83 
84                        const RT & m21,
85                        const RT & m22,
86                        const RT & m23,
87 
88                        const RT &w= RT(1))
RAff_transformation_2(m11,m12,m13,m21,m22,m23,w)89     : RAff_transformation_2(m11, m12, m13,
90                             m21, m22, m23,
91                                       w)
92   {}
93 
94   Aff_transformation_2(const RT & m11, const RT & m12,
95                        const RT & m21, const RT & m22,
96                        const RT &w = RT(1))
RAff_transformation_2(m11,m12,m21,m22,w)97     : RAff_transformation_2(m11, m12,
98                             m21, m22,
99                                       w)
100   {}
101 };
102 
103 #ifndef CGAL_NO_OSTREAM_INSERT_AFF_TRANSFORMATION_2
104 template < class R >
105 std::ostream &
106 operator<<(std::ostream &os, const CGAL::Aff_transformation_2<R> &t)
107 {
108   typedef typename R::Kernel_base::Aff_transformation_2  RAff_transformation_2;
109   return os << static_cast<const RAff_transformation_2&>(t);
110 }
111 #endif // CGAL_NO_OSTREAM_INSERT_AFF_TRANSFORMATION_2
112 
113 #ifndef CGAL_NO_ISTREAM_EXTRACT_AFF_TRANSFORMATION_2
114 template < class R >
115 std::istream &
116 operator>>(std::istream &is, CGAL::Aff_transformation_2<R> &t)
117 {
118   typedef typename R::Kernel_base::Aff_transformation_2  RAff_transformation_2;
119   return is >> static_cast<RAff_transformation_2&>(t);
120 }
121 #endif // CGAL_NO_ISTREAM_EXTRACT_AFF_TRANSFORMATION_2
122 
123 } //namespace CGAL
124 
125 #endif // CGAL_AFF_TRANSFORMATION_2_H
126