BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Plane_separator.h
Go to the documentation of this file.
00001 // Copyright (c) 2002 Utrecht University (The Netherlands).
00002 // All rights reserved.
00003 //
00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under
00005 // the terms of the Q Public License version 1.0.
00006 // See the file LICENSE.QPL distributed with CGAL.
00007 //
00008 // Licensees holding a valid commercial license may use this file in
00009 // accordance with the commercial license agreement provided with the software.
00010 //
00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 //
00014 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Spatial_searching/include/CGAL/Plane_separator.h $
00015 // $Id: Plane_separator.h 28567 2006-02-16 14:30:13Z lsaboret $
00016 // 
00017 //
00018 // Author(s)     : Hans Tangelder (<hanst@cs.uu.nl>)
00019 
00020 #ifndef CGAL_PLANE_SEPARATOR_H
00021 #define CGAL_PLANE_SEPARATOR_H
00022 namespace CGAL {
00023 template < class FT> class Plane_separator {
00024 
00025   public:
00026 
00027   int cutting_dim;
00028   FT cutting_val;
00029 
00030   inline int cutting_dimension() const { return cutting_dim;}
00031   inline FT cutting_value() const { return cutting_val;}
00032 
00033   void set_cutting_dimension(int d) {
00034           cutting_dim=d;
00035   }
00036 
00037   void set_cutting_value(FT val) {
00038           cutting_val=val;
00039   }  
00040 
00041   template <class Point>  
00042   inline bool has_on_negative_side(const Point& i) {
00043     return i[cutting_dimension()] < cutting_value();
00044   }
00045 
00046   Plane_separator(const int d, const FT& v) : 
00047                 cutting_dim(d), cutting_val(v) {}
00048   Plane_separator(const Plane_separator<FT>& s) : 
00049                 cutting_dim(s.cutting_dimension()), 
00050                 cutting_val(s.cutting_value()) {}
00051   explicit Plane_separator() : cutting_dim(0), cutting_val(0) {}
00052   Plane_separator<FT>& operator= (const Plane_separator<FT>& s) {
00053     cutting_dim = s.cutting_dimension();
00054     cutting_val = s.cutting_value();
00055     return *this;
00056   }
00057 
00058   ~Plane_separator() {}
00059 
00060 };
00061 
00062  template < class FT> 
00063  std::ostream& operator<< (std::ostream& s, Plane_separator<FT>& x) {
00064    s << "\n Separator coordinate: " << x.cutting_dimension() <<
00065      " value: " << x.cutting_value() << "\n";
00066    return s;
00067  }
00068 } // namespace CGAL
00069 #endif // CGAL_PLANE_SEPARATOR_H
00070 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines