global functions and do_intersect for CK_2

This commit is contained in:
Pedro Machado Manhaes de Castro
2008-07-25 15:02:26 +00:00
parent 240892f892
commit b7c906cf00
9 changed files with 227 additions and 53 deletions
@@ -25,6 +25,7 @@
#ifndef CGAL_CIRCULAR_KERNEL_FUNCTION_OBJECTS_POLYNOMIAL_CIRCULAR_H
#define CGAL_CIRCULAR_KERNEL_FUNCTION_OBJECTS_POLYNOMIAL_CIRCULAR_H
#include <CGAL/Circular_kernel_2/internal_functions_on_intersection_2.h>
#include <CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h>
#include <CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h>
#include <CGAL/Bbox_2.h>
@@ -538,6 +539,18 @@ template < class CK >
};
template < class CK >
class Do_intersect_2
: public CK::Linear_kernel::Do_intersect_2
{
public:
typedef typename CK::Linear_kernel::Do_intersect_2::result_type result_type;
template <class T1, class T2>
result_type
operator()(const T1& t1, const T2& t2) const
{ return CGALi::do_intersect(t1, t2, CK()); }
using CK::Linear_kernel::Do_intersect_2::operator();
};
template < class CK >
class Intersect_2
@@ -99,7 +99,8 @@
CGAL_Circular_Kernel_pred(Has_on_unbounded_side_2, has_on_unbounded_side_2_object)
CGAL_Circular_Kernel_pred(Bounded_side_2, bounded_side_2_object)
CGAL_Circular_Kernel_pred(Collinear_2, collinear_2_object)
CGAL_Circular_Kernel_pred(Do_intersect_2, do_intersect_2_object)
CGAL_Circular_Kernel_cons(Construct_supporting_circle_2,
construct_supporting_circle_2_object)
CGAL_Circular_Kernel_cons(Construct_supporting_line_2,
@@ -0,0 +1,84 @@
// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Monique Teillaud, Sylvain Pion, Pedro Machado
// Partially supported by the IST Programme of the EU as a Shared-cost
// RTD (FET Open) Project under Contract No IST-2000-26473
// (ECG - Effective Computational Geometry for Curves and Surfaces)
// and a STREP (FET Open) Project under Contract No IST-006413
// (ACS -- Algorithms for Complex Shapes)
#ifndef CGAL_CIRCULAR_KERNEL_INTERNAL_FUNCTIONS_ON_INTERSECTION_2_H
#define CGAL_CIRCULAR_KERNEL_INTERNAL_FUNCTIONS_ON_INTERSECTION_2_H
#include <CGAL/Circle_2.h>
#include <CGAL/Circular_arc_2.h>
#include <CGAL/Line_arc_2.h>
#include <CGAL/Line_2.h>
#include <CGAL/Object.h>
CGAL_BEGIN_NAMESPACE
#define CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(A,B) \
template < class OutputIterator, class K > \
OutputIterator \
intersection(const A <K> &c1, const B <K> &c2, OutputIterator res) \
{ \
return typename K::Intersect_2()(c1, c2, res); \
} \
namespace CGALi { \
template <class K> \
inline \
bool \
do_intersect(const typename K::A &c1, const typename K::B &c2, const K&) \
{ \
std::vector< Object > res; \
typename K::Intersect_2()(c1,c2,std::back_inserter(res)); \
return res.size() != 0; \
} \
} \
template <class K> \
inline \
bool \
do_intersect(const A <K> &c1, const B <K> &c2) \
{ \
return typename K::Do_intersect_2()(c1, c2); \
}
// Circle_2 Circle_2 already has its do_intersect
// so it needs only the global intersection
template < class OutputIterator, class K >
OutputIterator
intersection(const Circle_2 <K> &c1, const Circle_2 <K> &c2, OutputIterator res)
{
return typename K::Intersect_2()(c1, c2, res);
}
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Circular_arc_2, Circular_arc_2)
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_arc_2, Line_arc_2)
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_arc_2, Circle_2)
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Circle_2, Line_arc_2)
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_arc_2, Circular_arc_2)
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Circular_arc_2, Line_arc_2)
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_2, Circular_arc_2)
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_2, Line_arc_2)
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Circular_arc_2, Line_2)
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_arc_2, Line_2)
CGAL_END_NAMESPACE
#endif // CGAL_CIRCULAR_KERNEL_INTERNAL_FUNCTIONS_ON_INTERSECTION_2_H