BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/predicates/Polygon_offset_pred_ftC2.h
Go to the documentation of this file.
00001 // Copyright (c) 2006 Fernando Luis Cacciola Carballal. All rights reserved.
00002 //
00003 // This file is part of CGAL (www.cgal.org); you may redistribute it under
00004 // the terms of the Q Public License version 1.0.
00005 // See the file LICENSE.QPL distributed with CGAL.
00006 //
00007 // Licensees holding a valid commercial license may use this file in
00008 // accordance with the commercial license agreement provided with the software.
00009 //
00010 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00011 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00012 //
00013 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Straight_skeleton_2/include/CGAL/predicates/Polygon_offset_pred_ftC2.h $
00014 // $Id: Polygon_offset_pred_ftC2.h 46494 2008-10-27 16:30:51Z afabri $
00015 // 
00016 // Author(s)     : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
00017 //
00018 #ifndef CGAL_POLYGON_OFFSET_PRED_FTC2_H
00019 #define CGAL_POLYGON_OFFSET_PRED_FTC2_H 1
00020 
00021 #include <CGAL/constructions/Straight_skeleton_cons_ftC2.h>
00022 
00023 CGAL_BEGIN_NAMESPACE
00024 
00025 namespace CGAL_SS_i
00026 {
00027 
00028 // Given a triple of oriented straight line segments: (e0,e1,e2) such that
00029 // there exists a distance 'et' for which the offsets lines at 'et' (e0',e1',e2') intersect in a single point;
00030 // returns the relative order of 't' w.r.t 'et'.
00031 // PRECONDITION: There exist a positive distance et for which the offset triple intersect at a single point.
00032 template<class K>
00033 Uncertain<Comparison_result> compare_offset_against_isec_timeC2 ( typename K::FT const& t, intrusive_ptr< Trisegment_2<K> > const& tri )
00034 {
00035   typedef typename K::FT FT ;
00036   
00037   typedef Rational<FT> Rational ;
00038   typedef Quotient<FT> Quotient ;
00039   
00040   typedef optional<Rational> Optional_rational ;
00041  
00042   Uncertain<Comparison_result> rResult = Uncertain<Comparison_result>::indeterminate();
00043 
00044   Optional_rational et_ = compute_offset_lines_isec_timeC2(tri);
00045   if ( et_ )
00046   {
00047     Quotient et = et_->to_quotient();
00048 
00049     CGAL_assertion ( CGAL_NTS certified_is_positive(et) ) ;
00050 
00051     rResult = CGAL_NTS certified_compare( Quotient(t), et);
00052   }
00053 
00054   return rResult ;
00055 
00056 }
00057 
00058 } // namespace CGAL_SS_i
00059 
00060 CGAL_END_NAMESPACE
00061 
00062 #endif // CGAL_POLYGON_OFFSET_PRED_FTC2_H //
00063 // EOF //
00064 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines