|
BWAPI
|
00001 // Copyright (c) 2003,2004,2005,2006 INRIA Sophia-Antipolis (France) and 00002 // Notre Dame University (U.S.A.). 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/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_parallel_C2.h $ 00015 // $Id: Are_parallel_C2.h 45156 2008-08-26 13:40:26Z spion $ 00016 // 00017 // 00018 // Author(s) : Menelaos Karavelas <mkaravel@cse.nd.edu> 00019 00020 #ifndef CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARE_PARALLEL_C2_H 00021 #define CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARE_PARALLEL_C2_H 00022 00023 #include <CGAL/Segment_Delaunay_graph_2/basic.h> 00024 #include <CGAL/determinant.h> 00025 00026 CGAL_BEGIN_NAMESPACE 00027 00028 CGAL_SEGMENT_DELAUNAY_GRAPH_2_BEGIN_NAMESPACE 00029 00030 //----------------------------------------------------------------------- 00031 // are parallel 00032 //----------------------------------------------------------------------- 00033 00034 template< class K > 00035 class Are_parallel_C2 00036 { 00037 00038 public: 00039 typedef typename K::Site_2 Site_2; 00040 typedef typename K::Boolean Boolean; 00041 typedef Boolean result_type; 00042 typedef Site_2 argument_type; 00043 00044 private: 00045 typedef typename K::Segment_2 Segment_2; 00046 typedef typename K::FT FT; 00047 00048 private: 00049 Boolean predicate(const Site_2& p, const Site_2& q) const { 00050 CGAL_precondition( p.is_segment() && q.is_segment() ); 00051 00052 Segment_2 s1 = p.segment(); 00053 Segment_2 s2 = q.segment(); 00054 00055 FT x1 = s1.source().x(), 00056 y1 = s1.source().y(), 00057 x2 = s1.target().x(), 00058 y2 = s1.target().y(), 00059 x3 = s2.source().x(), 00060 y3 = s2.source().y(), 00061 x4 = s2.target().x(), 00062 y4 = s2.target().y(); 00063 00064 FT det = determinant(x2 - x1, x4 - x3, 00065 y2 - y1, y4 - y3); 00066 00067 return ( CGAL::sign(det) == CGAL::ZERO ); 00068 } 00069 00070 public: 00071 result_type operator()(const Site_2& p, const Site_2& q) const 00072 { 00073 return predicate(p, q); 00074 } 00075 }; 00076 00077 CGAL_SEGMENT_DELAUNAY_GRAPH_2_END_NAMESPACE 00078 00079 CGAL_END_NAMESPACE 00080 00081 00082 #endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARE_PARALLEL_C2_H 00083
1.7.6.1