Cleaned up. Replaced local definition of exact rational with CGAL::Exact_rational

This commit is contained in:
Efi Fogel 2015-11-14 12:55:43 +02:00
parent 86b9fbb22a
commit a4cf9f5f12
19 changed files with 161 additions and 182 deletions

View File

@ -1,23 +0,0 @@
#ifndef CGAL_ARR_RATIONAL_NT_H
#define CGAL_ARR_RATIONAL_NT_H
#include <CGAL/basic.h>
#ifdef CGAL_USE_GMP
// GMP is installed. Use the GMP rational number-type.
#include <CGAL/Gmpq.h>
typedef CGAL::Gmpq Number_type;
#else
// GMP is not installed. Use CGAL's exact rational number-type.
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
typedef CGAL::Quotient<CGAL::MP_Float> Number_type;
#endif
#endif

View File

@ -1,8 +1,8 @@
//! \file examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp
// Adapting the dual of an arrangement to a BGL graph.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_extended_dcel.h>
#include <CGAL/Arrangement_2.h>
@ -38,7 +38,7 @@ public:
{ key->set_data(val); }
};
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arr_face_extended_dcel<Traits_2, unsigned int> Dcel;
typedef CGAL::Arrangement_2<Traits_2, Dcel> Ex_arrangement;

View File

@ -1,8 +1,8 @@
//! \file examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp
// Adapting an arrangement to a BGL graph.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/graph_traits_Arrangement_2.h>
@ -12,7 +12,7 @@
#include <CGAL/property_map.h>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;

View File

@ -1,12 +1,12 @@
//! \file examples/Arrangement_on_surface_2/circles.cpp
// Constructing an arrangement of circles using the conic-arc traits.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_circle_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::CoordNT CoordNT;
@ -14,37 +14,37 @@ typedef Traits_2::Point_2 Point_2;
typedef Traits_2::Curve_2 Curve_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main ()
int main()
{
// Create a circle centered at the origin with radius 5.
Kernel::Point_2 c1 = Kernel::Point_2 (0, 0);
Number_type sqr_r1 = Number_type (25); // = 5^2
Circle_2 circ1 = Circle_2 (c1, sqr_r1, CGAL::CLOCKWISE);
Curve_2 cv1 = Curve_2 (circ1);
Kernel::Point_2 c1 = Kernel::Point_2(0, 0);
CGAL::Exact_rational sqr_r1 = CGAL::Exact_rational(25); // = 5^2
Circle_2 circ1 = Circle_2(c1, sqr_r1, CGAL::CLOCKWISE);
Curve_2 cv1 = Curve_2(circ1);
// Create a circle centered at (7,7) with radius 5.
Kernel::Point_2 c2 = Kernel::Point_2 (7, 7);
Number_type sqr_r2 = Number_type (25); // = 5^2
Circle_2 circ2 = Circle_2 (c2, sqr_r2, CGAL::CLOCKWISE);
Curve_2 cv2 = Curve_2 (circ2);
Kernel::Point_2 c2 = Kernel::Point_2(7, 7);
CGAL::Exact_rational sqr_r2 = CGAL::Exact_rational(25); // = 5^2
Circle_2 circ2 = Circle_2(c2, sqr_r2, CGAL::CLOCKWISE);
Curve_2 cv2 = Curve_2(circ2);
// Create a circle centered at (4,-0.5) with radius 3.5 (= 7/2).
Kernel::Point_2 c3 = Kernel::Point_2 (4, Number_type (-1,2));
Number_type sqr_r3 = Number_type (49, 4); // = 3.5^2
Circle_2 circ3 = Circle_2 (c3, sqr_r3, CGAL::CLOCKWISE);
Curve_2 cv3 = Curve_2 (circ3);
Kernel::Point_2 c3 = Kernel::Point_2(4, CGAL::Exact_rational(-1,2));
CGAL::Exact_rational sqr_r3 = CGAL::Exact_rational(49, 4); // = 3.5^2
Circle_2 circ3 = Circle_2(c3, sqr_r3, CGAL::CLOCKWISE);
Curve_2 cv3 = Curve_2(circ3);
// Construct the arrangement of the three circles.
Arrangement_2 arr;
Arrangement_2 arr;
insert (arr, cv1);
insert (arr, cv2);
insert (arr, cv3);
insert(arr, cv1);
insert(arr, cv2);
insert(arr, cv3);
// Locate the vertex with maximal degree.
Arrangement_2::Vertex_const_iterator vit;
Arrangement_2::Vertex_const_handle v_max;
std::size_t max_degree = 0;
Arrangement_2::Vertex_const_iterator vit;
Arrangement_2::Vertex_const_handle v_max;
std::size_t max_degree = 0;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
if (vit->degree() > max_degree) {

View File

@ -1,12 +1,12 @@
//! \file examples/Arrangement_on_surface_2/circular_arc.cpp
// Constructing an arrangement of various circular arcs and line segments.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_circle_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef Kernel::Circle_2 Circle_2;
typedef Kernel::Segment_2 Segment_2;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
@ -15,73 +15,75 @@ typedef Traits_2::Point_2 Point_2;
typedef Traits_2::Curve_2 Curve_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main ()
int main()
{
std::list<Curve_2> curves;
// Create a circle centered at the origin with squared radius 2.
Kernel::Point_2 c1 = Kernel::Point_2 (0, 0);
Circle_2 circ1 = Circle_2 (c1, Number_type (2));
Kernel::Point_2 c1 = Kernel::Point_2(0, 0);
Circle_2 circ1 = Circle_2(c1, CGAL::Exact_rational(2));
curves.push_back (Curve_2 (circ1));
curves.push_back(Curve_2(circ1));
// Create a circle centered at (2,3) with radius 3/2 - note that
// as the radius is rational we use a different curve constructor.
Kernel::Point_2 c2 = Kernel::Point_2 (2, 3);
Kernel::Point_2 c2 = Kernel::Point_2(2, 3);
curves.push_back (Curve_2 (c2, Number_type(3, 2)));
curves.push_back(Curve_2(c2, CGAL::Exact_rational(3, 2)));
// Create a segment of the line (y = x) with rational endpoints.
Kernel::Point_2 s3 = Kernel::Point_2 (-2, -2);
Kernel::Point_2 t3 = Kernel::Point_2 (2, 2);
Segment_2 seg3 = Segment_2 (s3, t3);
Kernel::Point_2 s3 = Kernel::Point_2(-2, -2);
Kernel::Point_2 t3 = Kernel::Point_2(2, 2);
Segment_2 seg3 = Segment_2(s3, t3);
curves.push_back (Curve_2 (seg3));
curves.push_back(Curve_2(seg3));
// Create a line segment with the same supporting line (y = x), but
// having one endpoint with irrational coefficients.
CoordNT sqrt_15 = CoordNT (0, 1, 15); // = sqrt(15)
Point_2 s4 = Point_2 (3, 3);
Point_2 t4 = Point_2 (sqrt_15, sqrt_15);
CoordNT sqrt_15 = CoordNT(0, 1, 15); // = sqrt(15)
Point_2 s4 = Point_2(3, 3);
Point_2 t4 = Point_2(sqrt_15, sqrt_15);
curves.push_back (Curve_2 (seg3.supporting_line(), s4, t4));
curves.push_back(Curve_2(seg3.supporting_line(), s4, t4));
// Create a circular arc that correspond to the upper half of the
// circle centered at (1,1) with squared radius 3. We create the
// circle with clockwise orientation, so the arc is directed from
// (1 - sqrt(3), 1) to (1 + sqrt(3), 1).
Kernel::Point_2 c5 = Kernel::Point_2 (1, 1);
Circle_2 circ5 = Circle_2 (c5, 3, CGAL::CLOCKWISE);
CoordNT one_minus_sqrt_3 = CoordNT (1, -1, 3);
CoordNT one_plus_sqrt_3 = CoordNT (1, 1, 3);
Point_2 s5 = Point_2 (one_minus_sqrt_3, CoordNT (1));
Point_2 t5 = Point_2 (one_plus_sqrt_3, CoordNT (1));
Kernel::Point_2 c5 = Kernel::Point_2(1, 1);
Circle_2 circ5 = Circle_2(c5, 3, CGAL::CLOCKWISE);
CoordNT one_minus_sqrt_3 = CoordNT(1, -1, 3);
CoordNT one_plus_sqrt_3 = CoordNT(1, 1, 3);
Point_2 s5 = Point_2(one_minus_sqrt_3, CoordNT(1));
Point_2 t5 = Point_2(one_plus_sqrt_3, CoordNT(1));
curves.push_back (Curve_2 (circ5, s5, t5));
curves.push_back(Curve_2(circ5, s5, t5));
// Create a circular arc of the unit circle, directed clockwise from
// (-1/2, sqrt(3)/2) to (1/2, sqrt(3)/2). Note that we orient the
// supporting circle accordingly.
Kernel::Point_2 c6 = Kernel::Point_2 (0, 0);
CoordNT sqrt_3_div_2 = CoordNT (Number_type(0), Number_type(1,2), Number_type(3));
Point_2 s6 = Point_2 (Number_type (-1, 2), sqrt_3_div_2);
Point_2 t6 = Point_2 (Number_type (1, 2), sqrt_3_div_2);
Kernel::Point_2 c6 = Kernel::Point_2(0, 0);
CoordNT sqrt_3_div_2 = CoordNT(CGAL::Exact_rational(0),
CGAL::Exact_rational(1,2),
CGAL::Exact_rational(3));
Point_2 s6 = Point_2(CGAL::Exact_rational(-1, 2), sqrt_3_div_2);
Point_2 t6 = Point_2(CGAL::Exact_rational(1, 2), sqrt_3_div_2);
curves.push_back (Curve_2 (c6, 1, CGAL::CLOCKWISE, s6, t6));
curves.push_back(Curve_2(c6, 1, CGAL::CLOCKWISE, s6, t6));
// Create a circular arc defined by two endpoints and a midpoint,
// all having rational coordinates. This arc is the upper-right
// quarter of a circle centered at the origin with radius 5.
Kernel::Point_2 s7 = Kernel::Point_2 (0, 5);
Kernel::Point_2 mid7 = Kernel::Point_2 (3, 4);
Kernel::Point_2 t7 = Kernel::Point_2 (5, 0);
Kernel::Point_2 s7 = Kernel::Point_2(0, 5);
Kernel::Point_2 mid7 = Kernel::Point_2(3, 4);
Kernel::Point_2 t7 = Kernel::Point_2(5, 0);
curves.push_back (Curve_2 (s7, mid7, t7));
curves.push_back(Curve_2(s7, mid7, t7));
// Construct the arrangement of the curves.
Arrangement_2 arr;
Arrangement_2 arr;
insert (arr, curves.begin(), curves.end());
insert(arr, curves.begin(), curves.end());
// Print the size of the arrangement.
std::cout << "The arrangement size:" << std::endl

View File

@ -2,8 +2,8 @@
// Associating a color attribute with segments using the consolidated
// curve-data traits.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_consolidated_curve_data_traits_2.h>
#include <CGAL/Arrangement_2.h>
@ -14,7 +14,7 @@ enum Segment_color {
BLUE
};
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Segment_traits_2;
typedef Segment_traits_2::Curve_2 Segment_2;
typedef CGAL::Arr_consolidated_curve_data_traits_2

View File

@ -1,8 +1,8 @@
//! \file examples/Arrangement_on_surface_2/curve_history.cpp
// Constructing an arrangement with curve history.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_on_surface_with_history_2.h>
@ -11,7 +11,7 @@
#include "point_location_utils.h"
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::Curve_2 Segment_2;

View File

@ -1,15 +1,15 @@
//! \file examples/Arrangement_on_surface_2/dcel_extension.cpp
// Extending all DCEL records (vertices, edges and faces).
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_extended_dcel.h>
enum Color {BLUE, RED, WHITE};
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;

View File

@ -1,8 +1,8 @@
//! \file examples/Arrangement_on_surface_2/dcel_extension_io.cpp
// Using the I/O operators for arrangements with extended DCEL records.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_extended_dcel.h>
#include <CGAL/Arrangement_2.h>
@ -39,7 +39,7 @@ std::istream& operator>> (std::istream& is, Color& color)
return (is);
}
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;

View File

@ -2,27 +2,27 @@
// Checking whether there are three collinear points in a given input set
// using the arrangement of the dual lines.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_linear_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <cstdlib>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_linear_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::Line_2 Line_2;
typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main (int argc, char *argv[])
int main(int argc, char *argv[])
{
// Get the name of the input file from the command line, or use the default
// points.dat file if no command-line parameters are given.
const char * filename = (argc > 1) ? argv[1] : "points.dat";
const char* filename = (argc > 1) ? argv[1] : "points.dat";
// Open the input file.
std::ifstream in_file (filename);
std::ifstream in_file(filename);
if (! in_file.is_open()) {
std::cerr << "Failed to open " << filename << "!" << std::endl;
@ -36,30 +36,30 @@ int main (int argc, char *argv[])
// <x_2> <y_2> // point #2.
// : : : :
// <x_n> <y_n> // point #n.
std::vector<Point_2> points;
std::list<X_monotone_curve_2> dual_lines;
std::vector<Point_2> points;
std::list<X_monotone_curve_2> dual_lines;
unsigned int n;
size_t n;
in_file >> n;
points.resize(n);
unsigned int k;
for (k = 0; k < n; ++k) {
int px, py;
in_file >> px >> py;
points[k] = Point_2 (px, py);
points[k] = Point_2(px, py);
// The line dual to the point (p_x, p_y) is y = p_x*x - p_y,
// or: p_x*x - y - p_y = 0:
dual_lines.push_back (Line_2 (Number_type(px),
Number_type(-1),
Number_type(-py)));
dual_lines.push_back(Line_2(CGAL::Exact_rational(px),
CGAL::Exact_rational(-1),
CGAL::Exact_rational(-py)));
}
in_file.close();
// Construct the dual arrangement by aggragately inserting the lines.
Arrangement_2 arr;
Arrangement_2 arr;
insert (arr, dual_lines.begin(), dual_lines.end());
insert(arr, dual_lines.begin(), dual_lines.end());
std::cout << "The dual arrangement size:" << std::endl
<< "V = " << arr.number_of_vertices()
@ -71,8 +71,8 @@ int main (int argc, char *argv[])
<< " unbounded)" << std::endl;
// Look for a vertex whose degree is greater than 4.
Arrangement_2::Vertex_const_iterator vit;
bool found_collinear = false;
Arrangement_2::Vertex_const_iterator vit;
bool found_collinear = false;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
if (vit->degree() > 4) {
@ -89,15 +89,14 @@ int main (int argc, char *argv[])
// Pick two points from the input set, compute their midpoint and insert
// its dual line into the arrangement.
Kernel ker;
const int k1 = std::rand() % n, k2 = (k1 + 1) % n;
Point_2 p_mid = ker.construct_midpoint_2_object() (points[k1],
points[k2]);
X_monotone_curve_2 dual_p_mid = Line_2 (Number_type(p_mid.x()),
Number_type(-1),
Number_type(-p_mid.y()));
Kernel ker;
const int k1 = std::rand() % n, k2 = (k1 + 1) % n;
Point_2 p_mid = ker.construct_midpoint_2_object()(points[k1], points[k2]);
X_monotone_curve_2 dual_p_mid = Line_2(CGAL::Exact_rational(p_mid.x()),
CGAL::Exact_rational(-1),
CGAL::Exact_rational(-p_mid.y()));
insert (arr, dual_p_mid);
insert(arr, dual_p_mid);
// Make sure that we now have three collinear points.
found_collinear = false;
@ -107,6 +106,7 @@ int main (int argc, char *argv[])
break;
}
}
CGAL_assertion (found_collinear);
CGAL_assertion(found_collinear);
return (0);
}

View File

@ -2,13 +2,13 @@
// Checking whether there are three collinear points in a given input set
// using the arrangement of the dual lines.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_linear_traits_2.h>
#include <CGAL/Arr_curve_data_traits_2.h>
#include <CGAL/Arrangement_2.h>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_linear_traits_2<Kernel> Linear_traits_2;
typedef Linear_traits_2::Point_2 Point_2;
typedef Linear_traits_2::Line_2 Line_2;
@ -17,14 +17,14 @@ typedef CGAL::Arr_curve_data_traits_2<Linear_traits_2,
typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main (int argc, char *argv[])
int main(int argc, char *argv[])
{
// Get the name of the input file from the command line, or use the default
// points.dat file if no command-line parameters are given.
const char * filename = (argc > 1) ? argv[1] : "coll_points.dat";
// Open the input file.
std::ifstream in_file (filename);
std::ifstream in_file(filename);
if (! in_file.is_open()) {
std::cerr << "Failed to open " << filename << " ..." << std::endl;
@ -35,35 +35,35 @@ int main (int argc, char *argv[])
std::vector<Point_2> points;
std::list<X_monotone_curve_2> dual_lines;
unsigned int n;
size_t n;
in_file >> n;
points.resize (n);
unsigned int k;
points.resize(n);
size_t k;
for (k = 0; k < n; ++k) {
int px, py;
in_file >> px >> py;
points[k] = Point_2 (px, py);
points[k] = Point_2(px, py);
// The line dual to the point (p_x, p_y) is y = p_x*x - p_y,
// or: p_x*x - y - p_y = 0:
Line_2 dual_line = Line_2(Number_type(px),
Number_type(-1),
Number_type(-py));
Line_2 dual_line = Line_2(CGAL::Exact_rational(px),
CGAL::Exact_rational(-1),
CGAL::Exact_rational(-py));
// Generate the x-monotone curve based on the line and the point index.
dual_lines.push_back (X_monotone_curve_2 (dual_line, k));
dual_lines.push_back(X_monotone_curve_2(dual_line, k));
}
in_file.close();
// Construct the dual arrangement by aggragately inserting the lines.
Arrangement_2 arr;
Arrangement_2 arr;
insert (arr, dual_lines.begin(), dual_lines.end());
insert(arr, dual_lines.begin(), dual_lines.end());
// Look for vertices whose degree is greater than 4.
Arrangement_2::Vertex_const_iterator vit;
Arrangement_2::Halfedge_around_vertex_const_circulator circ;
unsigned int d;
Arrangement_2::Vertex_const_iterator vit;
Arrangement_2::Halfedge_around_vertex_const_circulator circ;
size_t d;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
if (vit->degree() > 4) {

View File

@ -1,12 +1,12 @@
//! \file examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp
// Removing curves and manipulating edges in an arrangement with history.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_circle_segment_traits_2.h>
#include <CGAL/Arrangement_with_history_2.h>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef Kernel::Point_2 Rat_point_2;
typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
@ -21,10 +21,10 @@ int main()
{
// Construct an arrangement containing nine circles: C[0] of radius 2 and
// C[1], ..., C[8] of radius 1.
const Number_type _7_halves = Number_type(7, 2);
Arr_with_hist_2 arr;
Curve_2 C[9];
Curve_handle handles[9];
const CGAL::Exact_rational _7_halves = CGAL::Exact_rational(7, 2);
Arr_with_hist_2 arr;
Curve_2 C[9];
Curve_handle handles[9];
C[0] = Circle_2(Rat_point_2(_7_halves, _7_halves), 4, CGAL::CLOCKWISE);
C[1] = Circle_2(Rat_point_2(_7_halves, 6), 1, CGAL::CLOCKWISE);
@ -36,7 +36,7 @@ int main()
C[7] = Circle_2(Rat_point_2(1, _7_halves), 1, CGAL::CLOCKWISE);
C[8] = Circle_2(Rat_point_2(2, 5), 1, CGAL::CLOCKWISE);
unsigned int k;
size_t k;
for (k = 0; k < 9; k++)
handles[k] = insert(arr, C[k]);
@ -65,7 +65,7 @@ int main()
CGAL_assertion(success);
// Split the edge e to two edges e1 and e2;
Arr_with_hist_2::Halfedge_handle e1, e2;
Arr_with_hist_2::Halfedge_handle e1, e2;
e1 = arr.split_edge(arr.non_const_handle(e), q);
e2 = e1->next();

View File

@ -1,14 +1,14 @@
//! \file examples/Arrangement_on_surface_2/face_extension.cpp
// Extending the arrangement-face records.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_extended_dcel.h>
#include <CGAL/Arr_observer.h>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;

View File

@ -1,15 +1,15 @@
//! \file examples/Arrangement_on_surface_2/face_extension_overlay.cpp
// A face overlay of two arrangements with extended face records.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_extended_dcel.h>
#include <CGAL/Arr_overlay_2.h>
#include <CGAL/Arr_default_overlay_traits.h>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;

View File

@ -2,8 +2,8 @@
// Associating a name attribute with segments using the generic curve-data
// traits.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_polyline_traits_2.h>
#include <CGAL/Arr_curve_data_traits_2.h>
@ -21,7 +21,7 @@ struct Merge_names
}
};
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Segment_traits_2;
typedef CGAL::Arr_polyline_traits_2<Segment_traits_2> Polyline_traits_2;
typedef Polyline_traits_2::Curve_2 Polyline_2;

View File

@ -1,8 +1,8 @@
//! \file examples/Arrangement_on_surface_2/io.cpp
// Using the arrangement I/O operators.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/IO/Arr_iostream.h>
@ -10,7 +10,7 @@
#include "point_location_utils.h"
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;

View File

@ -1,14 +1,14 @@
//! \file examples/Arrangement_on_surface_2/io_curve_history.cpp
// Using the arrangement-with-history I/O operators.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_with_history_2.h>
#include <CGAL/IO/Arr_with_history_iostream.h>
#include <fstream>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::Curve_2 Segment_2;

View File

@ -1,15 +1,15 @@
//! \file examples/Arrangement_2/io_unbounded.cpp
// Using the I/O operators with an arrangement of unbounded curves.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_linear_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/IO/Arr_iostream.h>
#include <list>
#include <fstream>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_linear_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::Segment_2 Segment_2;

View File

@ -1,14 +1,14 @@
//! \file examples/Arrangement_on_surface_2/overlay.cpp
// A simple overlay of two arrangements.
#include "arr_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_overlay_2.h>
#include <CGAL/Arr_default_overlay_traits.h>
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;