BWAPI
|
00001 // Copyright (c) 2005,2008 INRIA Sophia-Antipolis (France). 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License as 00006 // published by the Free Software Foundation; version 2.1 of the License. 00007 // See the file LICENSE.LGPL distributed with CGAL. 00008 // 00009 // Licensees holding a valid commercial license may use this file in 00010 // accordance with the commercial license agreement provided with the software. 00011 // 00012 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00013 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00014 // 00015 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Kernel_23/include/CGAL/Kernel/Dimension_utils.h $ 00016 // $Id: Dimension_utils.h 42943 2008-04-17 14:43:41Z spion $ 00017 // 00018 // Author(s) : Sylvain Pion 00019 00020 #ifndef CGAL_KERNEL_DIMENSION_UTILS_H 00021 #define CGAL_KERNEL_DIMENSION_UTILS_H 00022 00023 #include <CGAL/Kernel_traits.h> 00024 #include <CGAL/Dimension.h> 00025 00026 CGAL_BEGIN_NAMESPACE 00027 00028 namespace Access { 00029 00030 // Some tools to find the type of a kernel object given its dimension. 00031 // E.g. : Vector<K, 2>::type is K::Vector_2. 00032 // 00033 // Currently undocumented => for CGAL internal use only. 00034 00035 // TODO : 00036 // - What about functors ? 00037 // At least those with a dimensional-independent interface. 00038 // - Another thing which would be nice would be to make d-dimensional 00039 // algorithms use the 2d-3d kernel interface with a smaller wrapper. 00040 // (again, this forces a full kernel, not a sub-set traits, but at least...) 00041 // Then, based on Dimension<>, it's possible to automatically use it. 00042 00043 template < typename K, typename Dim_tag = typename K::Dimension> struct Point; 00044 template < typename K, typename Dim_tag = typename K::Dimension> struct Vector; 00045 template < typename K, typename Dim_tag = typename K::Dimension> struct Iso_box; 00046 template < typename K, typename Dim_tag = typename K::Dimension> struct Direction; 00047 template < typename K, typename Dim_tag = typename K::Dimension> struct Line; 00048 template < typename K, typename Dim_tag = typename K::Dimension> struct Ray; 00049 template < typename K, typename Dim_tag = typename K::Dimension> struct Segment; 00050 template < typename K, typename Dim_tag = typename K::Dimension> struct Triangle; 00051 template < typename K, typename Dim_tag = typename K::Dimension> struct Hypersphere; 00052 template < typename K, typename Dim_tag = typename K::Dimension> struct Hyperplane; 00053 template < typename K, typename Dim_tag = typename K::Dimension> struct Aff_transformation; 00054 00055 // Not-so generalizable stuff : Conic_2, Tetrahedron_3. 00056 template < typename K, typename Dim_tag = typename K::Dimension> struct Tetrahedron; 00057 00058 00059 template < typename K > 00060 struct Point <K, Dimension_tag<2> > { typedef typename K::Point_2 type; }; 00061 00062 template < typename K > 00063 struct Point <K, Dimension_tag<3> > { typedef typename K::Point_3 type; }; 00064 00065 template < typename K > 00066 struct Point <K, Dynamic_dimension_tag> { typedef typename K::Point_d type; }; 00067 00068 00069 template < typename K > 00070 struct Vector <K, Dimension_tag<2> > { typedef typename K::Vector_2 type; }; 00071 00072 template < typename K > 00073 struct Vector <K, Dimension_tag<3> > { typedef typename K::Vector_3 type; }; 00074 00075 template < typename K > 00076 struct Vector <K, Dynamic_dimension_tag> { typedef typename K::Vector_d type; }; 00077 00078 00079 template < typename K > 00080 struct Iso_box <K, Dimension_tag<2> > { typedef typename K::Iso_rectangle_2 type; }; 00081 00082 template < typename K > 00083 struct Iso_box <K, Dimension_tag<3> > { typedef typename K::Iso_cuboid_3 type; }; 00084 00085 template < typename K > 00086 struct Iso_box <K, Dynamic_dimension_tag> { typedef typename K::Iso_box_d type; }; 00087 00088 00089 template < typename K > 00090 struct Direction <K, Dimension_tag<2> > { typedef typename K::Direction_2 type; }; 00091 00092 template < typename K > 00093 struct Direction <K, Dimension_tag<3> > { typedef typename K::Direction_3 type; }; 00094 00095 template < typename K > 00096 struct Direction <K, Dynamic_dimension_tag> { typedef typename K::Direction_d type; }; 00097 00098 00099 template < typename K > 00100 struct Line <K, Dimension_tag<2> > { typedef typename K::Line_2 type; }; 00101 00102 template < typename K > 00103 struct Line <K, Dimension_tag<3> > { typedef typename K::Line_3 type; }; 00104 00105 template < typename K > 00106 struct Line <K, Dynamic_dimension_tag> { typedef typename K::Line_d type; }; 00107 00108 00109 template < typename K > 00110 struct Ray <K, Dimension_tag<2> > { typedef typename K::Ray_2 type; }; 00111 00112 template < typename K > 00113 struct Ray <K, Dimension_tag<3> > { typedef typename K::Ray_3 type; }; 00114 00115 template < typename K > 00116 struct Ray <K, Dynamic_dimension_tag> { typedef typename K::Ray_d type; }; 00117 00118 00119 template < typename K > 00120 struct Segment <K, Dimension_tag<2> > { typedef typename K::Segment_2 type; }; 00121 00122 template < typename K > 00123 struct Segment <K, Dimension_tag<3> > { typedef typename K::Segment_3 type; }; 00124 00125 template < typename K > 00126 struct Segment <K, Dynamic_dimension_tag> { typedef typename K::Segment_d type; }; 00127 00128 00129 template < typename K > 00130 struct Triangle <K, Dimension_tag<2> > { typedef typename K::Triangle_2 type; }; 00131 00132 template < typename K > 00133 struct Triangle <K, Dimension_tag<3> > { typedef typename K::Triangle_3 type; }; 00134 00135 template < typename K > 00136 struct Triangle <K, Dynamic_dimension_tag> { typedef typename K::Triangle_d type; }; 00137 00138 00139 template < typename K > 00140 struct Tetrahedron <K, Dimension_tag<3> > { typedef typename K::Tetrahedron_3 type; }; 00141 00142 template < typename K > 00143 struct Tetrahedron <K, Dynamic_dimension_tag> { typedef typename K::Tetrahedron_d type; }; 00144 00145 00146 template < typename K > 00147 struct Hypersphere <K, Dimension_tag<2> > { typedef typename K::Circle_2 type; }; 00148 00149 template < typename K > 00150 struct Hypersphere <K, Dimension_tag<3> > { typedef typename K::Sphere_3 type; }; 00151 00152 template < typename K > 00153 struct Hypersphere <K, Dynamic_dimension_tag> { typedef typename K::Sphere_d type; }; 00154 00155 00156 template < typename K > 00157 struct Hyperplane <K, Dimension_tag<2> > { typedef typename K::Line_2 type; }; 00158 00159 template < typename K > 00160 struct Hyperplane <K, Dimension_tag<3> > { typedef typename K::Plane_3 type; }; 00161 00162 template < typename K > 00163 struct Hyperplane <K, Dynamic_dimension_tag> { typedef typename K::Hyperplane_d type; }; 00164 00165 00166 template < typename K > 00167 struct Aff_transformation <K, Dimension_tag<2> > 00168 { typedef typename K::Aff_transformation_2 type; }; 00169 00170 template < typename K > 00171 struct Aff_transformation <K, Dimension_tag<3> > 00172 { typedef typename K::Aff_transformation_3 type; }; 00173 00174 template < typename K > 00175 struct Aff_transformation <K, Dynamic_dimension_tag> 00176 { typedef typename K::Aff_transformation_d type; }; 00177 00178 } // namespace Access 00179 00180 CGAL_END_NAMESPACE 00181 00182 #endif // CGAL_KERNEL_DIMENSION_UTILS_H