Added "tracing" to test arrangement computation during WIP

This commit is contained in:
Dror Atariah 2013-06-08 12:08:06 +02:00
parent bd78c16774
commit ff21d69f04
1 changed files with 32 additions and 19 deletions

View File

@ -5,6 +5,7 @@
#include <CGAL/Quotient.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_tracing_traits_2.h>
#include <CGAL/Arr_polyline_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <vector>
@ -15,7 +16,9 @@
typedef CGAL::Quotient<CGAL::MP_Float> Number_type;
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Segment_traits_2;
typedef CGAL::Arr_polyline_traits_2<Segment_traits_2> Traits_2;
typedef CGAL::Arr_polyline_traits_2<Segment_traits_2> Polyline_traits_2;
typedef CGAL::Arr_tracing_traits_2<Polyline_traits_2> Traits_2;
// typedef CGAL::Arr_polyline_traits_2<Segment_traits_2> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Segment_traits_2::Curve_2 Segment_2;
typedef Traits_2::Curve_2 Polyline_2;
@ -24,38 +27,48 @@ typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main ()
{
Traits_2 traits;
Traits_2 traits;
traits.disable_all_traces();
// traits.enable_trace(Traits_2::SPLIT_OP);
traits.enable_trace(Traits_2::INTERSECT_OP);
Traits_2::Construct_curve_2 polyline_construct =
traits.construct_curve_2_object();
Arrangement_2 arr;
Arrangement_2 arr(&traits);
std::list<Point_2> pts;
Point_2 p1(0,2);
Point_2 p2(-1,-1);
Point_2 p3(1,-1);
pts.push_back(p1);
pts.push_back(p2);
pts.push_back(p3);
pts.push_back(p1);
// Point_2 p1(0,2);
// Point_2 p2(-1,-1);
// Point_2 p3(1,-1);
// pts.push_back(p1);
// pts.push_back(p2);
// pts.push_back(p3);
// pts.push_back(p1);
pts.push_back(Point_2(-0, -7));
pts.push_back(Point_2(-7., 8));
pts.push_back(Point_2(-1, 6));
pts.push_back(Point_2(4, -9));
pts.push_back(Point_2(-7, -7));
Polyline_2 poly1 = polyline_construct(pts.begin(), pts.end());
std::vector<Segment_2> segs;
Point_2 q1(-1,1);
Point_2 q2(0,-2);
Point_2 q3(1,1);
// std::vector<Segment_2> segs;
// Point_2 q1(-1,1);
// Point_2 q2(0,-2);
// Point_2 q3(1,1);
segs.push_back(Segment_2(q1,q3));
segs.push_back(Segment_2(q1,q2));
segs.push_back(Segment_2(q2,q3));
Polyline_2 poly2 = polyline_construct(segs.begin(), segs.end());
// segs.push_back(Segment_2(q1,q3));
// segs.push_back(Segment_2(q1,q2));
// segs.push_back(Segment_2(q2,q3));
// Polyline_2 poly2 = polyline_construct(segs.begin(), segs.end());
// TODO: Make sure to construct all possible of polylines. That is, from
// ranges of points, ranges of segments, ranges with only one segment
// or only two points, etc.
insert (arr, poly1);
insert (arr, poly2);
// insert (arr, poly2);
// print_arrangement (arr);