This commit is contained in:
Efi Fogel 2002-04-14 21:28:24 +00:00
parent fa5f92050e
commit d2e7e8f02f
2 changed files with 24 additions and 23 deletions

View File

@ -1,4 +1,5 @@
//examples/Arrangement_2/example1.C
#include <CGAL/Cartesian.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
@ -11,10 +12,10 @@ typedef CGAL::Quotient<CGAL::MP_Float> NT;
typedef CGAL::Cartesian<NT> Kernel;
typedef CGAL::Arr_segment_exact_traits<Kernel> Traits;
typedef Traits::Point Point;
typedef Traits::Curve Curve;
typedef Traits::Point_2 Point_2;
typedef Traits::Curve_2 Curve_2;
typedef CGAL::Arr_base_node<Curve> Base_node;
typedef CGAL::Arr_base_node<Curve_2> Base_node;
typedef CGAL::Arr_2_default_dcel<Traits> Dcel;
typedef CGAL::Arrangement_2<Dcel,Traits,Base_node> Arr_2;
@ -23,8 +24,8 @@ int main()
Arr_2 arr;
//insertion of the curves
arr.insert(Curve(Point(0,0), Point(1,1)));
arr.insert(Curve(Point(0,1), Point(1,0)));
arr.insert(Curve_2(Point_2(0,0), Point_2(1,1)));
arr.insert(Curve_2(Point_2(0,1), Point_2(1,0)));
//traversal of the curves
Arr_2::Curve_iterator cit;

View File

@ -1,41 +1,41 @@
//examples/Arrangement_2/example3.C
// ------------------------------
#include <CGAL/basic.h>
#include <CGAL/Arr_2_bases.h>
#include <CGAL/Arr_2_default_dcel.h>
#include <CGAL/Arr_circles_real_traits.h>
#include <CGAL/Arrangement_2.h>
//#include <CGAL/leda_real.h>
//typedef leda_real NT;
// We use here double instead of leda_real to enable compilation without LEDA.
// This is not recommended generally.
// Read more in the README file or in the manual.
typedef double NT;
typedef double NT;
typedef CGAL::Arr_circles_real_traits<NT> Traits;
typedef Traits::Point Point;
typedef Traits::X_curve X_curve;
typedef Traits::Curve Curve;
typedef Traits::Point_2 Point_2;
typedef Traits::X_curve_2 X_curve_2;
typedef Traits::Curve_2 Curve_2;
typedef CGAL::Arr_base_node<Curve> Base_node;
typedef CGAL::Arr_base_node<Curve_2> Base_node;
typedef CGAL::Arr_2_default_dcel<Traits> Dcel;
typedef CGAL::Arrangement_2<Dcel,Traits,Base_node> Arr_2;
int main() {
int main()
{
Arr_2 arr;
//2 ccw circles with radius 5 and center (0,0) and (6,0) resp.
Arr_2::Curve_iterator cit=arr.insert(Curve(0,0,25));
cit=arr.insert(Curve(6,0,25));
Arr_2::Curve_iterator cit = arr.insert(Curve_2(0, 0, 25));
cit=arr.insert(Curve_2(6, 0, 25));
//upward vertical ray shooting
Arr_2::Locate_type lt;
Arr_2::Halfedge_handle e=arr.vertical_ray_shoot(Point(-1,0),lt,true);
Arr_2::Halfedge_handle e = arr.vertical_ray_shoot(Point_2(-1, 0), lt, true);
CGAL_assertion(e->source()->point()==Point(3,4));
CGAL_assertion(e->target()->point()==Point(-5,0));
CGAL_assertion(e->source()->point() == Point_2(3, 4));
CGAL_assertion(e->target()->point() == Point_2(-5, 0));
return 0;
}