BWAPI
|
00001 // Copyright (c) 2000 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/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h $ 00019 // $Id: Point_3.h 42834 2008-04-10 14:41:35Z spion $ 00020 // 00021 // 00022 // Author(s) : Andreas Fabri and Herve Bronnimann 00023 00024 #ifndef CGAL_CARTESIAN_POINT_3_H 00025 #define CGAL_CARTESIAN_POINT_3_H 00026 00027 #include <CGAL/Origin.h> 00028 00029 CGAL_BEGIN_NAMESPACE 00030 00031 template < class R_ > 00032 class PointC3 00033 { 00034 typedef typename R_::FT FT; 00035 typedef typename R_::Vector_3 Vector_3; 00036 typedef typename R_::Point_3 Point_3; 00037 typedef typename R_::Aff_transformation_3 Aff_transformation_3; 00038 00039 // We do not use reference counting here as it is done at the Vector_3 level. 00040 Vector_3 base; 00041 00042 public: 00043 typedef typename Vector_3::Cartesian_const_iterator Cartesian_const_iterator; 00044 typedef R_ R; 00045 00046 PointC3() {} 00047 00048 PointC3(const Origin &) 00049 : base(NULL_VECTOR) {} 00050 00051 PointC3(const FT &x, const FT &y, const FT &z) 00052 : base(x, y, z) {} 00053 00054 PointC3(const FT &x, const FT &y, const FT &z, const FT &w) 00055 : base(x, y, z, w) {} 00056 00057 const FT & x() const 00058 { 00059 return base.x(); 00060 } 00061 const FT & y() const 00062 { 00063 return base.y(); 00064 } 00065 const FT & z() const 00066 { 00067 return base.z(); 00068 } 00069 00070 const FT & hx() const 00071 { 00072 return base.hx(); 00073 } 00074 const FT & hy() const 00075 { 00076 return base.hy(); 00077 } 00078 const FT & hz() const 00079 { 00080 return base.hz(); 00081 } 00082 const FT & hw() const 00083 { 00084 return base.hw(); 00085 } 00086 00087 const FT & cartesian(int i) const; 00088 const FT & operator[](int i) const; 00089 const FT & homogeneous(int i) const; 00090 00091 Cartesian_const_iterator cartesian_begin() const 00092 { 00093 return base.cartesian_begin(); 00094 } 00095 00096 Cartesian_const_iterator cartesian_end() const 00097 { 00098 return base.cartesian_end(); 00099 } 00100 00101 int dimension() const 00102 { 00103 return base.dimension(); 00104 } 00105 00106 Point_3 transform(const Aff_transformation_3 &t) const 00107 { 00108 return t.transform(*this); 00109 } 00110 }; 00111 00112 template < class R > 00113 inline 00114 const typename PointC3<R>::FT & 00115 PointC3<R>::cartesian(int i) const 00116 { 00117 return base.cartesian(i); 00118 } 00119 00120 template < class R > 00121 inline 00122 const typename PointC3<R>::FT & 00123 PointC3<R>::operator[](int i) const 00124 { 00125 return base[i]; 00126 } 00127 00128 template < class R > 00129 inline 00130 const typename PointC3<R>::FT & 00131 PointC3<R>::homogeneous(int i) const 00132 { 00133 return base.homogeneous(i); 00134 } 00135 00136 CGAL_END_NAMESPACE 00137 00138 #endif // CGAL_CARTESIAN_POINT_3_H