BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Homogeneous/predicates_on_pointsH2.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_pointsH2.h $
00019 // $Id: predicates_on_pointsH2.h 32839 2006-07-31 16:22:08Z spion $
00020 // 
00021 //
00022 // Author(s)     : Stefan Schirra
00023  
00024 
00025 #ifndef CGAL_PREDICATES_ON_POINTSH2_H
00026 #define CGAL_PREDICATES_ON_POINTSH2_H
00027 
00028 #include <CGAL/Homogeneous/PointH2.h>
00029 
00030 CGAL_BEGIN_NAMESPACE
00031 
00032 template < class R>
00033 CGAL_KERNEL_INLINE
00034 bool
00035 equal_xy(const PointH2<R>& p,
00036          const PointH2<R>& q)
00037 {
00038   typedef typename R::RT RT;
00039 
00040   // Using these references allows to spare calls to [pq].hw().
00041   const RT& phw = p.hw();
00042   const RT& qhw = q.hw();
00043 
00044   return (p.hx()*qhw == q.hx()*phw) && (p.hy()*qhw == q.hy()*phw);
00045 }
00046 
00047 template <class R>
00048 CGAL_KERNEL_MEDIUM_INLINE
00049 Oriented_side
00050 _where_wrt_L_wedge( const PointH2<R>& p, const PointH2<R>& q )
00051 {
00052   Sign xs = CGAL_NTS sign( q.hx()*p.hw() - p.hx()*q.hw() );  // sign( qx - px )
00053   Sign ys = CGAL_NTS sign( q.hy()*p.hw() - p.hy()*q.hw() );  // sign( qy - py )
00054 
00055   if (( xs == NEGATIVE ) || ( ys == NEGATIVE ))
00056       return ON_NEGATIVE_SIDE;
00057   if (( xs == POSITIVE ) && ( ys == POSITIVE ))
00058       return ON_POSITIVE_SIDE;
00059   return ON_ORIENTED_BOUNDARY;
00060 }
00061 
00062 #if 0
00063 // Unused, undocumented, un-functorized.
00064 template < class R >
00065 CGAL_KERNEL_MEDIUM_INLINE
00066 Comparison_result
00067 compare_deltax_deltay(const PointH2<R>& p,
00068                       const PointH2<R>& q,
00069                       const PointH2<R>& r,
00070                       const PointH2<R>& s)
00071 {
00072   return CGAL_NTS compare(
00073                   CGAL_NTS abs(p.hx()*q.hw() - q.hx()*p.hw()) * r.hw()*s.hw(),
00074                   CGAL_NTS abs(r.hy()*s.hw() - s.hy()*r.hw()) * p.hw()*q.hw());
00075 }
00076 #endif
00077 
00078 CGAL_END_NAMESPACE
00079 
00080 #endif // CGAL_PREDICATES_ON_POINTSH2_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines