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/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h $ 00019 // $Id: Iso_rectangleH2.h 49057 2009-04-30 14:03:52Z spion $ 00020 // 00021 // 00022 // Author(s) : Stefan Schirra 00023 00024 #ifndef CGAL_ISO_RECTANGLEH2_H 00025 #define CGAL_ISO_RECTANGLEH2_H 00026 00027 #include <CGAL/array.h> 00028 00029 CGAL_BEGIN_NAMESPACE 00030 00031 template <class R_> 00032 class Iso_rectangleH2 00033 { 00034 typedef typename R_::FT FT; 00035 typedef typename R_::RT RT; 00036 typedef typename R_::Point_2 Point_2; 00037 typedef typename R_::Iso_rectangle_2 Iso_rectangle_2; 00038 00039 typedef cpp0x::array<Point_2, 2> Rep; 00040 typedef typename R_::template Handle<Rep>::type Base; 00041 00042 Base base; 00043 00044 public: 00045 typedef R_ R; 00046 typedef typename Point_2::Rep::Cartesian_coordinate_type Cartesian_coordinate_type; 00047 typedef typename Point_2::Rep::Homogeneous_coordinate_type Homogeneous_coordinate_type; 00048 00049 Iso_rectangleH2() {} 00050 00051 Iso_rectangleH2(const Point_2& p, const Point_2& q, int) 00052 : base(CGAL::make_array(p, q)) 00053 { 00054 // I have to remove the assertions, because of Homogeneous_converter. 00055 // CGAL_kernel_assertion(p.x()<=q.x()); 00056 // CGAL_kernel_assertion(p.y()<=q.y()); 00057 } 00058 00059 const Point_2 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const; 00060 const Point_2 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const; 00061 00062 Bounded_side bounded_side(const Point_2& p) const; 00063 }; 00064 00065 00066 00067 template < class R > 00068 inline 00069 const typename Iso_rectangleH2<R>::Point_2 & 00070 Iso_rectangleH2<R>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const 00071 { return get(base)[0]; } 00072 00073 template < class R > 00074 inline 00075 const typename Iso_rectangleH2<R>::Point_2 & 00076 Iso_rectangleH2<R>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const 00077 { return get(base)[1]; } 00078 00079 template < class R > 00080 CGAL_KERNEL_INLINE 00081 Bounded_side 00082 Iso_rectangleH2<R>:: 00083 bounded_side(const typename Iso_rectangleH2<R>::Point_2& p) const 00084 { 00085 Oriented_side wrt_min = _where_wrt_L_wedge((this->min)(),p); 00086 Oriented_side wrt_max = _where_wrt_L_wedge(p,(this->max)()); 00087 if (( wrt_min == ON_NEGATIVE_SIDE )||( wrt_max == ON_NEGATIVE_SIDE)) 00088 { 00089 return ON_UNBOUNDED_SIDE; 00090 } 00091 if ( ( wrt_min == ON_ORIENTED_BOUNDARY ) 00092 ||( wrt_max == ON_ORIENTED_BOUNDARY ) ) 00093 { 00094 return ON_BOUNDARY; 00095 } 00096 return ON_BOUNDED_SIDE; 00097 } 00098 00099 CGAL_END_NAMESPACE 00100 00101 #endif // CGAL_ISO_RECTANGLEH2_H