mirror of https://github.com/CGAL/cgal
global functions and do_intersect for CK_2
This commit is contained in:
parent
240892f892
commit
b7c906cf00
|
|
@ -1585,6 +1585,8 @@ Circular_kernel_2/demo/Circular_kernel_2/help/trash.jpeg -text svneol=unset#imag
|
|||
Circular_kernel_2/doc_tex/Circular_kernel_2/fig/Boolean_operation.png -text
|
||||
Circular_kernel_2/doc_tex/Circular_kernel_2/fig/Boolean_operation_detail.png -text
|
||||
Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt -text
|
||||
Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_intersection_2.h -text
|
||||
Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_intersections.h -text
|
||||
Circular_kernel_3/demo/Circular_kernel_3/images/button_axis.gif -text svneol=unset#image/gif
|
||||
Circular_kernel_3/demo/Circular_kernel_3/images/button_light.gif -text svneol=unset#image/gif
|
||||
Circular_kernel_3/demo/Circular_kernel_3/images/button_line.gif -text svneol=unset#image/gif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ double prob_2() {
|
|||
if(CGAL::orientation(p4, p5, p6) != CGAL::COUNTERCLOCKWISE) std::swap(p4, p6);
|
||||
T o2 = T(p4, p5, p6);
|
||||
std::vector< CGAL::Object > res;
|
||||
Circular_k().intersect_2_object()(o1, o2, std::back_inserter(res));
|
||||
CGAL::intersection(o1, o2, std::back_inserter(res));
|
||||
prob += (res.size() != 0) ? 1.0 : 0.0;
|
||||
}
|
||||
return prob/10000.0;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -79,6 +79,7 @@ template <class CK>
|
|||
typedef Bbox_functors::Equal_2<Self> Equal_2;
|
||||
typedef Bbox_functors::In_x_range_2<Self> In_x_range_2;
|
||||
typedef Bbox_functors::Make_x_monotone_2<Self> Make_x_monotone_2;
|
||||
typedef Bbox_functors::Do_intersect_2<Self> Do_intersect_2;
|
||||
typedef Bbox_functors::Intersect_2<Self> Intersect_2;
|
||||
typedef Bbox_functors::Split_2<Self> Split_2;
|
||||
typedef Bbox_functors::Is_vertical_2<Self> Is_vertical_2;
|
||||
|
|
@ -161,6 +162,10 @@ template <class CK>
|
|||
Is_vertical_2
|
||||
is_vertical_2_object() const
|
||||
{ return Is_vertical_2(); }
|
||||
|
||||
Do_intersect_2
|
||||
do_intersect_2_object() const
|
||||
{ return Do_intersect_2(); }
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
// 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_BBOX_FILTERED_INTERSECTIONS_2_H
|
||||
#define CGAL_CIRCULAR_KERNEL_BBOX_FILTERED_INTERSECTIONS_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_FBBOX(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); \
|
||||
}
|
||||
|
||||
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Circular_arc_with_bbox_2, Circular_arc_with_bbox_2)
|
||||
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_arc_with_bbox_2, Line_arc_with_bbox_2)
|
||||
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_arc_with_bbox_2, Circular_arc_with_bbox_2)
|
||||
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Circular_arc_with_bbox_2, Line_arc_with_bbox_2)
|
||||
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_2, Circular_arc_with_bbox_2)
|
||||
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_2, Line_arc_with_bbox_2)
|
||||
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Circular_arc_with_bbox_2, Line_2)
|
||||
CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_arc_with_bbox_2, Line_2)
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_CIRCULAR_KERNEL_BBOX_FILTERED_INTERSECTIONS_2_H
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
#ifndef CGAL_BBOX_FILTERED_PREDICATES_H
|
||||
#define CGAL_BBOX_FILTERED_PREDICATES_H
|
||||
|
||||
#include <CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_intersections.h>
|
||||
#include <CGAL/assertions.h>
|
||||
#include <CGAL/enum.h>
|
||||
#include <CGAL/Object.h>
|
||||
|
|
@ -681,6 +682,16 @@ class Do_overlap_2
|
|||
}
|
||||
};
|
||||
|
||||
template < class BK >
|
||||
class Do_intersect_2
|
||||
{
|
||||
public:
|
||||
typedef typename BK::Bool_type result_type;
|
||||
template <class T1, class T2>
|
||||
result_type
|
||||
operator()(const T1& t1, const T2& t2) const
|
||||
{ return CGALi::do_intersect(t1, t2, BK()); }
|
||||
};
|
||||
|
||||
template < class BK >
|
||||
class Intersect_2
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ void _test_circle_construct(CK ck)
|
|||
typedef typename CK::Get_equation Get_equation;
|
||||
//typedef typename CK::Polynomial_for_circles_2_2 Polynomial_for_circles_2_2;
|
||||
typedef typename CK::Compare_xy_2 Compare_xy_2;
|
||||
typedef typename CK::Do_intersect_2 Do_intersect_2;
|
||||
#else
|
||||
typedef CK::Circle_2 Circle_2;
|
||||
typedef CK::Circular_arc_2 Circular_arc_2;
|
||||
|
|
@ -102,6 +103,7 @@ void _test_circle_construct(CK ck)
|
|||
|
||||
//Constuct_intersections_2 with 2 intersection's points
|
||||
std::cout << std::endl << "construct_intersection_2" << std::endl;
|
||||
Do_intersect_2 theDo_intersect_2 = ck.do_intersect_2_object();
|
||||
Intersect_2 theConstruct_intersect_2
|
||||
= ck.intersect_2_object();
|
||||
int center_circ_intersection_2_1_x = theRandom.get_int(random_min, random_max);
|
||||
|
|
@ -125,6 +127,7 @@ void _test_circle_construct(CK ck)
|
|||
circ_intersections_2_2,
|
||||
std::back_inserter(vector_for_intersection_1));
|
||||
// there are 2 intersection's points
|
||||
assert(theDo_intersect_2(circ_intersections_2_1, circ_intersections_2_1));
|
||||
std::pair<Circular_arc_point_2, unsigned > the_pair;
|
||||
assert(assign(the_pair, vector_for_intersection_1[0]));
|
||||
Circular_arc_point_2 first = the_pair.first;
|
||||
|
|
@ -155,6 +158,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_intersections_2_1,
|
||||
circ_intersections_2_3,
|
||||
std::back_inserter(vector_for_intersection_2));
|
||||
assert(theDo_intersect_2(circ_intersections_2_1, circ_intersections_2_3));
|
||||
assert(vector_for_intersection_2.size() == 1);
|
||||
assign(the_pair, vector_for_intersection_2[0]);
|
||||
assert(the_pair.first == the_intersection_point_1);
|
||||
|
|
@ -171,6 +175,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_intersections_2_1,
|
||||
circ_intersections_2_3_bis,
|
||||
std::back_inserter(vector_for_intersection_2_bis));
|
||||
assert(theDo_intersect_2(circ_intersections_2_1, circ_intersections_2_3_bis));
|
||||
assert(vector_for_intersection_2_bis.size() == 1);
|
||||
assign(the_pair, vector_for_intersection_2_bis[0]);
|
||||
assert(the_pair.second == 2u);
|
||||
|
|
@ -209,6 +214,8 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_2_1_part_low,
|
||||
circ_arc_2_1_low_part_high,
|
||||
std::back_inserter(vector_for_intersection_3));
|
||||
assert(theDo_intersect_2(circ_arc_2_1_part_low, circ_arc_2_1_low_part_high));
|
||||
|
||||
/////////////std::cout << "The size: " << vector_for_intersection_3.size() << std::endl;
|
||||
assert(vector_for_intersection_3.size() == 2);
|
||||
assign(the_pair, vector_for_intersection_3[0]);
|
||||
|
|
@ -275,6 +282,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_overlap_1,
|
||||
circ_arc_overlap_1,
|
||||
std::back_inserter(vector_for_intersection_the_same_arc));
|
||||
assert(theDo_intersect_2(circ_arc_overlap_1, circ_arc_overlap_1));
|
||||
assert(vector_for_intersection_the_same_arc.size() == 1);
|
||||
Circular_arc_2 res_same;
|
||||
assert(assign(res_same, vector_for_intersection_the_same_arc[0]));
|
||||
|
|
@ -289,6 +297,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_overlap_2,
|
||||
circ_arc_overlap_1,
|
||||
std::back_inserter(vector_for_intersection_overlap_1_1));
|
||||
assert(theDo_intersect_2(circ_arc_overlap_2, circ_arc_overlap_1));
|
||||
Circular_arc_2 circ_arc_overlap_result(circ_intersections_2_1,
|
||||
line_arc_overlap_low_left, true,
|
||||
line_arc_overlap_low_right, false);
|
||||
|
|
@ -301,6 +310,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_overlap_2,
|
||||
circ_arc_overlap_1,
|
||||
std::back_inserter(vector_for_intersection_overlap_1_2));
|
||||
assert(theDo_intersect_2(circ_arc_overlap_2, circ_arc_overlap_1));
|
||||
assert(vector_for_intersection_overlap_1_2.size() == 1);
|
||||
assign(circ_arc_in_overlap, vector_for_intersection_overlap_1_2[0]);
|
||||
assert(circ_arc_in_overlap.source() == circ_arc_overlap_result.source());
|
||||
|
|
@ -313,6 +323,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_overlap_1,
|
||||
circ_arc_overlap_3,
|
||||
std::back_inserter(vector_for_intersection_overlap_2_1));
|
||||
assert(theDo_intersect_2(circ_arc_overlap_1, circ_arc_overlap_3));
|
||||
assert(vector_for_intersection_overlap_2_1.size() == 1);
|
||||
assign(the_pair, vector_for_intersection_overlap_2_1[0]);
|
||||
std::cout << "x = " << the_pair.first.x() << " the result must be = " <<
|
||||
|
|
@ -338,6 +349,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_overlap_3,
|
||||
circ_arc_overlap_1,
|
||||
std::back_inserter(vector_for_intersection_overlap_2_2));
|
||||
assert(theDo_intersect_2(circ_arc_overlap_3, circ_arc_overlap_1));
|
||||
assert(vector_for_intersection_overlap_2_2.size() == 1);
|
||||
assign(the_pair, vector_for_intersection_overlap_2_2[0]);
|
||||
std::cout << "x = " << the_pair.first.x() << " the result must be = " <<
|
||||
|
|
@ -362,18 +374,9 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_overlap_upper_part,
|
||||
circ_arc_overlap_lower_part,
|
||||
std::back_inserter(vector_for_intersection_overlap_3_1));
|
||||
|
||||
assert(theDo_intersect_2(circ_arc_overlap_upper_part, circ_arc_overlap_lower_part));
|
||||
assert(vector_for_intersection_overlap_3_1.size() == 2);
|
||||
|
||||
assign(the_pair, vector_for_intersection_overlap_3_1[0]); // apagar depois
|
||||
std::cout << "res1 = (" <<
|
||||
to_double(the_pair.first.x()) << ", " <<
|
||||
to_double(the_pair.first.y()) << ")" << std::endl;
|
||||
assign(the_pair, vector_for_intersection_overlap_3_1[1]);
|
||||
std::cout << "res2 = (" <<
|
||||
to_double(the_pair.first.x()) << ", " <<
|
||||
to_double(the_pair.first.y()) << ")" << std::endl;
|
||||
|
||||
assign(the_pair, vector_for_intersection_overlap_3_1[0]);
|
||||
assert(the_pair.first == circ_arc_overlap_lower_part.source());
|
||||
//assert(the_pair.first.is_left());
|
||||
|
|
@ -385,6 +388,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_overlap_lower_part,
|
||||
circ_arc_overlap_upper_part,
|
||||
std::back_inserter(vector_for_intersection_overlap_3_2));
|
||||
assert(theDo_intersect_2(circ_arc_overlap_lower_part, circ_arc_overlap_upper_part));
|
||||
|
||||
assert(vector_for_intersection_overlap_3_2.size() == 2);
|
||||
assign(the_pair, vector_for_intersection_overlap_3_2[0]);
|
||||
|
|
@ -412,6 +416,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_1,
|
||||
circ_intersections_2_4,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_1_1));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_4));
|
||||
assert(vector_for_intersection_no_x_monotone_1_1.size() == 2);
|
||||
assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_1[0]));
|
||||
assert(the_pair.first == CGAL::circle_intersect<CK>(circ_intersections_2_1,
|
||||
|
|
@ -439,6 +444,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_1,
|
||||
circ_intersections_2_5,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_1_2));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_5));
|
||||
assert(vector_for_intersection_no_x_monotone_1_2.size() == 1);
|
||||
assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_2[0]));
|
||||
assert(the_pair.first == CGAL::circle_intersect<CK>(circ_intersections_2_1,
|
||||
|
|
@ -461,6 +467,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_1,
|
||||
circ_intersections_2_6,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_1_3));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_6));
|
||||
assert(vector_for_intersection_no_x_monotone_1_3.size() == 1);
|
||||
assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_3[0]));
|
||||
assert(the_pair.first == CGAL::circle_intersect<CK>(circ_intersections_2_1,
|
||||
|
|
@ -481,6 +488,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_1,
|
||||
circ_intersections_2_7,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_1_4));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_7));
|
||||
assert(vector_for_intersection_no_x_monotone_1_4.size() == 1);
|
||||
assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_4[0]));
|
||||
assert(the_pair.first == CGAL::circle_intersect<CK>(circ_intersections_2_1,
|
||||
|
|
@ -500,6 +508,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_1,
|
||||
circ_intersections_2_8,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_1_5));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_8));
|
||||
assert(vector_for_intersection_no_x_monotone_1_5.size() == 1);
|
||||
assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_5[0]));
|
||||
assert(the_pair.first == CGAL::circle_intersect<CK>(circ_intersections_2_1,
|
||||
|
|
@ -519,6 +528,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_1,
|
||||
circ_intersections_2_9,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_1_6));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_intersections_2_9));
|
||||
assert(vector_for_intersection_no_x_monotone_1_6.size() == 1);
|
||||
assert(assign(the_pair, vector_for_intersection_no_x_monotone_1_6[0]));
|
||||
assert(the_pair.first == CGAL::circle_intersect<CK>(circ_intersections_2_1,
|
||||
|
|
@ -538,6 +548,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_1,
|
||||
circ_arc_no_x_monotone_2,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_2_1));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_arc_no_x_monotone_2));
|
||||
assert(vector_for_intersection_no_x_monotone_2_1.size() == 1);
|
||||
assert(assign(circ_arc_in_overlap, vector_for_intersection_no_x_monotone_2_1[0]));
|
||||
assert(circ_arc_in_overlap.is_x_monotone());
|
||||
|
|
@ -558,6 +569,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_1,
|
||||
circ_arc_no_x_monotone_3,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_2_2));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_arc_no_x_monotone_3));
|
||||
assert(vector_for_intersection_no_x_monotone_2_2.size() == 1);
|
||||
assert(assign(circ_arc_in_overlap, vector_for_intersection_no_x_monotone_2_2[0]));
|
||||
assert(circ_arc_in_overlap.source() == circ_arc_no_x_monotone_1.source());
|
||||
|
|
@ -576,6 +588,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_1,
|
||||
circ_arc_no_x_monotone_4,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_2_3));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_1, circ_arc_no_x_monotone_4));
|
||||
std::cout << vector_for_intersection_no_x_monotone_2_3.size() << std::endl;
|
||||
|
||||
std::cout << vector_for_intersection_no_x_monotone_2_3.size() << std::endl;
|
||||
|
|
@ -605,6 +618,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_4,
|
||||
circ_arc_no_x_monotone_5,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_2_4));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_4, circ_arc_no_x_monotone_5));
|
||||
std::cout << vector_for_intersection_no_x_monotone_2_4.size() << std::endl;
|
||||
assert(vector_for_intersection_no_x_monotone_2_4.size() == 2);
|
||||
assert(assign(the_pair, vector_for_intersection_no_x_monotone_2_4[0]));
|
||||
|
|
@ -625,6 +639,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_6,
|
||||
circ_arc_no_x_monotone_5,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_2_5));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_6, circ_arc_no_x_monotone_5));
|
||||
std::cout << vector_for_intersection_no_x_monotone_2_5.size() << std::endl;
|
||||
assert(vector_for_intersection_no_x_monotone_2_5.size() == 1);
|
||||
assert(assign(the_pair, vector_for_intersection_no_x_monotone_2_5[0]));
|
||||
|
|
@ -642,6 +657,7 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(circ_arc_no_x_monotone_7,
|
||||
circ_arc_no_x_monotone_4,
|
||||
std::back_inserter(vector_for_intersection_no_x_monotone_2_6));
|
||||
assert(theDo_intersect_2(circ_arc_no_x_monotone_7, circ_arc_no_x_monotone_4));
|
||||
std::cout << vector_for_intersection_no_x_monotone_2_6.size() << std::endl;
|
||||
assert(vector_for_intersection_no_x_monotone_2_6.size() == 2);
|
||||
assign(circ_arc_in_overlap,vector_for_intersection_no_x_monotone_2_6[0]);
|
||||
|
|
@ -779,46 +795,6 @@ void _test_circle_construct(CK ck)
|
|||
assert(circular_arc_2_random.is_x_monotone());
|
||||
}
|
||||
|
||||
|
||||
std::cout << "Split_2_object " << std::endl;
|
||||
//we make the circle1
|
||||
int center1_x = theRandom.get_int(random_min, random_max);
|
||||
int center1_y = theRandom.get_int(random_min, random_max);
|
||||
Point_2 center1(center1_x,center1_y);
|
||||
int circ1_r = theRandom.get_int(1, random_max);
|
||||
Circle_2 circ1(center1, circ1_r * circ1_r);
|
||||
Point_2 center1_low_right(center1_x + circ1_r, center1_y - circ1_r);
|
||||
Circle_2 circ1_low_right(center1_low_right, circ1_r * circ1_r);
|
||||
Point_2 center1_low_left(center1_x - circ1_r, center1_y - circ1_r);
|
||||
Circle_2 circ1_low_left(center1_low_left, circ1_r * circ1_r);
|
||||
Point_2 point_2_left(center1_x - circ1_r, center1_y);
|
||||
Line_2 theLine_2_horizontal(center1, point_2_left);
|
||||
//The circ1_arc_high and circ1_arc_low are x_monotone
|
||||
Circular_arc_2 circ1_arc_low(circ1,
|
||||
theLine_2_horizontal,true,
|
||||
theLine_2_horizontal, false);
|
||||
//p1 is lefter and lower than p2
|
||||
Circular_arc_point_2 circ1_arc_end_p1 =
|
||||
CGAL::circle_intersect<CK>(circ1, circ1_low_right, true);
|
||||
Split_2 theSplit_2 = ck.split_2_object();
|
||||
Circular_arc_2 circ_arc_split_1;
|
||||
Circular_arc_2 circ_arc_split_2;
|
||||
theSplit_2(circ1_arc_low, circ1_arc_end_p1,
|
||||
circ_arc_split_1, circ_arc_split_2);
|
||||
assert(circ_arc_split_1.target() == circ1_arc_end_p1);
|
||||
assert(circ1_arc_low.source() == circ_arc_split_1.source());
|
||||
assert(circ_arc_split_1.target() == circ_arc_split_2.source());
|
||||
assert(circ1_arc_low.target() == circ_arc_split_2.target());
|
||||
|
||||
//We used a point created without the support circle
|
||||
Circular_arc_point_2 circ1_arc_end_p2 =
|
||||
CGAL::circle_intersect<CK>(circ1_low_left, circ1_low_right, true);
|
||||
theSplit_2(circ1_arc_low, circ1_arc_end_p2,
|
||||
circ_arc_split_1, circ_arc_split_2);
|
||||
assert(circ_arc_split_1.target() == circ1_arc_end_p2);
|
||||
assert(circ1_arc_low.source() == circ_arc_split_1.source());
|
||||
assert(circ_arc_split_1.target() == circ_arc_split_2.source());
|
||||
assert(circ1_arc_low.target() == circ_arc_split_2.target());
|
||||
|
||||
//The commented code in bottom must create an error
|
||||
////We used a point which is not on the arc
|
||||
|
|
@ -850,12 +826,21 @@ void _test_circle_construct(CK ck)
|
|||
theConstruct_intersect_2(lo1, cao7, std::back_inserter(v_ll7));
|
||||
theConstruct_intersect_2(lo1, cao8, std::back_inserter(v_ll8));
|
||||
assert(v_ll1.size() == 2);
|
||||
assert(theDo_intersect_2(lo1, cao1));
|
||||
assert(v_ll2.size() == 2);
|
||||
assert(theDo_intersect_2(lo1, cao2));
|
||||
assert(v_ll3.size() == 1);
|
||||
assert(theDo_intersect_2(lo1, cao3));
|
||||
assert(v_ll4.size() == 1);
|
||||
assert(theDo_intersect_2(lo1, cao4));
|
||||
assert(v_ll5.size() == 0);
|
||||
assert(!theDo_intersect_2(lo1, cao5));
|
||||
assert(v_ll6.size() == 2);
|
||||
assert(theDo_intersect_2(lo1, cao6));
|
||||
assert(v_ll7.size() == 1);
|
||||
assert(theDo_intersect_2(lo1, cao7));
|
||||
assert(v_ll8.size() == 0);
|
||||
|
||||
assert(!theDo_intersect_2(lo1, cao8));
|
||||
CGAL::intersection(lo1, cao8, std::back_inserter(v_ll8));
|
||||
CGAL::do_intersect(lo1, cao8);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue