|
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/Infinite_edge_interior_conflict_C2.h $ 00015 // $Id: Infinite_edge_interior_conflict_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_INFINITE_EDGE_INTERIOR_CONFLICT_C2_H 00021 #define CGAL_SEGMENT_DELAUNAY_GRAPH_2_INFINITE_EDGE_INTERIOR_CONFLICT_C2_H 00022 00023 #include <CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h> 00024 #include <CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_C2.h> 00025 #include <CGAL/Segment_Delaunay_graph_2/Are_same_points_C2.h> 00026 #include <CGAL/Segment_Delaunay_graph_2/Are_same_segments_C2.h> 00027 00028 CGAL_BEGIN_NAMESPACE 00029 00030 CGAL_SEGMENT_DELAUNAY_GRAPH_2_BEGIN_NAMESPACE 00031 00032 //----------------------------------------------------------------------------- 00033 00034 template<class K, class Method_tag> 00035 class Infinite_edge_interior_conflict_C2 00036 { 00037 public: 00038 typedef typename K::Site_2 Site_2; 00039 typedef typename K::RT RT; 00040 typedef typename K::Boolean Boolean; 00041 typedef Are_same_points_C2<K> Are_same_points_2; 00042 typedef Are_same_segments_C2<K> Are_same_segments_2; 00043 00044 typedef Boolean result_type; 00045 struct argument_type {}; 00046 00047 private: 00048 Are_same_points_2 same_points; 00049 Are_same_segments_2 same_segments; 00050 00051 public: 00052 Boolean operator()(const Site_2& q, const Site_2& s, const Site_2& r, 00053 const Site_2& t, Sign sgn) const 00054 { 00055 if ( t.is_segment() ) { 00056 return false; 00057 } 00058 00059 if ( q.is_segment() ) { 00060 // in this case r and s must be endpoints of q 00061 return ( sgn == NEGATIVE ); 00062 } 00063 00064 if ( s.is_point() && r.is_point() && same_points(s, r) ) { 00065 // MK::ERROR: write this code using the compare_x_2 and 00066 // compare_y_2 predicates instead of computing the inner 00067 // product... 00068 RT dtsx = s.point().x() - t.point().x(); 00069 RT dtsy = s.point().y() - t.point().y(); 00070 RT dtqx = q.point().x() - t.point().x(); 00071 RT minus_dtqy = -q.point().y() + t.point().y(); 00072 00073 Sign sgn1 = sign_of_determinant(dtsx, dtsy, minus_dtqy, dtqx); 00074 00075 CGAL_assertion( sgn1 != ZERO ); 00076 00077 return (sgn1 == POSITIVE); 00078 } 00079 00080 if ( s.is_segment() && r.is_segment() && same_segments(s, r) ) { 00081 CGAL_assertion( same_points(q, s.source_site()) || 00082 same_points(q, s.target_site()) ); 00083 Site_2 ss; 00084 if ( same_points(q, s.source_site()) ) { 00085 ss = s.target_site(); 00086 } else { 00087 ss = s.source_site(); 00088 } 00089 // MK::ERROR: write this code using the compare_x_2 and 00090 // compare_y_2 predicates instead of computing the inner 00091 // product... 00092 RT dtssx = ss.point().x() - t.point().x(); 00093 RT dtssy = ss.point().y() - t.point().y(); 00094 RT dtqx = q.point().x() - t.point().x(); 00095 RT minus_dtqy = -q.point().y() + t.point().y(); 00096 00097 Sign sgn1 = sign_of_determinant(dtssx, dtssy, minus_dtqy, dtqx); 00098 00099 CGAL_assertion( sgn1 != ZERO ); 00100 00101 return (sgn1 == POSITIVE); 00102 } 00103 00104 return ( sgn == NEGATIVE ); 00105 } 00106 00107 }; 00108 00109 00110 //----------------------------------------------------------------------------- 00111 00112 CGAL_SEGMENT_DELAUNAY_GRAPH_2_END_NAMESPACE 00113 00114 CGAL_END_NAMESPACE 00115 00116 #endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_INFINITE_EDGE_INTERIOR_CONFLICT_C2_H
1.7.6.1