mirror of https://github.com/CGAL/cgal
Cleaned up. Replaced local definition of exact rational with CGAL::Exact_rational
This commit is contained in:
parent
86b9fbb22a
commit
a4cf9f5f12
|
|
@ -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
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp
|
//! \file examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp
|
||||||
// Adapting the dual of an arrangement to a BGL graph.
|
// Adapting the dual of an arrangement to a BGL graph.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arr_extended_dcel.h>
|
#include <CGAL/Arr_extended_dcel.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
|
|
@ -38,7 +38,7 @@ public:
|
||||||
{ key->set_data(val); }
|
{ 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_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef CGAL::Arr_face_extended_dcel<Traits_2, unsigned int> Dcel;
|
typedef CGAL::Arr_face_extended_dcel<Traits_2, unsigned int> Dcel;
|
||||||
typedef CGAL::Arrangement_2<Traits_2, Dcel> Ex_arrangement;
|
typedef CGAL::Arrangement_2<Traits_2, Dcel> Ex_arrangement;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp
|
//! \file examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp
|
||||||
// Adapting an arrangement to a BGL graph.
|
// Adapting an arrangement to a BGL graph.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
#include <CGAL/graph_traits_Arrangement_2.h>
|
#include <CGAL/graph_traits_Arrangement_2.h>
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include <CGAL/property_map.h>
|
#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 CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/circles.cpp
|
//! \file examples/Arrangement_on_surface_2/circles.cpp
|
||||||
// Constructing an arrangement of circles using the conic-arc traits.
|
// Constructing an arrangement of circles using the conic-arc traits.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_circle_segment_traits_2.h>
|
#include <CGAL/Arr_circle_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_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::Circle_2 Circle_2;
|
||||||
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
|
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::CoordNT CoordNT;
|
typedef Traits_2::CoordNT CoordNT;
|
||||||
|
|
@ -18,19 +18,19 @@ int main ()
|
||||||
{
|
{
|
||||||
// Create a circle centered at the origin with radius 5.
|
// Create a circle centered at the origin with radius 5.
|
||||||
Kernel::Point_2 c1 = Kernel::Point_2(0, 0);
|
Kernel::Point_2 c1 = Kernel::Point_2(0, 0);
|
||||||
Number_type sqr_r1 = Number_type (25); // = 5^2
|
CGAL::Exact_rational sqr_r1 = CGAL::Exact_rational(25); // = 5^2
|
||||||
Circle_2 circ1 = Circle_2(c1, sqr_r1, CGAL::CLOCKWISE);
|
Circle_2 circ1 = Circle_2(c1, sqr_r1, CGAL::CLOCKWISE);
|
||||||
Curve_2 cv1 = Curve_2(circ1);
|
Curve_2 cv1 = Curve_2(circ1);
|
||||||
|
|
||||||
// Create a circle centered at (7,7) with radius 5.
|
// Create a circle centered at (7,7) with radius 5.
|
||||||
Kernel::Point_2 c2 = Kernel::Point_2(7, 7);
|
Kernel::Point_2 c2 = Kernel::Point_2(7, 7);
|
||||||
Number_type sqr_r2 = Number_type (25); // = 5^2
|
CGAL::Exact_rational sqr_r2 = CGAL::Exact_rational(25); // = 5^2
|
||||||
Circle_2 circ2 = Circle_2(c2, sqr_r2, CGAL::CLOCKWISE);
|
Circle_2 circ2 = Circle_2(c2, sqr_r2, CGAL::CLOCKWISE);
|
||||||
Curve_2 cv2 = Curve_2(circ2);
|
Curve_2 cv2 = Curve_2(circ2);
|
||||||
|
|
||||||
// Create a circle centered at (4,-0.5) with radius 3.5 (= 7/2).
|
// 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));
|
Kernel::Point_2 c3 = Kernel::Point_2(4, CGAL::Exact_rational(-1,2));
|
||||||
Number_type sqr_r3 = Number_type (49, 4); // = 3.5^2
|
CGAL::Exact_rational sqr_r3 = CGAL::Exact_rational(49, 4); // = 3.5^2
|
||||||
Circle_2 circ3 = Circle_2(c3, sqr_r3, CGAL::CLOCKWISE);
|
Circle_2 circ3 = Circle_2(c3, sqr_r3, CGAL::CLOCKWISE);
|
||||||
Curve_2 cv3 = Curve_2(circ3);
|
Curve_2 cv3 = Curve_2(circ3);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/circular_arc.cpp
|
//! \file examples/Arrangement_on_surface_2/circular_arc.cpp
|
||||||
// Constructing an arrangement of various circular arcs and line segments.
|
// Constructing an arrangement of various circular arcs and line segments.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_circle_segment_traits_2.h>
|
#include <CGAL/Arr_circle_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_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::Circle_2 Circle_2;
|
||||||
typedef Kernel::Segment_2 Segment_2;
|
typedef Kernel::Segment_2 Segment_2;
|
||||||
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
|
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
|
||||||
|
|
@ -21,7 +21,7 @@ int main ()
|
||||||
|
|
||||||
// Create a circle centered at the origin with squared radius 2.
|
// Create a circle centered at the origin with squared radius 2.
|
||||||
Kernel::Point_2 c1 = Kernel::Point_2(0, 0);
|
Kernel::Point_2 c1 = Kernel::Point_2(0, 0);
|
||||||
Circle_2 circ1 = Circle_2 (c1, Number_type (2));
|
Circle_2 circ1 = Circle_2(c1, CGAL::Exact_rational(2));
|
||||||
|
|
||||||
curves.push_back(Curve_2(circ1));
|
curves.push_back(Curve_2(circ1));
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ int main ()
|
||||||
// as the radius is rational we use a different curve constructor.
|
// 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.
|
// Create a segment of the line (y = x) with rational endpoints.
|
||||||
Kernel::Point_2 s3 = Kernel::Point_2(-2, -2);
|
Kernel::Point_2 s3 = Kernel::Point_2(-2, -2);
|
||||||
|
|
@ -63,9 +63,11 @@ int main ()
|
||||||
// (-1/2, sqrt(3)/2) to (1/2, sqrt(3)/2). Note that we orient the
|
// (-1/2, sqrt(3)/2) to (1/2, sqrt(3)/2). Note that we orient the
|
||||||
// supporting circle accordingly.
|
// supporting circle accordingly.
|
||||||
Kernel::Point_2 c6 = Kernel::Point_2(0, 0);
|
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));
|
CoordNT sqrt_3_div_2 = CoordNT(CGAL::Exact_rational(0),
|
||||||
Point_2 s6 = Point_2 (Number_type (-1, 2), sqrt_3_div_2);
|
CGAL::Exact_rational(1,2),
|
||||||
Point_2 t6 = Point_2 (Number_type (1, 2), sqrt_3_div_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));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
// Associating a color attribute with segments using the consolidated
|
// Associating a color attribute with segments using the consolidated
|
||||||
// curve-data traits.
|
// curve-data traits.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arr_consolidated_curve_data_traits_2.h>
|
#include <CGAL/Arr_consolidated_curve_data_traits_2.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
|
|
@ -14,7 +14,7 @@ enum Segment_color {
|
||||||
BLUE
|
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 CGAL::Arr_segment_traits_2<Kernel> Segment_traits_2;
|
||||||
typedef Segment_traits_2::Curve_2 Segment_2;
|
typedef Segment_traits_2::Curve_2 Segment_2;
|
||||||
typedef CGAL::Arr_consolidated_curve_data_traits_2
|
typedef CGAL::Arr_consolidated_curve_data_traits_2
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/curve_history.cpp
|
//! \file examples/Arrangement_on_surface_2/curve_history.cpp
|
||||||
// Constructing an arrangement with curve history.
|
// Constructing an arrangement with curve history.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
|
|
||||||
#include <CGAL/Arrangement_on_surface_with_history_2.h>
|
#include <CGAL/Arrangement_on_surface_with_history_2.h>
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "point_location_utils.h"
|
#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::Arr_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::Curve_2 Segment_2;
|
typedef Traits_2::Curve_2 Segment_2;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/dcel_extension.cpp
|
//! \file examples/Arrangement_on_surface_2/dcel_extension.cpp
|
||||||
// Extending all DCEL records (vertices, edges and faces).
|
// Extending all DCEL records (vertices, edges and faces).
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
#include <CGAL/Arr_extended_dcel.h>
|
#include <CGAL/Arr_extended_dcel.h>
|
||||||
|
|
||||||
enum Color {BLUE, RED, WHITE};
|
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 CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/dcel_extension_io.cpp
|
//! \file examples/Arrangement_on_surface_2/dcel_extension_io.cpp
|
||||||
// Using the I/O operators for arrangements with extended DCEL records.
|
// Using the I/O operators for arrangements with extended DCEL records.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arr_extended_dcel.h>
|
#include <CGAL/Arr_extended_dcel.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
|
|
@ -39,7 +39,7 @@ std::istream& operator>> (std::istream& is, Color& color)
|
||||||
return (is);
|
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 CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
// Checking whether there are three collinear points in a given input set
|
// Checking whether there are three collinear points in a given input set
|
||||||
// using the arrangement of the dual lines.
|
// using the arrangement of the dual lines.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_linear_traits_2.h>
|
#include <CGAL/Arr_linear_traits_2.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
#include <cstdlib>
|
#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 CGAL::Arr_linear_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::Line_2 Line_2;
|
typedef Traits_2::Line_2 Line_2;
|
||||||
|
|
@ -39,7 +39,7 @@ int main (int argc, char *argv[])
|
||||||
std::vector<Point_2> points;
|
std::vector<Point_2> points;
|
||||||
std::list<X_monotone_curve_2> dual_lines;
|
std::list<X_monotone_curve_2> dual_lines;
|
||||||
|
|
||||||
unsigned int n;
|
size_t n;
|
||||||
in_file >> n;
|
in_file >> n;
|
||||||
points.resize(n);
|
points.resize(n);
|
||||||
unsigned int k;
|
unsigned int k;
|
||||||
|
|
@ -50,9 +50,9 @@ int main (int argc, char *argv[])
|
||||||
|
|
||||||
// The line dual to the point (p_x, p_y) is y = p_x*x - p_y,
|
// 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:
|
// or: p_x*x - y - p_y = 0:
|
||||||
dual_lines.push_back (Line_2 (Number_type(px),
|
dual_lines.push_back(Line_2(CGAL::Exact_rational(px),
|
||||||
Number_type(-1),
|
CGAL::Exact_rational(-1),
|
||||||
Number_type(-py)));
|
CGAL::Exact_rational(-py)));
|
||||||
}
|
}
|
||||||
in_file.close();
|
in_file.close();
|
||||||
|
|
||||||
|
|
@ -91,11 +91,10 @@ int main (int argc, char *argv[])
|
||||||
// its dual line into the arrangement.
|
// its dual line into the arrangement.
|
||||||
Kernel ker;
|
Kernel ker;
|
||||||
const int k1 = std::rand() % n, k2 = (k1 + 1) % n;
|
const int k1 = std::rand() % n, k2 = (k1 + 1) % n;
|
||||||
Point_2 p_mid = ker.construct_midpoint_2_object() (points[k1],
|
Point_2 p_mid = ker.construct_midpoint_2_object()(points[k1], points[k2]);
|
||||||
points[k2]);
|
X_monotone_curve_2 dual_p_mid = Line_2(CGAL::Exact_rational(p_mid.x()),
|
||||||
X_monotone_curve_2 dual_p_mid = Line_2 (Number_type(p_mid.x()),
|
CGAL::Exact_rational(-1),
|
||||||
Number_type(-1),
|
CGAL::Exact_rational(-p_mid.y()));
|
||||||
Number_type(-p_mid.y()));
|
|
||||||
|
|
||||||
insert(arr, dual_p_mid);
|
insert(arr, dual_p_mid);
|
||||||
|
|
||||||
|
|
@ -108,5 +107,6 @@ int main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CGAL_assertion(found_collinear);
|
CGAL_assertion(found_collinear);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
// Checking whether there are three collinear points in a given input set
|
// Checking whether there are three collinear points in a given input set
|
||||||
// using the arrangement of the dual lines.
|
// using the arrangement of the dual lines.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_linear_traits_2.h>
|
#include <CGAL/Arr_linear_traits_2.h>
|
||||||
#include <CGAL/Arr_curve_data_traits_2.h>
|
#include <CGAL/Arr_curve_data_traits_2.h>
|
||||||
#include <CGAL/Arrangement_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 CGAL::Arr_linear_traits_2<Kernel> Linear_traits_2;
|
||||||
typedef Linear_traits_2::Point_2 Point_2;
|
typedef Linear_traits_2::Point_2 Point_2;
|
||||||
typedef Linear_traits_2::Line_2 Line_2;
|
typedef Linear_traits_2::Line_2 Line_2;
|
||||||
|
|
@ -35,10 +35,10 @@ int main (int argc, char *argv[])
|
||||||
std::vector<Point_2> points;
|
std::vector<Point_2> points;
|
||||||
std::list<X_monotone_curve_2> dual_lines;
|
std::list<X_monotone_curve_2> dual_lines;
|
||||||
|
|
||||||
unsigned int n;
|
size_t n;
|
||||||
in_file >> n;
|
in_file >> n;
|
||||||
points.resize(n);
|
points.resize(n);
|
||||||
unsigned int k;
|
size_t k;
|
||||||
for (k = 0; k < n; ++k) {
|
for (k = 0; k < n; ++k) {
|
||||||
int px, py;
|
int px, py;
|
||||||
in_file >> px >> py;
|
in_file >> px >> py;
|
||||||
|
|
@ -46,9 +46,9 @@ int main (int argc, char *argv[])
|
||||||
|
|
||||||
// The line dual to the point (p_x, p_y) is y = p_x*x - p_y,
|
// 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:
|
// or: p_x*x - y - p_y = 0:
|
||||||
Line_2 dual_line = Line_2(Number_type(px),
|
Line_2 dual_line = Line_2(CGAL::Exact_rational(px),
|
||||||
Number_type(-1),
|
CGAL::Exact_rational(-1),
|
||||||
Number_type(-py));
|
CGAL::Exact_rational(-py));
|
||||||
|
|
||||||
// Generate the x-monotone curve based on the line and the point index.
|
// 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));
|
||||||
|
|
@ -63,7 +63,7 @@ int main (int argc, char *argv[])
|
||||||
// Look for vertices whose degree is greater than 4.
|
// Look for vertices whose degree is greater than 4.
|
||||||
Arrangement_2::Vertex_const_iterator vit;
|
Arrangement_2::Vertex_const_iterator vit;
|
||||||
Arrangement_2::Halfedge_around_vertex_const_circulator circ;
|
Arrangement_2::Halfedge_around_vertex_const_circulator circ;
|
||||||
unsigned int d;
|
size_t d;
|
||||||
|
|
||||||
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
|
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
|
||||||
if (vit->degree() > 4) {
|
if (vit->degree() > 4) {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp
|
//! \file examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp
|
||||||
// Removing curves and manipulating edges in an arrangement with history.
|
// Removing curves and manipulating edges in an arrangement with history.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_circle_segment_traits_2.h>
|
#include <CGAL/Arr_circle_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_with_history_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::Point_2 Rat_point_2;
|
||||||
typedef Kernel::Circle_2 Circle_2;
|
typedef Kernel::Circle_2 Circle_2;
|
||||||
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
|
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits_2;
|
||||||
|
|
@ -21,7 +21,7 @@ int main()
|
||||||
{
|
{
|
||||||
// Construct an arrangement containing nine circles: C[0] of radius 2 and
|
// Construct an arrangement containing nine circles: C[0] of radius 2 and
|
||||||
// C[1], ..., C[8] of radius 1.
|
// C[1], ..., C[8] of radius 1.
|
||||||
const Number_type _7_halves = Number_type(7, 2);
|
const CGAL::Exact_rational _7_halves = CGAL::Exact_rational(7, 2);
|
||||||
Arr_with_hist_2 arr;
|
Arr_with_hist_2 arr;
|
||||||
Curve_2 C[9];
|
Curve_2 C[9];
|
||||||
Curve_handle handles[9];
|
Curve_handle handles[9];
|
||||||
|
|
@ -36,7 +36,7 @@ int main()
|
||||||
C[7] = Circle_2(Rat_point_2(1, _7_halves), 1, CGAL::CLOCKWISE);
|
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);
|
C[8] = Circle_2(Rat_point_2(2, 5), 1, CGAL::CLOCKWISE);
|
||||||
|
|
||||||
unsigned int k;
|
size_t k;
|
||||||
for (k = 0; k < 9; k++)
|
for (k = 0; k < 9; k++)
|
||||||
handles[k] = insert(arr, C[k]);
|
handles[k] = insert(arr, C[k]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/face_extension.cpp
|
//! \file examples/Arrangement_on_surface_2/face_extension.cpp
|
||||||
// Extending the arrangement-face records.
|
// Extending the arrangement-face records.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
#include <CGAL/Arr_extended_dcel.h>
|
#include <CGAL/Arr_extended_dcel.h>
|
||||||
#include <CGAL/Arr_observer.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 CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/face_extension_overlay.cpp
|
//! \file examples/Arrangement_on_surface_2/face_extension_overlay.cpp
|
||||||
// A face overlay of two arrangements with extended face records.
|
// A face overlay of two arrangements with extended face records.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
#include <CGAL/Arr_extended_dcel.h>
|
#include <CGAL/Arr_extended_dcel.h>
|
||||||
#include <CGAL/Arr_overlay_2.h>
|
#include <CGAL/Arr_overlay_2.h>
|
||||||
#include <CGAL/Arr_default_overlay_traits.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 CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
// Associating a name attribute with segments using the generic curve-data
|
// Associating a name attribute with segments using the generic curve-data
|
||||||
// traits.
|
// traits.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arr_polyline_traits_2.h>
|
#include <CGAL/Arr_polyline_traits_2.h>
|
||||||
#include <CGAL/Arr_curve_data_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_segment_traits_2<Kernel> Segment_traits_2;
|
||||||
typedef CGAL::Arr_polyline_traits_2<Segment_traits_2> Polyline_traits_2;
|
typedef CGAL::Arr_polyline_traits_2<Segment_traits_2> Polyline_traits_2;
|
||||||
typedef Polyline_traits_2::Curve_2 Polyline_2;
|
typedef Polyline_traits_2::Curve_2 Polyline_2;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/io.cpp
|
//! \file examples/Arrangement_on_surface_2/io.cpp
|
||||||
// Using the arrangement I/O operators.
|
// Using the arrangement I/O operators.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
#include <CGAL/IO/Arr_iostream.h>
|
#include <CGAL/IO/Arr_iostream.h>
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "point_location_utils.h"
|
#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::Arr_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/io_curve_history.cpp
|
//! \file examples/Arrangement_on_surface_2/io_curve_history.cpp
|
||||||
// Using the arrangement-with-history I/O operators.
|
// Using the arrangement-with-history I/O operators.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_with_history_2.h>
|
#include <CGAL/Arrangement_with_history_2.h>
|
||||||
#include <CGAL/IO/Arr_with_history_iostream.h>
|
#include <CGAL/IO/Arr_with_history_iostream.h>
|
||||||
#include <fstream>
|
#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 CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::Curve_2 Segment_2;
|
typedef Traits_2::Curve_2 Segment_2;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
//! \file examples/Arrangement_2/io_unbounded.cpp
|
//! \file examples/Arrangement_2/io_unbounded.cpp
|
||||||
// Using the I/O operators with an arrangement of unbounded curves.
|
// Using the I/O operators with an arrangement of unbounded curves.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_linear_traits_2.h>
|
#include <CGAL/Arr_linear_traits_2.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
#include <CGAL/IO/Arr_iostream.h>
|
#include <CGAL/IO/Arr_iostream.h>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <fstream>
|
#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 CGAL::Arr_linear_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::Segment_2 Segment_2;
|
typedef Traits_2::Segment_2 Segment_2;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
//! \file examples/Arrangement_on_surface_2/overlay.cpp
|
//! \file examples/Arrangement_on_surface_2/overlay.cpp
|
||||||
// A simple overlay of two arrangements.
|
// A simple overlay of two arrangements.
|
||||||
|
|
||||||
#include "arr_rational_nt.h"
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
#include <CGAL/Exact_rational.h>
|
||||||
#include <CGAL/Arr_segment_traits_2.h>
|
#include <CGAL/Arr_segment_traits_2.h>
|
||||||
#include <CGAL/Arrangement_2.h>
|
#include <CGAL/Arrangement_2.h>
|
||||||
#include <CGAL/Arr_overlay_2.h>
|
#include <CGAL/Arr_overlay_2.h>
|
||||||
#include <CGAL/Arr_default_overlay_traits.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 CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||||
typedef Traits_2::Point_2 Point_2;
|
typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue