BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h
Go to the documentation of this file.
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/Oriented_side_C2.h $
00015 // $Id: Oriented_side_C2.h 44317 2008-07-22 12:29:01Z spion $
00016 // 
00017 //
00018 // Author(s)     : Menelaos Karavelas <mkaravel@cse.nd.edu>
00019 
00020 
00021 
00022 #ifndef CGAL_SEGMENT_DELAUNAY_GRAPH_2_ORIENTED_SIDE_C2_H
00023 #define CGAL_SEGMENT_DELAUNAY_GRAPH_2_ORIENTED_SIDE_C2_H
00024 
00025 #include <CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h>
00026 #include <CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_C2.h>
00027 
00028 
00029 CGAL_BEGIN_NAMESPACE
00030 
00031 CGAL_SEGMENT_DELAUNAY_GRAPH_2_BEGIN_NAMESPACE
00032 
00033 //-----------------------------------------------------------------------------
00034 
00035 
00036 
00037 template<class K, class Method_tag>
00038 class Oriented_side_C2
00039   : public Basic_predicates_C2<K>
00040 {
00041 private:
00042 
00043   typedef Basic_predicates_C2<K>              Base;
00044   typedef Voronoi_vertex_C2<K,Method_tag>     Voronoi_vertex_2;
00045   
00046   typedef typename Base::Point_2              Point_2;
00047   typedef typename Base::Segment_2            Segment_2;
00048   typedef typename Base::Line_2               Line_2;
00049   typedef typename Base::Site_2               Site_2;
00050   typedef typename Base::FT                   FT;
00051   typedef typename Base::RT                   RT;
00052 
00053 public:
00054   typedef typename Base::Oriented_side        Oriented_side;
00055   typedef Oriented_side                       result_type;
00056   typedef Site_2                              argument_type;
00057 
00058   // computes the oriented side of the point q
00059   // wrt the line that is passes through the point p and its direction
00060   // is the direction of the supporting line of s, rotated by 90
00061   // degrees counterclockwise.
00062   Oriented_side operator()(const Site_2& q, 
00063                            const Site_2& s, const Site_2& p) const
00064   {
00065     CGAL_precondition( q.is_point() );
00066     CGAL_precondition( s.is_segment() && p.is_point() );
00067 
00068     Line_2 l = compute_supporting_line( s );
00069     Line_2 lp = compute_perpendicular(l, p.point());
00070 
00071     return lp.oriented_side(q.point());
00072   }
00073 
00074   // computes the oriented side of the Voronoi vertex of s1, s2, s3
00075   // wrt the line that is passes through the point p and its direction
00076   // is the direction of the supporting line of s, rotated by 90
00077   // degrees counterclockwise.
00078   Oriented_side operator()(const Site_2& s1, const Site_2& s2,
00079                            const Site_2& s3,
00080                            const Site_2& s, const Site_2& p) const
00081   {
00082     CGAL_precondition( s.is_segment() && p.is_point() );
00083 
00084     Voronoi_vertex_2 v(s1, s2, s3);
00085     Line_2 l = compute_supporting_line( s );
00086     Line_2 lp = compute_perpendicular(l, p.point());
00087 
00088     return v.oriented_side(lp);
00089   }
00090 };
00091 
00092 
00093 //-----------------------------------------------------------------------------
00094 
00095 CGAL_SEGMENT_DELAUNAY_GRAPH_2_END_NAMESPACE
00096 
00097 CGAL_END_NAMESPACE
00098 
00099 #endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_ORIENTED_SIDE_C2_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines