BWAPI
|
00001 // Copyright (c) 1999 Utrecht University (The Netherlands), 00002 // ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), 00003 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg 00004 // (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), 00005 // and Tel-Aviv University (Israel). All rights reserved. 00006 // 00007 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00008 // modify it under the terms of the GNU Lesser General Public License as 00009 // published by the Free Software Foundation; version 2.1 of the License. 00010 // See the file LICENSE.LGPL distributed with CGAL. 00011 // 00012 // Licensees holding a valid commercial license may use this file in 00013 // accordance with the commercial license agreement provided with the software. 00014 // 00015 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 // 00018 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Kernel_23/include/CGAL/Aff_transformation_2.h $ 00019 // $Id: Aff_transformation_2.h 42932 2008-04-17 10:13:31Z spion $ 00020 // 00021 // Author(s) : Andreas Fabri, Stefan Schirra 00022 00023 #ifndef CGAL_AFF_TRANSFORMATION_2_H 00024 #define CGAL_AFF_TRANSFORMATION_2_H 00025 00026 #include <CGAL/basic.h> 00027 #include <CGAL/Dimension.h> 00028 00029 CGAL_BEGIN_NAMESPACE 00030 00031 template <class R_> 00032 class Aff_transformation_2 : public R_::Kernel_base::Aff_transformation_2 00033 { 00034 typedef typename R_::RT RT; 00035 typedef typename R_::FT FT; 00036 typedef typename R_::Line_2 Line_2; 00037 typedef typename R_::Direction_2 Direction_2; 00038 typedef typename R_::Vector_2 Vector_2; 00039 typedef typename R_::Kernel_base::Aff_transformation_2 RAff_transformation_2; 00040 public: 00041 00042 typedef CGAL::Dimension_tag<2> Ambient_dimension; 00043 00044 typedef R_ R; 00045 00046 Aff_transformation_2() {} 00047 00048 Aff_transformation_2(const RAff_transformation_2& t) 00049 : RAff_transformation_2(t) 00050 {} 00051 00052 Aff_transformation_2(const Identity_transformation tag) 00053 : RAff_transformation_2(tag) 00054 {} 00055 00056 Aff_transformation_2(const Translation tag, const Vector_2 &v) 00057 : RAff_transformation_2(tag, v) 00058 {} 00059 00060 // Rational Rotation: 00061 Aff_transformation_2(const Rotation tag, 00062 const Direction_2 &d, 00063 const RT &num, 00064 const RT &den = RT(1)) 00065 : RAff_transformation_2(tag, d, num, den) 00066 {} 00067 00068 Aff_transformation_2(const Rotation tag, 00069 const RT &sin, 00070 const RT &cos, 00071 const RT &den = RT(1)) 00072 : RAff_transformation_2(tag, sin, cos, den) 00073 {} 00074 00075 Aff_transformation_2(const Reflection tag, const Line_2& l ) 00076 : RAff_transformation_2(tag, l) 00077 {} 00078 00079 Aff_transformation_2(const Scaling tag, 00080 const RT &s, 00081 const RT &w= RT(1)) 00082 : RAff_transformation_2(tag, s, w) 00083 {} 00084 00085 // The general case: 00086 Aff_transformation_2(const RT & m11, 00087 const RT & m12, 00088 const RT & m13, 00089 00090 const RT & m21, 00091 const RT & m22, 00092 const RT & m23, 00093 00094 const RT &w= RT(1)) 00095 : RAff_transformation_2(m11, m12, m13, 00096 m21, m22, m23, 00097 w) 00098 {} 00099 00100 Aff_transformation_2(const RT & m11, const RT & m12, 00101 const RT & m21, const RT & m22, 00102 const RT &w = RT(1)) 00103 : RAff_transformation_2(m11, m12, 00104 m21, m22, 00105 w) 00106 {} 00107 }; 00108 00109 #ifndef CGAL_NO_OSTREAM_INSERT_AFF_TRANSFORMATION_2 00110 template < class R > 00111 std::ostream & 00112 operator<<(std::ostream &os, const CGAL::Aff_transformation_2<R> &t) 00113 { 00114 typedef typename R::Kernel_base::Aff_transformation_2 RAff_transformation_2; 00115 return os << static_cast<const RAff_transformation_2&>(t); 00116 } 00117 #endif // CGAL_NO_OSTREAM_INSERT_AFF_TRANSFORMATION_2 00118 00119 #ifndef CGAL_NO_ISTREAM_EXTRACT_AFF_TRANSFORMATION_2 00120 template < class R > 00121 std::istream & 00122 operator>>(std::istream &is, CGAL::Aff_transformation_2<R> &t) 00123 { 00124 typedef typename R::Kernel_base::Aff_transformation_2 RAff_transformation_2; 00125 return is >> static_cast<RAff_transformation_2&>(t); 00126 } 00127 #endif // CGAL_NO_ISTREAM_EXTRACT_AFF_TRANSFORMATION_2 00128 00129 CGAL_END_NAMESPACE 00130 00131 #endif // CGAL_AFF_TRANSFORMATION_2_H