BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Static_filters.h
Go to the documentation of this file.
00001 // Copyright (c) 2001,2004  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/Filtered_kernel/include/CGAL/Static_filters.h $
00016 // $Id: Static_filters.h 35070 2006-11-06 17:12:11Z spion $
00017 // 
00018 //
00019 // Author(s)     : Sylvain Pion
00020  
00021 #ifndef CGAL_STATIC_FILTERS_H
00022 #define CGAL_STATIC_FILTERS_H
00023 
00024 // This kernel wrapper gathers optimized predicates written by hand, using
00025 // a few steps of filtering.  It should work if the initial traits has
00026 // cartesian coordinates which fit exactly in doubles.
00027 //
00028 // Purely static filters code has been removed, since it requires additional
00029 // logic and is not plug'n play (requires users providing bounds).
00030 // If it should be provided again, it should probably be separate.
00031 
00032 #include <CGAL/basic.h>
00033 
00034 #include <CGAL/Kernel/function_objects.h>
00035 #include <CGAL/Cartesian/function_objects.h>
00036 
00037 #include <CGAL/Static_filters/tools.h>
00038 #include <CGAL/Static_filters/Orientation_2.h>
00039 #include <CGAL/Static_filters/Orientation_3.h>
00040 #include <CGAL/Static_filters/Compare_y_at_x_2.h>
00041 #include <CGAL/Static_filters/Side_of_oriented_circle_2.h>
00042 #include <CGAL/Static_filters/Side_of_oriented_sphere_3.h>
00043 
00044 // #include <CGAL/Static_filters/Coplanar_orientation_3.h>
00045 // #include <CGAL/Static_filters/Coplanar_side_of_bounded_circle_3.h>
00046 
00047 // TODO :
00048 // - add more predicates :
00049 //   - all lexicographical comparisons
00050 //   - left_turn (via generic adapter to orientation)
00051 //   - power_tests
00052 //   - others ?
00053 // - benchmark on more algorithms.
00054 // - improve fit_in_double() for other NTs (MP_Float, Lazy). cf tools.h.
00055 // - try to automatize : have a struct a la Static_filter_error, with one part
00056 //   which is runtime, and the other which can be constant-propagated by the
00057 //   compiler.  g++ 4.0 should be able to cprop the second part...
00058 
00059 
00060 CGAL_BEGIN_NAMESPACE
00061 
00062 // The K_base argument is supposed to provide exact primitives.
00063 template < typename K_base >
00064 class Static_filters : public K_base
00065 {
00066   typedef Static_filters<K_base>                    Self;
00067 
00068 public:
00069 
00070   typedef SF_Compare_y_at_x_2<K_base,Self>          Compare_y_at_x_2;
00071   typedef SF_Orientation_2<K_base>                  Orientation_2;
00072   typedef SF_Orientation_3<K_base>                  Orientation_3;
00073   typedef SF_Side_of_oriented_circle_2<K_base>      Side_of_oriented_circle_2;
00074   typedef SF_Side_of_oriented_sphere_3<K_base>      Side_of_oriented_sphere_3;
00075 
00076   // The following do not require filtering as they only do
00077   // comparisons.  We must be careful that *all* their function
00078   // operators must not do any comparisons.
00079   // In case we would like to avoid filtering only some of
00080   // the function operators, we need to make a new functors.
00081   typedef CommonKernelFunctors::Left_turn_2<Self>   Left_turn_2;
00082 
00083   typedef CartesianKernelFunctors::Less_x_2<Self>   Less_x_2;
00084   typedef CartesianKernelFunctors::Less_y_2<Self>   Less_y_2;
00085   typedef CartesianKernelFunctors::Less_xy_2<Self>  Less_xy_2;
00086   typedef CartesianKernelFunctors::Less_yx_2<Self>  Less_yx_2;
00087 
00088   typedef CartesianKernelFunctors::Less_x_3<Self>   Less_x_3;
00089   typedef CartesianKernelFunctors::Less_y_3<Self>   Less_y_3;
00090   typedef CartesianKernelFunctors::Less_z_3<Self>   Less_z_3;
00091   typedef CartesianKernelFunctors::Less_xy_3<Self>  Less_xy_3;
00092   typedef CartesianKernelFunctors::Less_xyz_3<Self> Less_xyz_3;
00093 
00094   typedef CartesianKernelFunctors::Compare_xy_2<Self>  Compare_xy_2;
00095   typedef CartesianKernelFunctors::Compare_x_3<Self>   Compare_x_3;
00096   typedef CartesianKernelFunctors::Compare_y_3<Self>   Compare_y_3;
00097   typedef CartesianKernelFunctors::Compare_z_3<Self>   Compare_z_3;
00098   typedef CartesianKernelFunctors::Compare_xy_3<Self>  Compare_xy_3;
00099   typedef CartesianKernelFunctors::Compare_xyz_3<Self> Compare_xyz_3;
00100 
00101   Compare_xy_2
00102   compare_xy_2_object() const
00103   { return Compare_xy_2(); }
00104 
00105   Compare_x_3
00106   compare_x_3_object() const
00107   { return Compare_x_3(); }
00108 
00109   Compare_y_3
00110   compare_y_3_object() const
00111   { return Compare_y_3(); }
00112 
00113   Compare_z_3
00114   compare_z_3_object() const
00115   { return Compare_z_3(); }
00116 
00117   Compare_xy_3
00118   compare_xy_3_object() const
00119   { return Compare_xy_3(); }
00120 
00121   Compare_xyz_3
00122   compare_xyz_3_object() const
00123   { return Compare_xyz_3(); }
00124 
00125   Left_turn_2
00126   left_turn_2_object() const
00127   { return Left_turn_2(); }
00128 
00129   Less_x_2
00130   less_x_2_object() const
00131   { return Less_x_2(); }
00132 
00133   Less_y_2
00134   less_y_2_object() const
00135   { return Less_y_2(); }
00136 
00137   Less_xy_2
00138   less_xy_2_object() const
00139   { return Less_xy_2(); }
00140 
00141   Less_yx_2
00142   less_yx_2_object() const
00143   { return Less_yx_2(); }
00144 
00145   Less_x_3
00146   less_x_3_object() const
00147   { return Less_x_3(); }
00148 
00149   Less_y_3
00150   less_y_3_object() const
00151   { return Less_y_3(); }
00152 
00153   Less_z_3
00154   less_z_3_object() const
00155   { return Less_z_3(); }
00156 
00157   Less_xy_3
00158   less_xy_3_object() const
00159   { return Less_xy_3(); }
00160 
00161   Less_xyz_3
00162   less_xyz_3_object() const
00163   { return Less_xyz_3(); }
00164 
00165   Compare_y_at_x_2
00166   compare_y_at_x_2_object() const
00167   { return Compare_y_at_x_2(); }
00168 
00169   Orientation_2
00170   orientation_2_object() const
00171   { return Orientation_2(); }
00172 
00173   Orientation_3
00174   orientation_3_object() const
00175   { return Orientation_3(); }
00176 
00177   Side_of_oriented_circle_2
00178   side_of_oriented_circle_2_object() const
00179   { return Side_of_oriented_circle_2(); }
00180 
00181   Side_of_oriented_sphere_3
00182   side_of_oriented_sphere_3_object() const
00183   { return Side_of_oriented_sphere_3(); }
00184 
00185   // The two following are for degenerate cases, so I'll update them later.
00186   //
00187   // typedef SF_Coplanar_orientation_3<Point_3, Orientation_2>
00188   //                                                   Coplanar_orientation_3;
00189   // typedef SF_Side_of_bounded_circle_3<Point_3>
00190   //                                         Coplanar_side_of_bounded_circle_3;
00191 
00192   // Coplanar_orientation_3
00193   // coplanar_orientation_3_object() const
00194   // { return Coplanar_orientation_3(); }
00195 
00196   // Coplanar_side_of_bounded_circle_3
00197   // coplanar_side_of_bounded_circle_3_object() const
00198   // { return Coplanar_side_of_bounded_circle_3(); }
00199 };
00200 
00201 CGAL_END_NAMESPACE
00202 
00203 #endif // CGAL_STATIC_FILTERS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines