BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Homogeneous/predicates_on_pointsH3.h
Go to the documentation of this file.
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/predicates_on_pointsH3.h $
00019 // $Id: predicates_on_pointsH3.h 29102 2006-03-06 23:51:27Z spion $
00020 // 
00021 //
00022 // Author(s)     : Stefan Schirra
00023  
00024 
00025 #ifndef CGAL_PREDICATES_ON_POINTSH3_H
00026 #define CGAL_PREDICATES_ON_POINTSH3_H
00027 
00028 #include <CGAL/Homogeneous/PointH3.h>
00029 
00030 CGAL_BEGIN_NAMESPACE
00031 
00032 template < class R >
00033 CGAL_KERNEL_MEDIUM_INLINE
00034 bool lexicographically_xy_smaller(const PointH3<R> &p,
00035                                   const PointH3<R> &q)
00036 {
00037   typedef typename R::RT RT;
00038   RT pV = p.hx()*q.hw();
00039   RT qV = q.hx()*p.hw();
00040   if ( pV < qV )
00041   {
00042       return true;
00043   }
00044   if ( qV < pV )
00045   {
00046       return false;
00047   }
00048   // same x
00049   pV = p.hy()*q.hw();
00050   qV = q.hy()*p.hw();
00051   if ( pV < qV )
00052   {
00053       return true;
00054   }
00055   return false;
00056 }
00057 
00058 template < class R>
00059 CGAL_KERNEL_MEDIUM_INLINE
00060 Comparison_result
00061 compare_xy(const PointH3<R>& p, const PointH3<R>& q)
00062 {
00063   typedef typename R::RT RT;
00064   RT pV = p.hx()*q.hw();
00065   RT qV = q.hx()*p.hw();
00066   if ( pV < qV )
00067   {
00068       return SMALLER;
00069   }
00070   if ( qV < pV )    //   ( pV > qV )
00071   {
00072       return LARGER;
00073   }
00074   // same x
00075   pV = p.hy()*q.hw();
00076   qV = q.hy()*p.hw();
00077   if ( pV < qV )
00078   {
00079       return SMALLER;
00080   }
00081   if ( qV < pV )    //   ( pV > qV )
00082   {
00083       return LARGER;
00084   }
00085   // same x and y
00086   return EQUAL;
00087 }
00088 
00089 template < class R >
00090 CGAL_KERNEL_INLINE
00091 bool
00092 equal_xy(const PointH3<R> &p, const PointH3<R> &q)
00093 {
00094   return   (p.hx() * q.hw() == q.hx() * p.hw() )
00095         && (p.hy() * q.hw() == q.hy() * p.hw() );
00096 }
00097 
00098 template < class R >  // ???  ->   ==
00099 CGAL_KERNEL_INLINE
00100 bool
00101 equal_xyz(const PointH3<R> &p, const PointH3<R> &q)
00102 {
00103   return   (p.hx() * q.hw() == q.hx() * p.hw() )
00104         && (p.hy() * q.hw() == q.hy() * p.hw() )
00105         && (p.hz() * q.hw() == q.hz() * p.hw() );
00106 }
00107 
00108 template < class R >
00109 CGAL_KERNEL_INLINE
00110 bool
00111 less_x(const PointH3<R> &p, const PointH3<R> &q)
00112 { return   (p.hx() * q.hw() < q.hx() * p.hw() ); }
00113 
00114 
00115 template < class R >
00116 CGAL_KERNEL_INLINE
00117 bool
00118 less_y(const PointH3<R> &p, const PointH3<R> &q)
00119 { return   (p.hy() * q.hw() < q.hy() * p.hw() ); }
00120 
00121 template < class R >
00122 CGAL_KERNEL_INLINE
00123 bool
00124 less_z(const PointH3<R> &p, const PointH3<R> &q)
00125 { return   (p.hz() * q.hw() < q.hz() * p.hw() ); }
00126 
00127 CGAL_END_NAMESPACE
00128 
00129 #endif // CGAL_PREDICATES_ON_POINTSH3_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines