This commit is contained in:
Efi Fogel 2020-10-29 15:02:48 +02:00
parent 39067ddbcd
commit 6e3978daf5
60 changed files with 424 additions and 615 deletions

View File

@ -5,8 +5,7 @@
#include "arr_print.h" #include "arr_print.h"
#include "read_objects.h" #include "read_objects.h"
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 // Get the name of the input file from the command line, or use the default
// Bezier.dat file if no command-line parameters are given. // Bezier.dat file if no command-line parameters are given.
const char* filename = (argc > 1) ? argv[1] : "Bezier.dat"; const char* filename = (argc > 1) ? argv[1] : "Bezier.dat";

View File

@ -4,8 +4,7 @@
#include "arr_exact_construction_segments.h" #include "arr_exact_construction_segments.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
// Aggregately construct the arrangement of five line segments. // Aggregately construct the arrangement of five line segments.
Segment segments[] = {Segment(Point(1, 0), Point(2, 4)), Segment segments[] = {Segment(Point(1, 0), Point(2, 4)),
Segment(Point(5, 0), Point(5, 5)), Segment(Point(5, 0), Point(5, 5)),

View File

@ -16,8 +16,7 @@ typedef CGAL::Arrangement_2<Traits> Arrangement;
typedef Traits::Curve_2 Curve; typedef Traits::Curve_2 Curve;
typedef Traits::Polynomial_2 Polynomial; typedef Traits::Polynomial_2 Polynomial;
int main() int main() {
{
CGAL::set_pretty_mode(std::cout); // for nice printouts. CGAL::set_pretty_mode(std::cout); // for nice printouts.
Traits traits; Traits traits;

View File

@ -19,9 +19,8 @@ typedef Traits::Algebraic_real_1 Algebraic_real;
typedef Traits::X_monotone_curve_2 X_monotone_curve; typedef Traits::X_monotone_curve_2 X_monotone_curve;
typedef Traits::Point_2 Point; typedef Traits::Point_2 Point;
int main() int main() {
{ Traits traits;
Traits traits;
auto make_xmon = traits.make_x_monotone_2_object(); auto make_xmon = traits.make_x_monotone_2_object();
auto ctr_cv = traits.construct_curve_2_object(); auto ctr_cv = traits.construct_curve_2_object();

View File

@ -15,6 +15,7 @@ typedef CGAL::Cartesian<Algebraic> Alg_kernel;
typedef Rat_kernel::Point_2 Rat_point; typedef Rat_kernel::Point_2 Rat_point;
typedef CGAL::Arr_Bezier_curve_traits_2<Rat_kernel, Alg_kernel, Nt_traits> typedef CGAL::Arr_Bezier_curve_traits_2<Rat_kernel, Alg_kernel, Nt_traits>
Traits; Traits;
typedef Traits::X_monotone_curve_2 Bezier_x_monotone_curve;
typedef Traits::Curve_2 Bezier_curve; typedef Traits::Curve_2 Bezier_curve;
typedef CGAL::Arrangement_2<Traits> Arrangement; typedef CGAL::Arrangement_2<Traits> Arrangement;

View File

@ -11,6 +11,7 @@ typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits;
typedef Traits::CoordNT CoordNT; typedef Traits::CoordNT CoordNT;
typedef Traits::Point_2 Point; typedef Traits::Point_2 Point;
typedef Traits::Curve_2 Curve; typedef Traits::Curve_2 Curve;
typedef Traits::X_monotone_curve_2 X_monotone_curve;
typedef Traits::Rational_point_2 Rational_point; typedef Traits::Rational_point_2 Rational_point;
typedef Traits::Rational_segment_2 Segment; typedef Traits::Rational_segment_2 Segment;
typedef Traits::Rational_circle_2 Circle; typedef Traits::Rational_circle_2 Circle;

View File

@ -19,5 +19,8 @@ typedef CGAL::Arrangement_2<Traits> Arrangement;
typedef Arrangement::Vertex_handle Vertex_handle; typedef Arrangement::Vertex_handle Vertex_handle;
typedef Arrangement::Halfedge_handle Halfedge_handle; typedef Arrangement::Halfedge_handle Halfedge_handle;
typedef Arrangement::Face_handle Face_handle; typedef Arrangement::Face_handle Face_handle;
typedef Arrangement::Vertex_const_handle Vertex_const_handle;
typedef Arrangement::Halfedge_const_handle Halfedge_const_handle;
typedef Arrangement::Face_const_handle Face_const_handle;
#endif #endif

View File

@ -13,8 +13,7 @@
typedef CGAL::Arr_point_location_result<Arrangement> Point_location_result; typedef CGAL::Arr_point_location_result<Arrangement> Point_location_result;
typedef std::pair<Point, Point_location_result::Type> Query_result; typedef std::pair<Point, Point_location_result::Type> Query_result;
int main() int main() {
{
// Construct the arrangement. // Construct the arrangement.
Arrangement arr; Arrangement arr;
construct_segments_arr(arr); construct_segments_arr(arr);

View File

@ -12,8 +12,7 @@ typedef std::pair<CGAL::Object, CGAL::Object> Object_pair;
typedef std::pair<Vertex_const_handle, Object_pair> Vert_decomp_entry; typedef std::pair<Vertex_const_handle, Object_pair> Vert_decomp_entry;
typedef std::list<Vert_decomp_entry> Vert_decomp_list; typedef std::list<Vert_decomp_entry> Vert_decomp_list;
int main() int main() {
{
// Construct the arrangement. // Construct the arrangement.
Segment segments[] = {Segment(Point(0, 0), Point(3, 3)), Segment segments[] = {Segment(Point(0, 0), Point(3, 3)),
Segment(Point(3, 3), Point(6, 0)), Segment(Point(3, 3), Point(6, 0)),

View File

@ -3,9 +3,8 @@
#include "arr_circular.h" #include "arr_circular.h"
int main() int main() {
{ Arrangement arr;
Arrangement_2 arr;
// Create a circle centered at the origin with radius 5 (C1). // Create a circle centered at the origin with radius 5 (C1).
insert(arr, Curve(Circle(Rational_point(0, 0), Number_type(25)))); insert(arr, Curve(Circle(Rational_point(0, 0), Number_type(25))));
@ -17,10 +16,13 @@ int main()
Rational_point c3(4, Number_type(-1) / Number_type(2)); Rational_point c3(4, Number_type(-1) / Number_type(2));
insert(arr, Curve(Circle(c3, Number_type(49) / Number_type(4)))); insert(arr, Curve(Circle(c3, Number_type(49) / Number_type(4))));
// Locate the vertex with maximal degree.
auto vit = arr.vertices_begin();
Arrangement::Vertex_const_handle v_max = vit;
for (++vit; vit != arr.vertices_end(); ++vit)
if (vit->degree() > v_max->degree()) v_max = vit;
// Locate the vertex with maximum degree. // Locate the vertex with maximum degree.
Arrangement_2::Vertex_const_handle v_max;
for (auto vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit)
if (vit->degree() > max_degree) v_max = vit;
std::cout << "The vertex with maximal degree in the arrangement is: " std::cout << "The vertex with maximal degree in the arrangement is: "
<< "v_max = (" << v_max->point() << ") " << "v_max = (" << v_max->point() << ") "

View File

@ -4,8 +4,7 @@
#include "arr_circular.h" #include "arr_circular.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
std::list<Curve> curves; std::list<Curve> curves;
// Create a circle (C1) centered at the origin with squared radius 2. // Create a circle (C1) centered at the origin with squared radius 2.

View File

@ -33,8 +33,7 @@ typedef CGAL::Arr_circular_line_arc_traits_2<Circular_k> Traits;
typedef CGAL::Arrangement_2<Traits> Arrangement; typedef CGAL::Arrangement_2<Traits> Arrangement;
typedef CGAL::Arr_naive_point_location<Arrangement> Point_location; typedef CGAL::Arr_naive_point_location<Arrangement> Point_location;
int main() int main() {
{
CGAL::Random generatorOfgenerator; CGAL::Random generatorOfgenerator;
int random_seed = generatorOfgenerator.get_int(0, 123456); int random_seed = generatorOfgenerator.get_int(0, 123456);
std::cout << "random_seed = " << random_seed << std::endl; std::cout << "random_seed = " << random_seed << std::endl;

View File

@ -1,32 +1,34 @@
//! \file examples/Arrangement_on_surface_2/conic_multiplicities.cpp //! \file examples/Arrangement_on_surface_2/conic_multiplicities.cpp
// Handling intersection points with multiplicity between conic arcs. // Handling intersection points with multiplicity between conic arcs.
#include <CGAL/basic.h>
#include <CGAL/Arr_naive_point_location.h>
#include "arr_conics.h" #include "arr_conics.h"
#include "arr_print.h" #include "arr_print.h"
int main () typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl;
{
Arrangement_2 arr; int main() {
Arrangement arr;
Naive_pl pl(arr); Naive_pl pl(arr);
// Insert a hyperbolic arc, supported by the hyperbola y = x^2/(1-x) // Insert a hyperbolic arc, supported by the hyperbola y = x^2/(1-x)
// (or: x^2 + xy - y = 0) with the endpoints (-1, 1/2) and (1/2, 1/2). // (or: x^2 + xy - y = 0) with the endpoints (-1, 1/2) and (1/2, 1/2).
// Note that the arc is counterclockwise oriented. // Note that the arc is counterclockwise oriented.
Point_2 ps1(-1, Rational(1,2)); Point ps1(-1, Rational(1,2));
Point_2 pt1(Rational(1,2), Rational(1,2)); Point pt1(Rational(1,2), Rational(1,2));
Conic_arc_2 cv1(1, 0, 1, 0, -1, 0, CGAL::COUNTERCLOCKWISE, ps1, pt1); Conic_arc cv1(1, 0, 1, 0, -1, 0, CGAL::COUNTERCLOCKWISE, ps1, pt1);
insert(arr, cv1, pl); insert(arr, cv1, pl);
// Insert the bottom half of the circle centered at (0, 1/2) whose radius // Insert the bottom half of the circle centered at (0, 1/2) whose radius
// is 1/2 (therefore its squared radius is 1/4). // is 1/2 (therefore its squared radius is 1/4).
Rat_circle_2 circ2(Rat_point_2(0, Rational(1,2)), Rational(1,4)); Rat_circle circ2(Rat_point(0, Rational(1,2)), Rational(1,4));
Point_2 ps2(-Rational(1,2), Rational(1,2)); Point ps2(-Rational(1,2), Rational(1,2));
Point_2 pt2(Rational(1,2), Rational(1,2)); Point pt2(Rational(1,2), Rational(1,2));
Conic_arc_2 cv2(circ2, CGAL::COUNTERCLOCKWISE, ps2, pt2); Conic_arc cv2(circ2, CGAL::COUNTERCLOCKWISE, ps2, pt2);
insert(arr, cv2, pl); insert(arr, cv2, pl);
print_arrangement (arr); print_arrangement (arr);
return 0; return 0;
} }
#endif

View File

@ -4,8 +4,7 @@
#include "arr_conics.h" #include "arr_conics.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
Arrangement arr; Arrangement arr;
// Insert a hyperbolic arc (C1), supported by the hyperbola y = 1/x // Insert a hyperbolic arc (C1), supported by the hyperbola y = 1/x

View File

@ -7,15 +7,14 @@
#include "arr_exact_construction_segments.h" #include "arr_exact_construction_segments.h"
enum Segment_color { RED, BLUE }; enum Segment_color {RED, BLUE};
typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, Segment_color> typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, Segment_color>
Data_traits; Data_traits;
typedef Data_traits::Curve_2 Colored_segment; typedef Data_traits::Curve_2 Colored_segment;
typedef CGAL::Arrangement_2<Data_traits> Colored_arr; typedef CGAL::Arrangement_2<Data_traits> Colored_arr;
int main() int main() {
{
Colored_arr arr; Colored_arr arr;
// Construct an arrangement containing three RED line segments. // Construct an arrangement containing three RED line segments.

View File

@ -12,8 +12,7 @@ typedef CGAL::Arrangement_with_history_2<Traits> Arr_with_hist;
typedef Arr_with_hist::Curve_handle Curve_handle; typedef Arr_with_hist::Curve_handle Curve_handle;
typedef CGAL::Arr_trapezoid_ric_point_location<Arr_with_hist> Point_location; typedef CGAL::Arr_trapezoid_ric_point_location<Arr_with_hist> Point_location;
int main() int main() {
{
// Insert s1, s2, and s3 incrementally. // Insert s1, s2, and s3 incrementally.
Arr_with_hist arr; Arr_with_hist arr;
Curve_handle s1 = insert(arr, Segment(Point(0, 3), Point(4, 3))); Curve_handle s1 = insert(arr, Segment(Point(0, 3), Point(4, 3)));

View File

@ -11,8 +11,7 @@ enum Color {BLUE, RED, WHITE};
typedef CGAL::Arr_extended_dcel<Traits, Color, bool, unsigned int> Dcel; typedef CGAL::Arr_extended_dcel<Traits, Color, bool, unsigned int> Dcel;
typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement; typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement;
int main () int main() {
{
// Construct the arrangement containing two intersecting triangles. // Construct the arrangement containing two intersecting triangles.
Traits traits; Traits traits;
Ex_arrangement arr(&traits); Ex_arrangement arr(&traits);

View File

@ -1,137 +1,105 @@
//! \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 <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>
#include <CGAL/IO/Arr_text_formatter.h>
#include <CGAL/IO/Arr_iostream.h>
#include <fstream> #include <fstream>
#include <CGAL/basic.h>
#include <CGAL/Arr_extended_dcel.h>
#include <CGAL/IO/Arr_iostream.h>
#include <CGAL/IO/Arr_text_formatter.h>
#include "arr_exact_construction_segments.h"
enum Color {BLUE, RED, WHITE}; enum Color {BLUE, RED, WHITE};
std::ostream& operator<< (std::ostream& os, const Color& color) std::ostream& operator<<(std::ostream& os, const Color& color) {
{ switch (color) {
switch (color) case BLUE: os << "BLUE"; break;
{ case RED: os << "RED"; break;
case BLUE: os << "BLUE"; break; case WHITE: os << "WHITE"; break;
case RED: os << "RED"; break; default: os << "ERROR!";
case WHITE: os << "WHITE"; break;
default: os << "ERROR!";
} }
return (os); return os;
} }
std::istream& operator>> (std::istream& is, Color& color) std::istream& operator>>(std::istream& is, Color& color) {
{ std::string str;
std::string str;
is >> str; is >> str;
if (str == "BLUE") color = BLUE;
if (str == "BLUE") else if (str == "RED") color = RED;
color = BLUE; else if (str == "WHITE") color = WHITE;
else if (str == "RED") return is;
color = RED;
else if (str == "WHITE")
color = WHITE;
return (is);
} }
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel; typedef CGAL::Arr_extended_dcel<Traits, Color, bool, int> Ext_dcel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2; typedef CGAL::Arrangement_2<Traits, Ext_dcel> Ext_arrangement;
typedef Traits_2::Point_2 Point_2; typedef CGAL::Arr_extended_dcel_text_formatter<Ext_arrangement> Formatter;
typedef Traits_2::X_monotone_curve_2 Segment_2;
typedef CGAL::Arr_extended_dcel<Traits_2,
Color, bool, int> Dcel;
typedef CGAL::Arrangement_2<Traits_2, Dcel> Arrangement_2;
typedef CGAL::Arr_extended_dcel_text_formatter<Arrangement_2> Formatter;
int main () int main() {
{
// Construct the arrangement containing two intersecting triangles. // Construct the arrangement containing two intersecting triangles.
Arrangement_2 arr; Ext_arrangement arr;
Segment_2 s1 (Point_2(4, 1), Point_2(7, 6)); Segment s1(Point(4, 1), Point(7, 6));
Segment_2 s2 (Point_2(1, 6), Point_2(7, 6)); Segment s2(Point(1, 6), Point(7, 6));
Segment_2 s3 (Point_2(4, 1), Point_2(1, 6)); Segment s3(Point(4, 1), Point(1, 6));
Segment_2 s4 (Point_2(1, 3), Point_2(7, 3)); Segment s4(Point(1, 3), Point(7, 3));
Segment_2 s5 (Point_2(1, 3), Point_2(4, 8)); Segment s5(Point(1, 3), Point(4, 8));
Segment_2 s6 (Point_2(4, 8), Point_2(7, 3)); Segment s6(Point(4, 8), Point(7, 3));
insert_non_intersecting_curve (arr, s1); insert_non_intersecting_curve(arr, s1);
insert_non_intersecting_curve (arr, s2); insert_non_intersecting_curve(arr, s2);
insert_non_intersecting_curve (arr, s3); insert_non_intersecting_curve(arr, s3);
insert (arr, s4); insert(arr, s4);
insert (arr, s5); insert(arr, s5);
insert (arr, s6); insert(arr, s6);
// Go over all arrangement vertices and set their colors. // Go over all arrangement vertices and set their colors.
Arrangement_2::Vertex_iterator vit; for (auto vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
std::size_t degree; auto degree = vit->degree();
if (degree == 0) vit->set_data(BLUE); // Isolated vertex
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) else if (degree <= 2) vit->set_data(RED); // Vertex represents an endpoint
{ else vit->set_data(WHITE); // Vertex represents an intersection point
degree = vit->degree();
if (degree == 0)
vit->set_data (BLUE); // Isolated vertex.
else if (degree <= 2)
vit->set_data (RED); // Vertex represents an endpoint.
else
vit->set_data (WHITE); // Vertex represents an intersection point.
} }
// Go over all arrangement edges and set their flags. // Go over all arrangement edges and set their flags.
Arrangement_2::Edge_iterator eit; for (auto eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) {
bool flag;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
{
// Check if the halfedge has the same direction as its associated // Check if the halfedge has the same direction as its associated
// segment. Note that its twin always has an opposite direction. // segment. Note that its twin always has an opposite direction.
flag = (eit->source()->point() == eit->curve().source()); auto flag = (eit->source()->point() == eit->curve().source());
eit->set_data (flag); eit->set_data(flag);
eit->twin()->set_data (!flag); eit->twin()->set_data(! flag);
} }
// Go over all arrangement faces and print their outer boundary and indices. // Go over all arrangement faces and print their outer boundary and indices.
Arrangement_2::Face_iterator fit; int boundary_size;
Arrangement_2::Ccb_halfedge_circulator curr; for (auto fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) {
int boundary_size;
for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit)
{
boundary_size = 0; boundary_size = 0;
if (! fit->is_unbounded()) if (! fit->is_unbounded()) {
{ auto curr = fit->outer_ccb();
curr = fit->outer_ccb(); do {
do
{
++boundary_size; ++boundary_size;
++curr; ++curr;
} while (curr != fit->outer_ccb()); } while (curr != fit->outer_ccb());
} }
fit->set_data (boundary_size); fit->set_data(boundary_size);
} }
// Write the arrangement to a file. // Write the arrangement to a file.
std::ofstream out_file ("arr_ex_dcel_io.dat"); std::ofstream out_file("arr_ex_dcel_io.dat");
Formatter formatter; Formatter formatter;
write(arr, out_file, formatter);
write (arr, out_file, formatter);
out_file.close(); out_file.close();
// Read the arrangement from the file. // Read the arrangement from the file.
Arrangement_2 arr2; Ext_arrangement arr2;
std::ifstream in_file ("arr_ex_dcel_io.dat"); std::ifstream in_file("arr_ex_dcel_io.dat");
read (arr2, in_file, formatter); read(arr2, in_file, formatter);
in_file.close(); in_file.close();
std::cout << "The arrangement vertices: " << std::endl; std::cout << "The arrangement vertices: " << std::endl;
for (vit = arr2.vertices_begin(); vit != arr2.vertices_end(); ++vit) for (auto vit = arr2.vertices_begin(); vit != arr2.vertices_end(); ++vit)
std::cout << '(' << vit->point() << ") - " << vit->data() << std::endl; std::cout << '(' << vit->point() << ") - " << vit->data() << std::endl;
return (0); return 0;
} }

View File

@ -7,8 +7,7 @@
#include "arr_linear.h" #include "arr_linear.h"
#include "read_objects.h" #include "read_objects.h"
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 // 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. // 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";

View File

@ -4,42 +4,33 @@
#include <algorithm> #include <algorithm>
#include <CGAL/Cartesian.h> #include <CGAL/basic.h>
#include <CGAL/Exact_rational.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 "arr_linear.h"
#include "read_objects.h" #include "read_objects.h"
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel; typedef CGAL::Arr_curve_data_traits_2<Traits, size_t> Data_traits;
typedef CGAL::Arr_linear_traits_2<Kernel> Linear_traits_2; typedef Data_traits::X_monotone_curve_2 Data_x_monotone_curve_2;
typedef Linear_traits_2::Point_2 Point_2; typedef CGAL::Arrangement_2<Data_traits> Data_arrangement;
typedef Linear_traits_2::Line_2 Line_2;
typedef CGAL::Arr_curve_data_traits_2<Linear_traits_2,
unsigned int> 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 // 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. // points.dat file if no command-line parameters are given.
const char* filename = (argc > 1) ? argv[1] : "coll_points.dat"; const char* filename = (argc > 1) ? argv[1] : "coll_points.dat";
std::vector<Point_2> points; std::vector<Point> points;
read_objects<Point>(filename, std::back_inserter(points));
read_objects<Point_2>(filename, std::back_inserter(points)); std::vector<Data_x_monotone_curve_2> dual_lines(points.size());
std::vector<X_monotone_curve_2> dual_lines(points.size());
size_t k{0}; size_t k{0};
std::transform(points.begin(), points.end(), dual_lines.begin(), std::transform(points.begin(), points.end(), dual_lines.begin(),
[&](const Point_2& p) { [&](const Point& p) {
Line_2 dual_line(p.x(), CGAL::Exact_rational(-1), -(p.y())); Line dual_line(p.x(), -1, -(p.y()));
return X_monotone_curve_2(dual_line, k++); return Data_x_monotone_curve_2(dual_line, k++);
}); });
// Construct the dual arrangement by aggregately inserting the lines. // Construct the dual arrangement by aggregately inserting the lines.
Arrangement_2 arr; Data_arrangement 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. // Look for vertices whose degree is greater than 4.

View File

@ -4,8 +4,7 @@
#include "arr_inexact_construction_segments.h" #include "arr_inexact_construction_segments.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
Point p1(1, 3), p2(3, 5), p3(5, 3), p4(3, 1); Point p1(1, 3), p2(3, 5), p3(5, 3), p4(3, 1);
Segment s1(p1, p2), s2(p2, p3), s3(p3, p4), s4(p4, p1), s5(p1, p3); Segment s1(p1, p2), s2(p2, p3), s3(p3, p4), s4(p4, p1), s5(p1, p3);

View File

@ -4,8 +4,7 @@
#include "arr_inexact_construction_segments.h" #include "arr_inexact_construction_segments.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
// Step (a)---construct a rectangular face. // Step (a)---construct a rectangular face.
Point q1(1, 3), q2(3, 5), q3(5, 3), q4(3, 1); Point q1(1, 3), q2(3, 5), q3(5, 3), q4(3, 1);
Segment s4(q1, q2), s1(q2, q3), s3(q3, q4), s2(q4, q1); Segment s4(q1, q2), s1(q2, q3), s3(q3, q4), s2(q4, q1);

View File

@ -12,8 +12,7 @@ typedef CGAL::Arrangement_with_history_2<Traits> Arr_with_hist;
typedef Arr_with_hist::Curve_handle Curve_handle; typedef Arr_with_hist::Curve_handle Curve_handle;
typedef CGAL::Arr_walk_along_line_point_location<Arr_with_hist> Point_location; typedef CGAL::Arr_walk_along_line_point_location<Arr_with_hist> Point_location;
int main() 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) / Number_type(2); const Number_type _7_halves = Number_type(7) / Number_type(2);

View File

@ -17,7 +17,6 @@ private:
size_t n_faces; // the current number of faces size_t n_faces; // the current number of faces
public: public:
Face_index_observer(Ex_arrangement& arr) : Face_index_observer(Ex_arrangement& arr) :
CGAL::Arr_observer<Ex_arrangement>(arr), n_faces(0) CGAL::Arr_observer<Ex_arrangement>(arr), n_faces(0)
{ {
@ -31,10 +30,9 @@ public:
} }
}; };
int main () int main() {
{
// Construct the arrangement containing two intersecting triangles. // Construct the arrangement containing two intersecting triangles.
Ex_arrangement arr; Ex_arrangement arr;
Face_index_observer obs(arr); Face_index_observer obs(arr);
insert_non_intersecting_curve(arr, Segment(Point(4, 1), Point(7, 6))); insert_non_intersecting_curve(arr, Segment(Point(4, 1), Point(7, 6)));
insert_non_intersecting_curve(arr, Segment(Point(1, 6), Point(7, 6))); insert_non_intersecting_curve(arr, Segment(Point(1, 6), Point(7, 6)));

View File

@ -14,8 +14,7 @@ typedef CGAL::Arr_face_overlay_traits<Ex_arrangement, Ex_arrangement,
std::logical_and<bool> > std::logical_and<bool> >
Overlay_traits; Overlay_traits;
int main() int main() {
{
// Construct the first arrangement, containing a square-shaped face. // Construct the first arrangement, containing a square-shaped face.
Ex_arrangement arr1; Ex_arrangement arr1;
insert_non_intersecting_curve(arr1, Segment(Point(2, 2), Point(6, 2))); insert_non_intersecting_curve(arr1, Segment(Point(2, 2), Point(6, 2)));

View File

@ -20,8 +20,7 @@ typedef Ex_traits::Curve_2 Ex_polyline;
typedef Ex_traits::X_monotone_curve_2 Ex_x_monotone_polyline; typedef Ex_traits::X_monotone_curve_2 Ex_x_monotone_polyline;
typedef CGAL::Arrangement_2<Ex_traits> Ex_arrangement; typedef CGAL::Arrangement_2<Ex_traits> Ex_arrangement;
int main() int main() {
{
// Construct an arrangement of four polylines named A--D. // Construct an arrangement of four polylines named A--D.
Ex_traits traits; Ex_traits traits;
Ex_arrangement arr(&traits); Ex_arrangement arr(&traits);

View File

@ -4,8 +4,7 @@
#include "arr_exact_construction_segments.h" #include "arr_exact_construction_segments.h"
#include "arr_print.h" #include "arr_print.h"
int main () int main() {
{
Segment S1[] = {Segment(Point(1, 3), Point(4, 6)), Segment S1[] = {Segment(Point(1, 3), Point(4, 6)),
Segment(Point(1, 3), Point(6, 3)), Segment(Point(1, 3), Point(6, 3)),
Segment(Point(1, 3), Point(4, 0)), Segment(Point(1, 3), Point(4, 0)),

View File

@ -4,8 +4,7 @@
#include "arr_exact_construction_segments.h" #include "arr_exact_construction_segments.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
// Create an arrangement of four line segments forming an H-shape: // Create an arrangement of four line segments forming an H-shape:
Arrangement arr; Arrangement arr;

View File

@ -10,8 +10,7 @@
typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl; typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl;
typedef CGAL::Arr_point_location_result<Arrangement>::Type Pl_result_type; typedef CGAL::Arr_point_location_result<Arrangement>::Type Pl_result_type;
int main() int main() {
{
// Construct the arrangement of five intersecting segments. // Construct the arrangement of five intersecting segments.
Arrangement arr; Arrangement arr;
Naive_pl pl(arr); Naive_pl pl(arr);

View File

@ -1,48 +1,34 @@
//! \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 <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>
#include <fstream> #include <fstream>
#include <CGAL/basic.h>
#include <CGAL/IO/Arr_iostream.h>
#include "arr_inexact_construction_segments.h"
#include "arr_print.h"
#include "point_location_utils.h" #include "point_location_utils.h"
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel; int main() {
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main ()
{
// Construct the arrangement. // Construct the arrangement.
Arrangement_2 arr; Arrangement arr1;
construct_segments_arr(arr1);
construct_segments_arr (arr); std::cout << "Writing" << std::endl;
print_arrangement_size(arr1);
std::cout << "Writing an arrangement of size:" << std::endl
<< " V = " << arr.number_of_vertices()
<< ", E = " << arr.number_of_edges()
<< ", F = " << arr.number_of_faces() << std::endl;
// Write the arrangement to a file. // Write the arrangement to a file.
std::ofstream out_file ("arr_ex_io.dat"); std::ofstream out_file("arr_ex_io.dat");
out_file << arr1;
out_file << arr;
out_file.close(); out_file.close();
// Read the arrangement from the file. // Read the arrangement from the file.
Arrangement_2 arr2; Arrangement arr2;
std::ifstream in_file ("arr_ex_io.dat"); std::ifstream in_file("arr_ex_io.dat");
in_file >> arr2; in_file >> arr2;
in_file.close(); in_file.close();
std::cout << "Reading" << std::endl;
print_arrangement_size(arr2);
std::cout << "Read an arrangement of size:" << std::endl return 0;
<< " V = " << arr2.number_of_vertices()
<< ", E = " << arr2.number_of_edges()
<< ", F = " << arr2.number_of_faces() << std::endl;
return (0);
} }

View File

@ -1,57 +1,46 @@
//! \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 <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> #include <fstream>
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel; #include <CGAL/basic.h>
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2; #include <CGAL/Arrangement_with_history_2.h>
typedef Traits_2::Point_2 Point_2; #include <CGAL/IO/Arr_with_history_iostream.h>
typedef Traits_2::Curve_2 Segment_2;
typedef CGAL::Arrangement_with_history_2<Traits_2> Arr_with_hist_2;
int main () #include "arr_exact_construction_segments.h"
{ #include "arr_print.h"
Arr_with_hist_2 arr;
typedef CGAL::Arrangement_with_history_2<Traits> Arr_with_hist;
int main() {
// Insert six additional segments aggregately: // Insert six additional segments aggregately:
Segment_2 segs[6]; Segment segs[6];
segs[0] = Segment_2 (Point_2 (2, 6), Point_2 (7, 1)); segs[0] = Segment(Point(2, 6), Point(7, 1));
segs[1] = Segment_2 (Point_2 (3, 2), Point_2 (3, 5)); segs[1] = Segment(Point(3, 2), Point(3, 5));
segs[2] = Segment_2 (Point_2 (2, 3), Point_2 (5, 3)); segs[2] = Segment(Point(2, 3), Point(5, 3));
segs[3] = Segment_2 (Point_2 (2, 6), Point_2 (7, 1)); segs[3] = Segment(Point(2, 6), Point(7, 1));
segs[4] = Segment_2 (Point_2 (0, 0), Point_2 (2, 6)); segs[4] = Segment(Point(0, 0), Point(2, 6));
segs[5] = Segment_2 (Point_2 (3, 4), Point_2 (6, 4)); segs[5] = Segment(Point(3, 4), Point(6, 4));
insert (arr, segs, segs + 6);
Arr_with_hist arr1;
insert(arr1, segs, segs + 6);
std::cout << "Writing an arrangement of " std::cout << "Writing an arrangement of "
<< arr.number_of_curves() << " input segments:" << std::endl << arr1.number_of_curves() << " input segments:" << std::endl;
<< " V = " << arr.number_of_vertices() print_arrangement_size(arr1);
<< ", E = " << arr.number_of_edges()
<< ", F = " << arr.number_of_faces() << std::endl;
// Write the arrangement to a file. // Write the arrangement to a file.
std::ofstream out_file ("arr_ex_io_hist.dat"); std::ofstream out_file("arr_ex_io_hist.dat");
out_file << arr1;
out_file << arr;
out_file.close(); out_file.close();
// Read the arrangement from the file. // Read the arrangement from the file.
Arr_with_hist_2 arr2; Arr_with_hist arr2;
std::ifstream in_file ("arr_ex_io_hist.dat"); std::ifstream in_file("arr_ex_io_hist.dat");
in_file >> arr2; in_file >> arr2;
in_file.close(); in_file.close();
std::cout << "Read an arrangement of " std::cout << "Read an arrangement of "
<< arr2.number_of_curves() << " input segments:" << std::endl << arr2.number_of_curves() << " input segments:" << std::endl;
<< " V = " << arr2.number_of_vertices() print_arrangement_size(arr2);
<< ", E = " << arr2.number_of_edges()
<< ", F = " << arr2.number_of_faces() << std::endl;
return (0); return 0;
} }

View File

@ -1,36 +1,26 @@
//! \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 <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 <list>
#include <fstream> #include <fstream>
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel; #include <CGAL/basic.h>
typedef CGAL::Arr_linear_traits_2<Kernel> Traits_2; #include <CGAL/IO/Arr_iostream.h>
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::Segment_2 Segment_2;
typedef Traits_2::Ray_2 Ray_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 () #include "arr_linear.h"
{
int main() {
// Construct an arrangement of five linear objects. // Construct an arrangement of five linear objects.
Arrangement_2 arr; Arrangement arr;
std::list<X_monotone_curve_2> curves; std::list<X_monotone_curve> curves;
curves.push_back (Line_2 (Point_2 (0, 0), Point_2 (2, 1))); curves.push_back(Line(Point(0, 0), Point(2, 1)));
curves.push_back (Line_2 (Point_2 (0, 0), Point_2 (2, -1))); curves.push_back(Line(Point(0, 0), Point(2, -1)));
curves.push_back (Line_2 (Point_2 (-1, 0), Point_2 (-1, 1))); curves.push_back(Line(Point(-1, 0), Point(-1, 1)));
curves.push_back (Ray_2 (Point_2 (2, 3), Point_2 (2, 4))); curves.push_back(Ray(Point(2, 3), Point(2, 4)));
curves.push_back (Segment_2 (Point_2 (0, 1), Point_2 (0, 2))); curves.push_back(Segment(Point(0, 1), Point(0, 2)));
insert (arr, curves.begin(), curves.end()); insert(arr, curves.begin(), curves.end());
// Print out the size of the resulting arrangement. // Print out the size of the resulting arrangement.
std::cout << "Writing an arrangement of size:" << std::endl std::cout << "Writing an arrangement of size:" << std::endl
@ -43,14 +33,14 @@ int main ()
<< std::endl << std::endl; << std::endl << std::endl;
// Write the arrangement to a file. // Write the arrangement to a file.
std::ofstream out_file ("arr_ex_io_unbounded.dat"); std::ofstream out_file("arr_ex_io_unbounded.dat");
out_file << arr; out_file << arr;
out_file.close(); out_file.close();
// Read the arrangement from the file. // Read the arrangement from the file.
Arrangement_2 arr2; Arrangement arr2;
std::ifstream in_file ("arr_ex_io_unbounded.dat"); std::ifstream in_file("arr_ex_io_unbounded.dat");
in_file >> arr2; in_file >> arr2;
in_file.close(); in_file.close();
@ -64,5 +54,5 @@ int main ()
<< " (" << arr2.number_of_unbounded_faces() << " unbounded)" << " (" << arr2.number_of_unbounded_faces() << " unbounded)"
<< std::endl << std::endl; << std::endl << std::endl;
return (0); return 0;
} }

View File

@ -4,8 +4,7 @@
#include "arr_inexact_construction_segments.h" #include "arr_inexact_construction_segments.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
// Insert isolated points. // Insert isolated points.
Arrangement arr; Arrangement arr;
Face_handle uf = arr.unbounded_face(); Face_handle uf = arr.unbounded_face();

View File

@ -10,7 +10,6 @@
// An observer that receives notifications of face splits and face mergers. // An observer that receives notifications of face splits and face mergers.
class My_observer : public CGAL::Arr_observer<Arrangement> { class My_observer : public CGAL::Arr_observer<Arrangement> {
public: public:
My_observer(Arrangement& arr) : CGAL::Arr_observer<Arrangement>(arr) {} My_observer(Arrangement& arr) : CGAL::Arr_observer<Arrangement>(arr) {}
virtual void before_split_face(Face_handle, Halfedge_handle e) virtual void before_split_face(Face_handle, Halfedge_handle e)
@ -26,8 +25,7 @@ public:
} }
}; };
int main() int main() {
{
// Construct the arrangement containing one diamond-shaped face. // Construct the arrangement containing one diamond-shaped face.
Arrangement arr; Arrangement arr;
My_observer obs(arr); My_observer obs(arr);

View File

@ -7,8 +7,7 @@
#include "arr_exact_construction_segments.h" #include "arr_exact_construction_segments.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
// Construct the first arrangement, containing a square-shaped face. // Construct the first arrangement, containing a square-shaped face.
Arrangement arr1; Arrangement arr1;
insert_non_intersecting_curve(arr1, Segment(Point(2, 2), Point(6, 2))); insert_non_intersecting_curve(arr1, Segment(Point(2, 2), Point(6, 2)));

View File

@ -13,8 +13,7 @@ typedef unsigned int Color;
typedef CGAL::Arr_extended_dcel<Traits, Color, Color, Color> Dcel; typedef CGAL::Arr_extended_dcel<Traits, Color, Color, Color> Dcel;
typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement; typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement;
int main() int main() {
{
const Color vcol1(0x00000080), hcol1(0x000000ff), fcol1(0x00ccccff); const Color vcol1(0x00000080), hcol1(0x000000ff), fcol1(0x00ccccff);
const Color vcol2(0x00800000), hcol2(0x00ff0000), fcol2(0x00ffcccc); const Color vcol2(0x00800000), hcol2(0x00ff0000), fcol2(0x00ffcccc);

View File

@ -27,8 +27,7 @@ typedef CGAL::Arr_face_overlay_traits<Arrangement_blue, Arrangement_red,
Arrangement_res, Overlay_label> Arrangement_res, Overlay_label>
Overlay_traits; Overlay_traits;
int main() int main() {
{
// Construct the first arrangement, induced by two lines y = x and y = -x. // Construct the first arrangement, induced by two lines y = x and y = -x.
Arrangement_blue arr1; Arrangement_blue arr1;
insert(arr1, Line(Point(0, 0), Point(1, 1))); insert(arr1, Line(Point(0, 0), Point(1, 1)));

View File

@ -11,23 +11,22 @@
typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl; typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl;
typedef CGAL::Arr_landmarks_point_location<Arrangement> Landmarks_pl; typedef CGAL::Arr_landmarks_point_location<Arrangement> Landmarks_pl;
int main () int main() {
{
// Construct the arrangement. // Construct the arrangement.
Arrangement arr; Arrangement arr;
construct_segments_arr(arr); construct_segments_arr(arr);
// Perform some point-location queries using the naive strategy. // Perform some point-location queries using the naive strategy.
Naive_pl naive_pl(arr); Naive_pl naive_pl(arr);
point_location_query(naive_pl, Point(1, 4)); // q1 locate_point(naive_pl, Point(1, 4)); // q1
point_location_query(naive_pl, Point(4, 3)); // q2 locate_point(naive_pl, Point(4, 3)); // q2
point_location_query(naive_pl, Point(6, 3)); // q3 locate_point(naive_pl, Point(6, 3)); // q3
// Perform some point-location queries using the landmark strategy. // Perform some point-location queries using the landmark strategy.
Landmarks_pl landmarks_pl(arr); Landmarks_pl landmarks_pl(arr);
point_location_query(landmarks_pl, Point(3, 2)); // q4 locate_point(landmarks_pl, Point(3, 2)); // q4
point_location_query(landmarks_pl, Point(5, 2)); // q5 locate_point(landmarks_pl, Point(5, 2)); // q5
point_location_query(landmarks_pl, Point(1, 0)); // q6 locate_point(landmarks_pl, Point(1, 0)); // q6
return 0; return 0;
} }

View File

@ -6,52 +6,36 @@
#include <iostream> #include <iostream>
int main() int main() {
{
std::cout << "Sorry, this example needs CORE ..." << std::endl; std::cout << "Sorry, this example needs CORE ..." << std::endl;
return 0; return 0;
} }
#else #else
#include <CGAL/Cartesian.h> #include <CGAL/basic.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <CGAL/Arr_Bezier_curve_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_polycurve_traits_2.h> #include <CGAL/Arr_polycurve_traits_2.h>
#include "arr_Bezier.h"
#include "arr_print.h" #include "arr_print.h"
typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef CGAL::Arr_polycurve_traits_2<Traits> Polycurve_bezier_traits;
typedef Nt_traits::Rational NT; typedef Polycurve_bezier_traits::X_monotone_curve_2 X_mono_polycurve;
typedef Nt_traits::Rational Rational; typedef CGAL::Arrangement_2<Polycurve_bezier_traits> Arrangement_2;
typedef Nt_traits::Algebraic Algebraic;
typedef CGAL::Cartesian<Rational> Rat_kernel;
typedef CGAL::Cartesian<Algebraic> Alg_kernel;
typedef Rat_kernel::Point_2 Rat_point_2;
typedef CGAL::Arr_Bezier_curve_traits_2<Rat_kernel, Alg_kernel, Nt_traits>
Bezier_traits;
typedef Bezier_traits::Curve_2 Bezier_curve_2;
typedef Bezier_traits::X_monotone_curve_2 Bezier_x_curve_2;
typedef CGAL::Arr_polycurve_traits_2<Bezier_traits> Polycurve_bezier_traits_2;
typedef Polycurve_bezier_traits_2::X_monotone_curve_2 X_mono_polycurve;
typedef CGAL::Arrangement_2<Polycurve_bezier_traits_2> Arrangement_2;
int main() int main() {
{ Polycurve_bezier_traits pc_traits;
Polycurve_bezier_traits_2 pc_traits; Traits bezier_traits;
Bezier_traits bezier_traits;
Polycurve_bezier_traits_2::Construct_x_monotone_curve_2 auto ctr_xpolycurve = pc_traits.construct_x_monotone_curve_2_object();
construct_x_mono_polycurve =
pc_traits.construct_x_monotone_curve_2_object();
std::vector<Bezier_x_curve_2> x_bezier_curves; std::vector<Bezier_x_monotone_curve> x_bezier_curves;
// Get the name of the input file from the command line, or use the default // Get the name of the input file from the command line, or use the default
// Bezier.dat file if no command-line parameters are given. // Bezier.dat file if no command-line parameters are given.
const char* filename = "Bezier_polycurve.dat"; const char* filename = "Bezier_polycurve.dat";
// Open the input file. // Open the input file.
std::ifstream in_file (filename); std::ifstream in_file(filename);
if (! in_file.is_open()) { if (! in_file.is_open()) {
std::cerr << "Failed to open " << filename << std::endl; std::cerr << "Failed to open " << filename << std::endl;
@ -60,8 +44,8 @@ int main()
// Read the curves from the input file. // Read the curves from the input file.
unsigned int n_curves; unsigned int n_curves;
std::list<Bezier_x_curve_2> x_curves; std::list<Bezier_x_monotone_curve> x_curves;
Bezier_curve_2 B; Bezier_curve B;
in_file >> n_curves; in_file >> n_curves;
unsigned int k; unsigned int k;
@ -71,13 +55,12 @@ int main()
//convert it into x-monotone bezier curve. //convert it into x-monotone bezier curve.
std::vector<CGAL::Object> obj_vector; std::vector<CGAL::Object> obj_vector;
bezier_traits.make_x_monotone_2_object()(B, std::back_inserter(obj_vector)); bezier_traits.make_x_monotone_2_object()(B, std::back_inserter(obj_vector));
Bezier_x_curve_2 x_seg = Bezier_x_monotone_curve x_seg =
CGAL::object_cast<Bezier_x_curve_2>((obj_vector[0])); CGAL::object_cast<Bezier_x_monotone_curve>((obj_vector[0]));
x_curves.push_back(x_seg); x_curves.push_back(x_seg);
} }
X_mono_polycurve polycurve = X_mono_polycurve polycurve = ctr_xpolycurve(x_curves.begin(), x_curves.end());
construct_x_mono_polycurve(x_curves.begin(), x_curves.end());
// Construct the arrangement. // Construct the arrangement.
Arrangement_2 arr; Arrangement_2 arr;

View File

@ -6,70 +6,57 @@
#include <iostream> #include <iostream>
int main() int main() {
{
std::cout << "Sorry, this example needs CORE ..." << std::endl; std::cout << "Sorry, this example needs CORE ..." << std::endl;
return 0; return 0;
} }
#else #else
#include <CGAL/Cartesian.h>
#include <CGAL/Quotient.h>
#include <CGAL/MP_Float.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <vector> #include <vector>
#include <list>
#include <CGAL/basic.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <CGAL/Arr_polycurve_traits_2.h> #include <CGAL/Arr_polycurve_traits_2.h>
#include <CGAL/Arr_circle_segment_traits_2.h>
#include <CGAL/Arrangement_2.h> #include "arr_circular.h"
#include "arr_print.h" #include "arr_print.h"
typedef CGAL::Quotient<CGAL::MP_Float> Number_type; typedef CGAL::Arr_polycurve_traits_2<Traits> Polycurve_traits;
typedef CGAL::Cartesian<Number_type> Kernel; typedef Polycurve_traits::X_monotone_curve_2 X_monotone_polycurve;
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Arc_traits_2; typedef Polycurve_traits::Curve_2 Polycurve;
typedef CGAL::Arr_polycurve_traits_2<Arc_traits_2> Polycurve_arc_traits_2; typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arrangement_2<Polycurve_traits> Polycurve_circ_arc_arrangment;
typedef Arc_traits_2::CoordNT CoordNT; int main() {
typedef Arc_traits_2::Point_2 Point_2; Polycurve_traits traits;
typedef Arc_traits_2::Curve_2 Arc_section_2; auto ctr_curve = traits.construct_curve_2_object();
typedef Arc_traits_2::X_monotone_curve_2 Arc_x_monotone_section_2; auto ctr_xcurve = traits.construct_x_monotone_curve_2_object();
typedef Polycurve_arc_traits_2::X_monotone_curve_2 X_monotone_polycurve;
typedef Polycurve_arc_traits_2::Curve_2 Polycurve;
typedef Kernel::Circle_2 Circle_2;
typedef CGAL::Arrangement_2<Polycurve_arc_traits_2>
Polycurve_circ_arc_arrangment;
int main()
{
Polycurve_arc_traits_2 traits;
//Containers to store conic curves that will be used to create polycurve. //Containers to store conic curves that will be used to create polycurve.
std::vector<Arc_section_2> curves; std::vector<Curve> curves;
std::vector<Arc_x_monotone_section_2> x_curves; std::vector<X_monotone_curve> x_curves;
// Create a circular arc of the circle, directed clockwise from // Create a circular arc of the circle, directed clockwise from
// (-1, 0) to (1, 0) centered at (0,0). Note that we orient the // (-1, 0) to (1, 0) centered at (0,0). Note that we orient the
// supporting circle accordingly. // supporting circle accordingly.
Kernel::Point_2 c1(0, 0); Rational_point c1(0, 0);
Point_2 s1(Number_type(-1, 1), Number_type(0, 1)); Point s1(Number_type(-1), Number_type(0));
Point_2 t1(Number_type(1, 1), Number_type(0, 1)); Point t1(Number_type(1), Number_type(0));
Arc_section_2 circ_arc1(c1, 1, CGAL::CLOCKWISE, s1, t1); Curve circ_arc1(c1, 1, CGAL::CLOCKWISE, s1, t1);
curves.push_back(circ_arc1); curves.push_back(circ_arc1);
// Create a circular arc of the unit circle, directed clockwise from // Create a circular arc of the unit circle, directed clockwise from
// (1, 0) to (3, 0) centered at (3,0). Note that we orient the // (1, 0) to (3, 0) centered at (3,0). Note that we orient the
// supporting circle accordingly. // supporting circle accordingly.
Kernel::Point_2 c2(3, 0); Rational_point c2(3, 0);
Point_2 s2(Number_type(1, 1), Number_type(0, 1)); Point s2(Number_type(1), Number_type(0));
Point_2 t2(Number_type(5, 1), Number_type(0, 1)); Point t2(Number_type(5), Number_type(0));
Arc_section_2 circ_arc2(c2, 2, CGAL::CLOCKWISE, s2, t2); Curve circ_arc2(c2, 2, CGAL::CLOCKWISE, s2, t2);
curves.push_back(circ_arc2); curves.push_back(circ_arc2);
// Create polycurve // Create polycurve
Polycurve polycurve_1 = Polycurve polycurve_1 = ctr_curve(curves.begin(), curves.end());
traits.construct_curve_2_object()(curves.begin(), curves.end());
// Empty the vector in order to create another polycurve. // Empty the vector in order to create another polycurve.
curves.clear(); curves.clear();
@ -77,46 +64,44 @@ int main()
// Create a circular arc of the circle, directed clockwise from // Create a circular arc of the circle, directed clockwise from
// (-10, 13) to (-7, 10) centered at (-10,10). Note that we orient the // (-10, 13) to (-7, 10) centered at (-10,10). Note that we orient the
// supporting circle accordingly. // supporting circle accordingly.
Kernel::Point_2 c3(-10, 10); Rational_point c3(-10, 10);
Point_2 s3(Number_type(-10, 1), Number_type(13, 1)); Point s3(Number_type(-10), Number_type(13));
Point_2 t3(Number_type(-7, 1), Number_type(10, 1)); Point t3(Number_type(-7), Number_type(10));
Arc_section_2 circ_arc3(c3, 3, CGAL::CLOCKWISE, s3, t3); Curve circ_arc3(c3, 3, CGAL::CLOCKWISE, s3, t3);
curves.push_back(circ_arc3); curves.push_back(circ_arc3);
Kernel::Point_2 c4(-20, 10); Rational_point c4(-20, 10);
Point_2 s4(Number_type(-7, 1), Number_type(10, 1)); Point s4(Number_type(-7), Number_type(10));
Point_2 t4(Number_type(-20, 1), Number_type(23, 1)); Point t4(Number_type(-20), Number_type(23));
Arc_section_2 circ_arc4(c4, 13, CGAL::CLOCKWISE, s4, t4); Curve circ_arc4(c4, 13, CGAL::CLOCKWISE, s4, t4);
curves.push_back(circ_arc4); curves.push_back(circ_arc4);
Kernel::Point_2 c5(-20, 25); Rational_point c5(-20, 25);
Point_2 s5(Number_type(-20, 1), Number_type(23, 1)); Point s5(Number_type(-20), Number_type(23));
Point_2 t5(Number_type(-20, 1), Number_type(27, 1)); Point t5(Number_type(-20), Number_type(27));
Arc_section_2 circ_arc5(c5, 2, CGAL::CLOCKWISE, s5, t5); Curve circ_arc5(c5, 2, CGAL::CLOCKWISE, s5, t5);
curves.push_back(circ_arc5); curves.push_back(circ_arc5);
Polycurve polycurve_2 = Polycurve polycurve_2 = ctr_curve(curves.begin(), curves.end());
traits.construct_curve_2_object()(curves.begin(), curves.end());
//circle to be used by x-monotone polycurve //circle to be used by x-monotone polycurve
Kernel::Point_2 circle_center1(Number_type(10, 1), Number_type(10, 1)); Rational_point circle_center1(Number_type(10), Number_type(10));
Circle_2 circ_1(circle_center1, 4, CGAL::CLOCKWISE); Circle_2 circ_1(circle_center1, 4, CGAL::CLOCKWISE);
Point_2 s6(Number_type(8, 1), Number_type(10, 1)); Point s6(Number_type(8), Number_type(10));
Point_2 t6(Number_type(12, 1), Number_type(10, 1)); Point t6(Number_type(12), Number_type(10));
Arc_x_monotone_section_2 xc1(circ_1, s6, t6, CGAL::CLOCKWISE); X_monotone_curve xc1(circ_1, s6, t6, CGAL::CLOCKWISE);
x_curves.push_back(xc1); x_curves.push_back(xc1);
Kernel::Point_2 circle_center2(Number_type(13, 1), Number_type(10, 1)); Rational_point circle_center2(Number_type(13), Number_type(10));
Circle_2 circ_2(circle_center2, 1, CGAL::CLOCKWISE); Circle_2 circ_2(circle_center2, 1, CGAL::CLOCKWISE);
Point_2 s7(Number_type(12, 1), Number_type(10, 1)); Point s7(Number_type(12), Number_type(10));
Point_2 t7(Number_type(14, 1), Number_type(10, 1)); Point t7(Number_type(14), Number_type(10));
Arc_x_monotone_section_2 xc2(circ_2, s7, t7, CGAL::CLOCKWISE); X_monotone_curve xc2(circ_2, s7, t7, CGAL::CLOCKWISE);
x_curves.push_back(xc2); x_curves.push_back(xc2);
//create x-monotone polycurve //create x-monotone polycurve
X_monotone_polycurve x_polycurve_1 = X_monotone_polycurve x_polycurve_1 =
traits.construct_x_monotone_curve_2_object()(x_curves.begin(), ctr_xcurve(x_curves.begin(), x_curves.end());
x_curves.end());
// Insert polycurves to Arangment and print. // Insert polycurves to Arangment and print.
Polycurve_circ_arc_arrangment polycurve_arrangment(&traits); Polycurve_circ_arc_arrangment polycurve_arrangment(&traits);

View File

@ -6,108 +6,90 @@
#include <iostream> #include <iostream>
int main() int main() {
{
std::cout << "Sorry, this example needs CORE ..." << std::endl; std::cout << "Sorry, this example needs CORE ..." << std::endl;
return 0; return 0;
} }
#else #else
#include <CGAL/Cartesian.h>
#include <CGAL/Quotient.h>
#include <CGAL/MP_Float.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <vector> #include <vector>
#include <list>
#include <CGAL/basic.h>
#include <CGAL/Arr_polycurve_traits_2.h> #include <CGAL/Arr_polycurve_traits_2.h>
#include <CGAL/Arr_conic_traits_2.h>
#include <CGAL/Arrangement_2.h> #include "arr_conics.h"
#include "arr_print.h" #include "arr_print.h"
typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef CGAL::Arr_polycurve_traits_2<Traits> Polycurve_conic_traits_2;
typedef Nt_traits::Rational Rational;
typedef Nt_traits::Algebraic Algebraic;
typedef CGAL::Cartesian<Rational> Rat_kernel;
typedef CGAL::Cartesian<Algebraic> Alg_kernel;
typedef CGAL::Arr_conic_traits_2<Rat_kernel, Alg_kernel, Nt_traits>
Conic_traits_2;
typedef Conic_traits_2::Point_2 Conic_point_2;
typedef Conic_traits_2::Curve_2 Conic_curve_2;
typedef Conic_traits_2::X_monotone_curve_2 Conic_x_monotone_curve_2;
typedef CGAL::Arr_polycurve_traits_2<Conic_traits_2> Polycurve_conic_traits_2;
typedef Polycurve_conic_traits_2::X_monotone_curve_2 X_monotone_polycurve; typedef Polycurve_conic_traits_2::X_monotone_curve_2 X_monotone_polycurve;
typedef Polycurve_conic_traits_2::Curve_2 Polycurve; typedef Polycurve_conic_traits_2::Curve_2 Polycurve;
typedef CGAL::Arrangement_2<Polycurve_conic_traits_2> Polycurve_conic_arrangment; typedef CGAL::Arrangement_2<Polycurve_conic_traits_2> Polycurve_conic_arrangment;
int main() int main() {
{
Polycurve_conic_traits_2 traits; Polycurve_conic_traits_2 traits;
// Polycurve construction functors // Polycurve construction functors
Polycurve_conic_traits_2::Construct_x_monotone_curve_2 auto ctr_xpolycurve = traits.construct_x_monotone_curve_2_object();
construct_x_mono_polycurve = traits.construct_x_monotone_curve_2_object(); auto ctr_polycurve = traits.construct_curve_2_object();
Polycurve_conic_traits_2::Construct_curve_2 construct_polycurve =
traits.construct_curve_2_object();
// Containers to store conic curves that will be used to create polycurve. // Containers to store conic curves that will be used to create polycurve.
std::vector<Conic_curve_2> conic_curves; std::vector<Conic_arc> conic_curves;
std::vector<Conic_x_monotone_curve_2> xmono_conic_curves_2; std::vector<X_monotone_conic_arc> xmono_conic_curves_2;
// Create polycurves // Create polycurves
// y=x^2 // y=x^2
Conic_curve_2 c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_arc c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
Conic_point_2(Algebraic(0), Algebraic(0)), Point(Algebraic(0), Algebraic(0)),
Conic_point_2(Algebraic(3), Algebraic(9))); Point(Algebraic(3), Algebraic(9)));
Conic_curve_2 c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_arc c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
Conic_point_2(Algebraic(3), Algebraic(9)), Point(Algebraic(3), Algebraic(9)),
Conic_point_2(Algebraic(5), Algebraic(25))); Point(Algebraic(5), Algebraic(25)));
Conic_curve_2 c5(0,1,0,1,0,0, CGAL::COUNTERCLOCKWISE, Conic_arc c5(0,1,0,1,0,0, CGAL::COUNTERCLOCKWISE,
Conic_point_2(Algebraic(-25), Algebraic(-5)), Point(Algebraic(-25), Algebraic(-5)),
Conic_point_2(Algebraic(0), Algebraic(0))); Point(Algebraic(0), Algebraic(0)));
Conic_curve_2 c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE, Conic_arc c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE,
Conic_point_2(Algebraic(-7), Algebraic(13)), Point(Algebraic(-7), Algebraic(13)),
Conic_point_2(Algebraic(-3), Algebraic(9))); Point(Algebraic(-3), Algebraic(9)));
Conic_curve_2 c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_arc c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
Conic_point_2(Algebraic(-3), Algebraic(9)), Point(Algebraic(-3), Algebraic(9)),
Conic_point_2(Algebraic(0), Algebraic(0))); Point(Algebraic(0), Algebraic(0)));
Conic_curve_2 c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE, Conic_arc c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE,
Conic_point_2(Algebraic(0), Algebraic(0)), Point(Algebraic(0), Algebraic(0)),
Conic_point_2(Algebraic(4), Algebraic(-2))); Point(Algebraic(4), Algebraic(-2)));
Conic_curve_2 c9(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_arc c9(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
Conic_point_2(Algebraic(-5), Algebraic(25)), Point(Algebraic(-5), Algebraic(25)),
Conic_point_2(Algebraic(5), Algebraic(25))); Point(Algebraic(5), Algebraic(25)));
// Construct poly-curve // Construct poly-curve
conic_curves.clear(); conic_curves.clear();
conic_curves.push_back(c9); conic_curves.push_back(c9);
Polycurve conic_polycurve_1 = Polycurve conic_polycurve_1 =
construct_polycurve(conic_curves.begin(), conic_curves.end()); ctr_polycurve(conic_curves.begin(), conic_curves.end());
Conic_curve_2 c11(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE, Conic_arc c11(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE,
Conic_point_2(Algebraic(25), Algebraic(-5)), Point(Algebraic(25), Algebraic(-5)),
Conic_point_2(Algebraic(0), Algebraic(0))); Point(Algebraic(0), Algebraic(0)));
Conic_curve_2 c12(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_arc c12(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
Conic_point_2(Algebraic(0), Algebraic(0)), Point(Algebraic(0), Algebraic(0)),
Conic_point_2(Algebraic(5), Algebraic(25))); Point(Algebraic(5), Algebraic(25)));
// Construct poly-curve // Construct poly-curve
conic_curves.clear(); conic_curves.clear();
conic_curves.push_back(c11); conic_curves.push_back(c11);
conic_curves.push_back(c12); conic_curves.push_back(c12);
Polycurve conic_polycurve_2 = Polycurve conic_polycurve_2 =
construct_polycurve(conic_curves.begin(), conic_curves.end()); ctr_polycurve(conic_curves.begin(), conic_curves.end());
// Construct x-monotone conic curves from conic curves // Construct x-monotone conic curves from conic curves
Conic_x_monotone_curve_2 xc3(c3); X_monotone_conic_arc xc3(c3);
Conic_x_monotone_curve_2 xc4(c4); X_monotone_conic_arc xc4(c4);
Conic_x_monotone_curve_2 xc5(c5); X_monotone_conic_arc xc5(c5);
Conic_x_monotone_curve_2 xc6(c6); X_monotone_conic_arc xc6(c6);
Conic_x_monotone_curve_2 xc7(c7); X_monotone_conic_arc xc7(c7);
Conic_x_monotone_curve_2 xc8(c8); X_monotone_conic_arc xc8(c8);
// Construct x-monotone poly-curve from x-monotone conic curves. // Construct x-monotone poly-curve from x-monotone conic curves.
xmono_conic_curves_2.clear(); xmono_conic_curves_2.clear();
@ -115,7 +97,7 @@ int main()
xmono_conic_curves_2.push_back(xc3); xmono_conic_curves_2.push_back(xc3);
xmono_conic_curves_2.push_back(xc4); xmono_conic_curves_2.push_back(xc4);
X_monotone_polycurve conic_x_mono_polycurve_1 = X_monotone_polycurve conic_x_mono_polycurve_1 =
construct_x_mono_polycurve(xmono_conic_curves_2.begin(), ctr_xpolycurve(xmono_conic_curves_2.begin(),
xmono_conic_curves_2.end()); xmono_conic_curves_2.end());
// Construct x-monotone poly-curve. // Construct x-monotone poly-curve.
@ -124,8 +106,7 @@ int main()
xmono_conic_curves_2.push_back(xc7); xmono_conic_curves_2.push_back(xc7);
xmono_conic_curves_2.push_back(xc8); xmono_conic_curves_2.push_back(xc8);
X_monotone_polycurve conic_x_mono_polycurve_2 = X_monotone_polycurve conic_x_mono_polycurve_2 =
construct_x_mono_polycurve(xmono_conic_curves_2.begin(), ctr_xpolycurve(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end());
xmono_conic_curves_2.end());
// Insert the Polycurves into arrangment and print. // Insert the Polycurves into arrangment and print.
Polycurve_conic_arrangment x_pc_arrangment(&traits); Polycurve_conic_arrangment x_pc_arrangment(&traits);

View File

@ -29,8 +29,7 @@ typedef CGAL::Arr_spherical_topology_traits_2<Segment_traits_2>
typedef CGAL::Arrangement_on_surface_2<Segment_traits_2, Topol_segment_traits_2> typedef CGAL::Arrangement_on_surface_2<Segment_traits_2, Topol_segment_traits_2>
Segment_arr; Segment_arr;
int main() int main() {
{
Segment_traits_2 seg_traits; Segment_traits_2 seg_traits;
Segment_traits_2::Construct_point_2 ctr_p = Segment_traits_2::Construct_point_2 ctr_p =
seg_traits.construct_point_2_object(); seg_traits.construct_point_2_object();

View File

@ -1,44 +1,41 @@
//! \file examples/Arrangement_on_surface_2/polylines.cpp //! \file examples/Arrangement_on_surface_2/polylines.cpp
// Constructing an arrangement of polylines. // Constructing an arrangement of polylines.
#include <vector>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Arr_directional_non_caching_segment_basic_traits_2.h> #include <CGAL/Arr_directional_non_caching_segment_basic_traits_2.h>
#include <CGAL/Arr_polycurve_basic_traits_2.h> #include <CGAL/Arr_polycurve_basic_traits_2.h>
#include <CGAL/Arrangement_2.h> #include <CGAL/Arrangement_2.h>
#include <vector>
#include <list>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Arr_directional_non_caching_segment_basic_traits_2<Kernel> typedef CGAL::Arr_directional_non_caching_segment_basic_traits_2<Kernel>
Subcurve_traits_2; Subcurve_traits;
typedef CGAL::Arr_polycurve_basic_traits_2<Subcurve_traits_2> typedef CGAL::Arr_polycurve_basic_traits_2<Subcurve_traits> Geom_traits;
Geom_traits_2; typedef Geom_traits::Point_2 Point;
typedef Geom_traits_2::Point_2 Point_2; typedef Subcurve_traits::X_monotone_curve_2 X_monotone_subcurve;
typedef Subcurve_traits_2::X_monotone_curve_2 X_monotone_subcurve_2; typedef Geom_traits::X_monotone_curve_2 X_monotone_curve;
typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2; typedef CGAL::Arrangement_2<Geom_traits> Arrangement;
typedef CGAL::Arrangement_2<Geom_traits_2> Arrangement_2;
int main() int main() {
{ Geom_traits traits;
Geom_traits_2 traits; Arrangement arr(&traits);
Arrangement_2 arr(&traits);
Geom_traits_2::Construct_x_monotone_curve_2 ctr = auto ctr = traits.construct_x_monotone_curve_2_object();
traits.construct_x_monotone_curve_2_object();
std::vector<X_monotone_subcurve_2> segs1; std::vector<X_monotone_subcurve> segs1;
segs1.push_back(X_monotone_subcurve_2(Point_2(0, 0), Point_2(1, 1))); segs1.push_back(X_monotone_subcurve(Point(0, 0), Point(1, 1)));
segs1.push_back(X_monotone_subcurve_2(Point_2(1, 1), Point_2(2, 2))); segs1.push_back(X_monotone_subcurve(Point(1, 1), Point(2, 2)));
segs1.push_back(X_monotone_subcurve_2(Point_2(2, 2), Point_2(3, 1))); segs1.push_back(X_monotone_subcurve(Point(2, 2), Point(3, 1)));
segs1.push_back(X_monotone_subcurve_2(Point_2(3, 1), Point_2(4, 0))); segs1.push_back(X_monotone_subcurve(Point(3, 1), Point(4, 0)));
X_monotone_curve_2 pc1 = ctr(segs1.begin(), segs1.end()); X_monotone_curve pc1 = ctr(segs1.begin(), segs1.end());
std::vector<X_monotone_subcurve_2> segs2; std::vector<X_monotone_subcurve> segs2;
segs2.push_back(X_monotone_subcurve_2(Point_2(0, 0), Point_2(1, 1))); segs2.push_back(X_monotone_subcurve(Point(0, 0), Point(1, 1)));
segs2.push_back(X_monotone_subcurve_2(Point_2(1, 1), Point_2(2, 2))); segs2.push_back(X_monotone_subcurve(Point(1, 1), Point(2, 2)));
segs2.push_back(X_monotone_subcurve_2(Point_2(2, 2), Point_2(3, 1))); segs2.push_back(X_monotone_subcurve(Point(2, 2), Point(3, 1)));
segs2.push_back(X_monotone_subcurve_2(Point_2(3, 1), Point_2(4, 0))); segs2.push_back(X_monotone_subcurve(Point(3, 1), Point(4, 0)));
X_monotone_curve_2 pc2 = ctr(segs2.begin(), segs2.end()); X_monotone_curve pc2 = ctr(segs2.begin(), segs2.end());
insert_non_intersecting_curve(arr, pc1); insert_non_intersecting_curve(arr, pc1);
insert_non_intersecting_curve(arr, pc2); insert_non_intersecting_curve(arr, pc2);

View File

@ -4,7 +4,7 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include "arr_polylines .h" #include "arr_polylines.h"
#include "arr_print.h" #include "arr_print.h"
/* Define the Arrangement traits class to be used. You can either use some user /* Define the Arrangement traits class to be used. You can either use some user
@ -23,8 +23,7 @@ typedef Geom_traits_2::Segment_2 Segment_2;
typedef Geom_traits_2::Curve_2 Polyline_2; typedef Geom_traits_2::Curve_2 Polyline_2;
typedef CGAL::Arrangement_2<Geom_traits_2> Arrangement_2; typedef CGAL::Arrangement_2<Geom_traits_2> Arrangement_2;
int main() int main() {
{
Geom_traits_2 traits; Geom_traits_2 traits;
Arrangement_2 arr(&traits); Arrangement_2 arr(&traits);

View File

@ -16,14 +16,13 @@ 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;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_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 // Get the name of the input file from the command line, or use the default
// fan_grids.dat file if no command-line parameters are given. // fan_grids.dat file if no command-line parameters are given.
const char * filename = (argc > 1) ? argv[1] : "fan_grids.dat"; const char* filename = (argc > 1) ? argv[1] : "fan_grids.dat";
// Open the input file. // Open the input file.
std::ifstream in_file (filename); std::ifstream in_file(filename);
if (! in_file.is_open()) { if (! in_file.is_open()) {
std::cerr << "Failed to open " << filename << " ..." << std::endl; std::cerr << "Failed to open " << filename << " ..." << std::endl;
@ -52,14 +51,14 @@ int main (int argc, char *argv[])
in_file.close(); in_file.close();
// Construct the arrangement by aggregately inserting all segments. // Construct the arrangement by aggregately inserting all segments.
Arrangement_2 arr; Arrangement_2 arr;
CGAL::Timer timer; CGAL::Timer timer;
std::cout << "Performing aggregated insertion of " std::cout << "Performing aggregated insertion of "
<< n << " segments." << std::endl; << n << " segments." << std::endl;
timer.start(); timer.start();
insert (arr, segments.begin(), segments.end()); insert(arr, segments.begin(), segments.end());
timer.stop(); timer.stop();
// Print the arrangement dimensions. // Print the arrangement dimensions.

View File

@ -16,14 +16,13 @@ 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;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_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 // Get the name of the input file from the command line, or use the default
// Europe.dat file if no command-line parameters are given. // Europe.dat file if no command-line parameters are given.
const char * filename = (argc > 1) ? argv[1] : "Europe.dat"; const char* filename = (argc > 1) ? argv[1] : "Europe.dat";
// Open the input file. // Open the input file.
std::ifstream in_file (filename); std::ifstream in_file(filename);
if (! in_file.is_open()) { if (! in_file.is_open()) {
std::cerr << "Failed to open " << filename << " ..." << std::endl; std::cerr << "Failed to open " << filename << " ..." << std::endl;
@ -52,8 +51,8 @@ int main (int argc, char *argv[])
in_file.close(); in_file.close();
// Construct the arrangement by aggregately inserting all segments. // Construct the arrangement by aggregately inserting all segments.
Arrangement_2 arr; Arrangement_2 arr;
CGAL::Timer timer; CGAL::Timer timer;
std::cout << "Performing aggregated insertion of " std::cout << "Performing aggregated insertion of "
<< n << " segments." << std::endl; << n << " segments." << std::endl;

View File

@ -4,8 +4,7 @@
#include "arr_rat_functions.h" #include "arr_rat_functions.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
CGAL::set_pretty_mode(std::cout); // for nice printouts. CGAL::set_pretty_mode(std::cout); // for nice printouts.
// Define a traits class object and a constructor for rational functions. // Define a traits class object and a constructor for rational functions.

View File

@ -5,8 +5,7 @@
#ifndef CGAL_USE_CORE #ifndef CGAL_USE_CORE
#include <iostream> #include <iostream>
int main () int main() {
{
std::cout << "Sorry, this example needs CORE ..." << std::endl; std::cout << "Sorry, this example needs CORE ..." << std::endl;
return 0; return 0;
} }
@ -29,8 +28,7 @@ typedef Traits_2::Algebraic_real_1 Alg_real_1;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2; typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main () int main() {
{
CGAL::set_pretty_mode(std::cout); // for nice printouts. CGAL::set_pretty_mode(std::cout); // for nice printouts.
// Traits class object // Traits class object
@ -92,7 +90,7 @@ int main ()
// Print the arcs. // Print the arcs.
for (unsigned int i(0); i < arcs.size(); ++i) for (unsigned int i(0); i < arcs.size(); ++i)
std::cout << arcs[i]<<std::endl; std::cout << arcs[i] << std::endl;
// Construct the arrangement of the four arcs. // Construct the arrangement of the four arcs.
Arrangement_2 arr(&traits); Arrangement_2 arr(&traits);

View File

@ -45,8 +45,7 @@ typedef Gm::Vertex_const_handle Vertex_const_handle;
typedef Gm::Halfedge_const_handle Halfedge_const_handle; typedef Gm::Halfedge_const_handle Halfedge_const_handle;
typedef Gm::Face_const_handle Face_const_handle; typedef Gm::Face_const_handle Face_const_handle;
int main() int main() {
{
Gm_polyhedron p; Gm_polyhedron p;
p.make_tetrahedron(Point_3(1.0, 0.0, 0.0), Point_3(0.0, 1.0, 0.0), p.make_tetrahedron(Point_3(1.0, 0.0, 0.0), Point_3(0.0, 1.0, 0.0),
Point_3(0.0, 0.0, 1.0), Point_3(0.0, 0.0, 0.0)); Point_3(0.0, 0.0, 1.0), Point_3(0.0, 0.0, 0.0));
@ -85,11 +84,11 @@ protected:
ctr_point(0, 0, -1) ctr_point(0, 0, -1)
}; };
point_location_query(naive_pl, points[0]); locate_point(naive_pl, points[0]);
point_location_query(naive_pl, points[1]); locate_point(naive_pl, points[1]);
point_location_query(naive_pl, points[2]); locate_point(naive_pl, points[2]);
// point_location_query(trap_pl, points[0]); // locate_point(trap_pl, points[0]);
//////// ////////
std::list<Query_result> results; std::list<Query_result> results;
@ -97,8 +96,7 @@ protected:
// CGAL::locate(gm, &points[0], &points[3], std::back_inserter(results)); // CGAL::locate(gm, &points[0], &points[3], std::back_inserter(results));
// Print the results. // Print the results.
std::list<Query_result>::const_iterator it; for (auto it = results.begin(); it != results.end(); ++it) {
for (it = results.begin(); it != results.end(); ++it) {
std::cout << "The point (" << it->first << ") is located "; std::cout << "The point (" << it->first << ") is located ";
if (const Face_const_handle* f = if (const Face_const_handle* f =
boost::get<Face_const_handle>(&(it->second))) // inside a face boost::get<Face_const_handle>(&(it->second))) // inside a face

View File

@ -4,8 +4,7 @@
#include "arr_inexact_construction_segments.h" #include "arr_inexact_construction_segments.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
Point p0(3, 3), p1(1, 3), p2(3, 5), p3(5, 3), p4(3, 1); Point p0(3, 3), p1(1, 3), p2(3, 5), p3(5, 3), p4(3, 1);
Segment s1(p1, p2), s2(p2, p3), s3(p3, p4), s4(p4, p1); Segment s1(p1, p2), s2(p2, p3), s3(p3, p4), s4(p4, p1);
Segment s5(p1, p0), s6(p0, p3), s7(p4, p0), s8(p0, p2); Segment s5(p1, p0), s6(p0, p3), s7(p4, p0), s8(p0, p2);

View File

@ -20,8 +20,7 @@ typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
Arrangement_2; Arrangement_2;
typedef Arrangement_2::Vertex_handle Vertex_handle; typedef Arrangement_2::Vertex_handle Vertex_handle;
int main() int main() {
{
Geom_traits_2 traits; Geom_traits_2 traits;
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object();
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv =

View File

@ -23,12 +23,10 @@ typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
Arrangement_2; Arrangement_2;
typedef Arrangement_2::Vertex_handle Vertex_handle; typedef Arrangement_2::Vertex_handle Vertex_handle;
int main() int main() {
{
Geom_traits_2 traits; Geom_traits_2 traits;
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); auto ctr_p = traits.construct_point_2_object();
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = auto ctr_xcv = traits.construct_x_monotone_curve_2_object();
traits.construct_x_monotone_curve_2_object();
Arrangement_2 arr(&traits); Arrangement_2 arr(&traits);
Point_2 sp = ctr_p(0, 0, -1); Point_2 sp = ctr_p(0, 0, -1);
Point_2 np = ctr_p(0, 0, 1); Point_2 np = ctr_p(0, 0, 1);

View File

@ -32,8 +32,7 @@ typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
Arrangement_2; Arrangement_2;
typedef Arrangement_2::Vertex_handle Vertex_handle; typedef Arrangement_2::Vertex_handle Vertex_handle;
int main() int main() {
{
Geom_traits_2 traits; Geom_traits_2 traits;
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object();
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv =
@ -89,7 +88,8 @@ int main()
unsigned subsets = (1 << xcvs.size()); unsigned subsets = (1 << xcvs.size());
std::cout << "#subsets curves: " << subsets << std::endl; std::cout << "#subsets curves: " << subsets << std::endl;
std::cout << "total combinations: " << (subsetsp)*(subsets) << std::endl<< std::endl;; std::cout << "total combinations: " << (subsetsp)*(subsets)
<< std::endl<< std::endl;
for (unsigned up = 0; up < subsetsp; up++) { for (unsigned up = 0; up < subsetsp; up++) {
std::vector< Point_2 > points_sub; std::vector< Point_2 > points_sub;
@ -109,8 +109,10 @@ int main()
} }
} }
std::cout << "subsetpoints #" << up << " has size: " << points_sub.size() << std::endl; std::cout << "subsetpoints #" << up << " has size: "
std::cout << "subsetcurves #" << u << " has size: " << xcvs_sub.size() << std::endl; << points_sub.size() << std::endl;
std::cout << "subsetcurves #" << u << " has size: "
<< xcvs_sub.size() << std::endl;
#if 1 #if 1
Arrangement_2 arr; Arrangement_2 arr;
@ -120,7 +122,8 @@ int main()
<< std::endl; << std::endl;
// TODO why is this signature not available as "insert(...)" // TODO why is this signature not available as "insert(...)"
CGAL::insert_empty(arr, xcvs_sub.begin(), xcvs_sub.end(), points_sub.begin(), points_sub.end()); CGAL::insert_empty(arr, xcvs_sub.begin(), xcvs_sub.end(),
points_sub.begin(), points_sub.end());
// Print the size of the arrangement. // Print the size of the arrangement.
std::cout << "The arrangement size:" << std::endl std::cout << "The arrangement size:" << std::endl
@ -128,7 +131,8 @@ int main()
<< ", E = " << arr.number_of_edges() << ", E = " << arr.number_of_edges()
<< ", F = " << arr.number_of_faces() << std::endl; << ", F = " << arr.number_of_faces() << std::endl;
std::cout << "=======================================================" << std::endl << std::endl << std::endl; std::cout << "======================================================="
<< std::endl << std::endl << std::endl;
#endif #endif
//std::cout << "arr: " << arr << std::endl; //std::cout << "arr: " << arr << std::endl;
std::cout << std::endl; std::cout << std::endl;

View File

@ -19,8 +19,7 @@ typedef CGAL::Arr_spherical_topology_traits_2<Geom_traits_2> Topol_traits_2;
typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2> typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
Arrangement_2; Arrangement_2;
int main() int main() {
{
// Construct the arrangement from 12 geodesic arcs. // Construct the arrangement from 12 geodesic arcs.
Geom_traits_2 traits; Geom_traits_2 traits;
Arrangement_2 arr(&traits); Arrangement_2 arr(&traits);

View File

@ -17,8 +17,7 @@ typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
Arrangement_2; Arrangement_2;
typedef CGAL::Arr_default_overlay_traits<Arrangement_2> Overlay_traits; typedef CGAL::Arr_default_overlay_traits<Arrangement_2> Overlay_traits;
int main() int main() {
{
Geom_traits_2 traits; Geom_traits_2 traits;
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object();
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv =

View File

@ -1,43 +1,37 @@
//! \file examples/Arrangement_on_surface_2/tracing_counting.cpp //! \file examples/Arrangement_on_surface_2/tracing_counting.cpp
// Trace all traits operations and count them. // Trace all traits operations and count them.
#include <CGAL/Cartesian.h>
#include <CGAL/Quotient.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_tracing_traits_2.h>
#include <CGAL/Arr_counting_traits_2.h>
#include <list> #include <list>
typedef CGAL::Quotient<int> Number_type; #include <CGAL/basic.h>
typedef CGAL::Cartesian<Number_type> Kernel; #include <CGAL/Arr_tracing_traits_2.h>
typedef CGAL::Arr_segment_traits_2<Kernel> Segment_traits_2; #include <CGAL/Arr_counting_traits_2.h>
typedef CGAL::Arr_tracing_traits_2<Segment_traits_2> Tracing_traits_2;
typedef CGAL::Arr_counting_traits_2<Tracing_traits_2> Geom_traits_2;
typedef Geom_traits_2::Point_2 Point_2;
typedef Geom_traits_2::X_monotone_curve_2 Segment_2;
typedef CGAL::Arrangement_2<Geom_traits_2> Arrangement_2;
int main () #include "arr_exact_construction_segments.h"
{
const Segment_2 s1(Point_2(0, 0), Point_2(2, 2)); typedef CGAL::Arr_tracing_traits_2<Traits> Tracing_traits;
const Segment_2 s2(Point_2(2, 0), Point_2(0, 2)); typedef CGAL::Arr_counting_traits_2<Tracing_traits> Geom_traits;
std::list<Segment_2> segments; typedef CGAL::Arrangement_2<Geom_traits> My_arrangement;
int main() {
const Segment s1(Point(0, 0), Point(2, 2));
const Segment s2(Point(2, 0), Point(0, 2));
std::list<Segment> segments;
segments.push_back(s1); segments.push_back(s1);
segments.push_back(s2); segments.push_back(s2);
Geom_traits_2 traits; Geom_traits traits;
traits.disable_all_traces(); traits.disable_all_traces();
traits.enable_trace(Tracing_traits_2::INTERSECT_OP); traits.enable_trace(Tracing_traits::INTERSECT_OP);
// Construct an arrangement using aggregated insertion: // Construct an arrangement using aggregated insertion:
Arrangement_2 arr1(&traits); My_arrangement arr1(&traits);
insert(arr1, segments.begin(), segments.end()); insert(arr1, segments.begin(), segments.end());
std::cout << traits << std::endl; std::cout << traits << std::endl;
traits.clear_counters(); traits.clear_counters();
// Construct an arrangement using incremental insertion: // Construct an arrangement using incremental insertion:
Arrangement_2 arr2(&traits); My_arrangement arr2(&traits);
insert(arr2, s1); insert(arr2, s1);
insert(arr2, s2); insert(arr2, s2);
std::cout << traits << std::endl; std::cout << traits << std::endl;

View File

@ -1,79 +1,59 @@
//! \file examples/Arrangement_on_surface_2/vertical_decomposition.cpp //! \file examples/Arrangement_on_surface_2/vertical_decomposition.cpp
// Performing vertical decomposition of an arrangement. // Performing vertical decomposition of an arrangement.
#include <CGAL/Cartesian.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Arr_linear_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_vertical_decomposition_2.h>
#include <list> #include <list>
typedef CGAL::MP_Float Number_type; #include <CGAL/basic.h>
typedef CGAL::Cartesian<Number_type> Kernel; #include <CGAL/Arr_vertical_decomposition_2.h>
typedef CGAL::Arr_linear_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2; #include "arr_linear.h"
typedef Traits_2::X_monotone_curve_2 Segment_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
typedef Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef Arrangement_2::Face_const_handle Face_const_handle;
typedef std::pair<Vertex_const_handle, std::pair<CGAL::Object, CGAL::Object> > typedef std::pair<Vertex_const_handle, std::pair<CGAL::Object, CGAL::Object> >
Vert_decomp_entry; Vert_decomp_entry;
typedef std::list<Vert_decomp_entry> Vert_decomp_list; typedef std::list<Vert_decomp_entry> Vert_decomp_list;
int main () int main() {
{
// Construct the arrangement. // Construct the arrangement.
Arrangement_2 arr; Arrangement arr;
insert_non_intersecting_curve(arr, Segment_2(Point_2(1, 1), Point_2(3, 0))); insert_non_intersecting_curve(arr, Segment(Point(1, 1), Point(3, 0)));
insert_non_intersecting_curve(arr, Segment_2(Point_2(1, 1), Point_2(2, 2))); insert_non_intersecting_curve(arr, Segment(Point(1, 1), Point(2, 2)));
insert_non_intersecting_curve(arr, Segment_2(Point_2(2, 2), Point_2(3, 0))); insert_non_intersecting_curve(arr, Segment(Point(2, 2), Point(3, 0)));
insert_non_intersecting_curve(arr, Segment_2(Point_2(2, 2), Point_2(5, 0))); insert_non_intersecting_curve(arr, Segment(Point(2, 2), Point(5, 0)));
insert_non_intersecting_curve(arr, Segment_2(Point_2(3, 2), Point_2(5, 0))); insert_non_intersecting_curve(arr, Segment(Point(3, 2), Point(5, 0)));
insert_non_intersecting_curve(arr, Segment_2(Point_2(2, 3), Point_2(3, 3))); insert_non_intersecting_curve(arr, Segment(Point(2, 3), Point(3, 3)));
insert_non_intersecting_curve(arr, Segment_2(Point_2(0, 3), Point_2(6, 4))); insert_non_intersecting_curve(arr, Segment(Point(0, 3), Point(6, 4)));
insert_non_intersecting_curve(arr, Segment_2(Point_2(4, 4), Point_2(4, 5))); insert_non_intersecting_curve(arr, Segment(Point(4, 4), Point(4, 5)));
// Perform vertical ray-shooting from every vertex and locate the feature // Perform vertical ray-shooting from every vertex and locate the feature
// that lie below it and the feature that lies above it. // that lie below it and the feature that lies above it.
Vert_decomp_list vd_list; Vert_decomp_list vd_list;
CGAL::decompose(arr, std::back_inserter(vd_list));
CGAL::decompose (arr, std::back_inserter(vd_list));
// Print the results. // Print the results.
Vert_decomp_list::const_iterator vd_iter; std::pair<CGAL::Object, CGAL::Object> curr;
std::pair<CGAL::Object, CGAL::Object> curr; Vertex_const_handle vh;
Vertex_const_handle vh; Halfedge_const_handle hh;
Halfedge_const_handle hh; Face_const_handle fh;
Face_const_handle fh; for (auto vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
for (vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
curr = vd_iter->second; curr = vd_iter->second;
std::cout << "Vertex (" << vd_iter->first->point() << ") : "; std::cout << "Vertex (" << vd_iter->first->point() << ") : ";
std::cout << " feature below: "; std::cout << " feature below: ";
if (CGAL::assign (vh, curr.first)) if (CGAL::assign (vh, curr.first)) std::cout << '(' << vh->point() << ')';
std::cout << '(' << vh->point() << ')';
else if (CGAL::assign (hh, curr.first)) else if (CGAL::assign (hh, curr.first))
if (!hh->is_fictitious()) if (!hh->is_fictitious()) std::cout << '[' << hh->curve() << ']';
std::cout << '[' << hh->curve() << ']'; else std::cout << "NONE";
else else std::cout << "EMPTY";
std::cout << "NONE";
else
std::cout << "EMPTY";
std::cout << " feature above: "; std::cout << " feature above: ";
if (CGAL::assign (vh, curr.second)) if (CGAL::assign (vh, curr.second))
std::cout << '(' << vh->point() << ')' << std::endl; std::cout << '(' << vh->point() << ')' << std::endl;
else if (CGAL::assign (hh, curr.second)) else if (CGAL::assign (hh, curr.second))
if (!hh->is_fictitious()) if (!hh->is_fictitious())
std::cout << '[' << hh->curve() << ']' << std::endl; std::cout << '[' << hh->curve() << ']' << std::endl;
else else std::cout << "NONE" << std::endl;
std::cout << "NONE" << std::endl; else std::cout << "EMPTY" << std::endl;
else
std::cout << "EMPTY" << std::endl;
} }
return 0; return 0;

View File

@ -5,8 +5,7 @@
#include "arr_linear.h" #include "arr_linear.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
Arrangement arr; Arrangement arr;
// Insert a line in the (currently single) unbounded face of the arrangement; // Insert a line in the (currently single) unbounded face of the arrangement;

View File

@ -4,8 +4,7 @@
#include "arr_rat_functions.h" #include "arr_rat_functions.h"
#include "arr_print.h" #include "arr_print.h"
int main() int main() {
{
CGAL::set_pretty_mode(std::cout); // for nice printouts. CGAL::set_pretty_mode(std::cout); // for nice printouts.
// Define a traits class object and a constructor for rational functions. // Define a traits class object and a constructor for rational functions.

View File

@ -11,8 +11,7 @@
typedef CGAL::Arr_walk_along_line_point_location<Arrangement> Walk_pl; typedef CGAL::Arr_walk_along_line_point_location<Arrangement> Walk_pl;
typedef CGAL::Arr_trapezoid_ric_point_location<Arrangement> Trap_pl; typedef CGAL::Arr_trapezoid_ric_point_location<Arrangement> Trap_pl;
int main() int main() {
{
// Construct the arrangement. // Construct the arrangement.
Arrangement arr; Arrangement arr;
construct_segments_arr(arr); construct_segments_arr(arr);