mirror of https://github.com/CGAL/cgal
Updated
This commit is contained in:
parent
39067ddbcd
commit
6e3978daf5
|
|
@ -5,8 +5,7 @@
|
|||
#include "arr_print.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
|
||||
// Bezier.dat file if no command-line parameters are given.
|
||||
const char* filename = (argc > 1) ? argv[1] : "Bezier.dat";
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Aggregately construct the arrangement of five line segments.
|
||||
Segment segments[] = {Segment(Point(1, 0), Point(2, 4)),
|
||||
Segment(Point(5, 0), Point(5, 5)),
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ typedef CGAL::Arrangement_2<Traits> Arrangement;
|
|||
typedef Traits::Curve_2 Curve;
|
||||
typedef Traits::Polynomial_2 Polynomial;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
CGAL::set_pretty_mode(std::cout); // for nice printouts.
|
||||
|
||||
Traits traits;
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ typedef Traits::Algebraic_real_1 Algebraic_real;
|
|||
typedef Traits::X_monotone_curve_2 X_monotone_curve;
|
||||
typedef Traits::Point_2 Point;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Traits traits;
|
||||
|
||||
auto make_xmon = traits.make_x_monotone_2_object();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ typedef CGAL::Cartesian<Algebraic> Alg_kernel;
|
|||
typedef Rat_kernel::Point_2 Rat_point;
|
||||
typedef CGAL::Arr_Bezier_curve_traits_2<Rat_kernel, Alg_kernel, Nt_traits>
|
||||
Traits;
|
||||
typedef Traits::X_monotone_curve_2 Bezier_x_monotone_curve;
|
||||
typedef Traits::Curve_2 Bezier_curve;
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits;
|
|||
typedef Traits::CoordNT CoordNT;
|
||||
typedef Traits::Point_2 Point;
|
||||
typedef Traits::Curve_2 Curve;
|
||||
typedef Traits::X_monotone_curve_2 X_monotone_curve;
|
||||
typedef Traits::Rational_point_2 Rational_point;
|
||||
typedef Traits::Rational_segment_2 Segment;
|
||||
typedef Traits::Rational_circle_2 Circle;
|
||||
|
|
|
|||
|
|
@ -19,5 +19,8 @@ typedef CGAL::Arrangement_2<Traits> Arrangement;
|
|||
typedef Arrangement::Vertex_handle Vertex_handle;
|
||||
typedef Arrangement::Halfedge_handle Halfedge_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
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@
|
|||
typedef CGAL::Arr_point_location_result<Arrangement> Point_location_result;
|
||||
typedef std::pair<Point, Point_location_result::Type> Query_result;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Construct the arrangement.
|
||||
Arrangement arr;
|
||||
construct_segments_arr(arr);
|
||||
|
|
|
|||
|
|
@ -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::list<Vert_decomp_entry> Vert_decomp_list;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Construct the arrangement.
|
||||
Segment segments[] = {Segment(Point(0, 0), Point(3, 3)),
|
||||
Segment(Point(3, 3), Point(6, 0)),
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
#include "arr_circular.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
Arrangement_2 arr;
|
||||
int main() {
|
||||
Arrangement arr;
|
||||
|
||||
// Create a circle centered at the origin with radius 5 (C1).
|
||||
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));
|
||||
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.
|
||||
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: "
|
||||
<< "v_max = (" << v_max->point() << ") "
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_circular.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
std::list<Curve> curves;
|
||||
|
||||
// Create a circle (C1) centered at the origin with squared radius 2.
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ typedef CGAL::Arr_circular_line_arc_traits_2<Circular_k> Traits;
|
|||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
typedef CGAL::Arr_naive_point_location<Arrangement> Point_location;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
CGAL::Random generatorOfgenerator;
|
||||
int random_seed = generatorOfgenerator.get_int(0, 123456);
|
||||
std::cout << "random_seed = " << random_seed << std::endl;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,34 @@
|
|||
//! \file examples/Arrangement_on_surface_2/conic_multiplicities.cpp
|
||||
// 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_print.h"
|
||||
|
||||
int main ()
|
||||
{
|
||||
Arrangement_2 arr;
|
||||
typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl;
|
||||
|
||||
int main() {
|
||||
Arrangement arr;
|
||||
Naive_pl pl(arr);
|
||||
|
||||
// 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).
|
||||
// Note that the arc is counterclockwise oriented.
|
||||
Point_2 ps1(-1, Rational(1,2));
|
||||
Point_2 pt1(Rational(1,2), Rational(1,2));
|
||||
Conic_arc_2 cv1(1, 0, 1, 0, -1, 0, CGAL::COUNTERCLOCKWISE, ps1, pt1);
|
||||
Point ps1(-1, Rational(1,2));
|
||||
Point pt1(Rational(1,2), Rational(1,2));
|
||||
Conic_arc cv1(1, 0, 1, 0, -1, 0, CGAL::COUNTERCLOCKWISE, ps1, pt1);
|
||||
insert(arr, cv1, pl);
|
||||
|
||||
// Insert the bottom half of the circle centered at (0, 1/2) whose radius
|
||||
// is 1/2 (therefore its squared radius is 1/4).
|
||||
Rat_circle_2 circ2(Rat_point_2(0, Rational(1,2)), Rational(1,4));
|
||||
Point_2 ps2(-Rational(1,2), Rational(1,2));
|
||||
Point_2 pt2(Rational(1,2), Rational(1,2));
|
||||
Conic_arc_2 cv2(circ2, CGAL::COUNTERCLOCKWISE, ps2, pt2);
|
||||
Rat_circle circ2(Rat_point(0, Rational(1,2)), Rational(1,4));
|
||||
Point ps2(-Rational(1,2), Rational(1,2));
|
||||
Point pt2(Rational(1,2), Rational(1,2));
|
||||
Conic_arc cv2(circ2, CGAL::COUNTERCLOCKWISE, ps2, pt2);
|
||||
insert(arr, cv2, pl);
|
||||
|
||||
print_arrangement (arr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_conics.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Arrangement arr;
|
||||
|
||||
// Insert a hyperbolic arc (C1), supported by the hyperbola y = 1/x
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, Segment_color>
|
|||
typedef Data_traits::Curve_2 Colored_segment;
|
||||
typedef CGAL::Arrangement_2<Data_traits> Colored_arr;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Colored_arr arr;
|
||||
|
||||
// Construct an arrangement containing three RED line segments.
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ typedef CGAL::Arrangement_with_history_2<Traits> Arr_with_hist;
|
|||
typedef Arr_with_hist::Curve_handle Curve_handle;
|
||||
typedef CGAL::Arr_trapezoid_ric_point_location<Arr_with_hist> Point_location;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Insert s1, s2, and s3 incrementally.
|
||||
Arr_with_hist arr;
|
||||
Curve_handle s1 = insert(arr, Segment(Point(0, 3), Point(4, 3)));
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ enum Color {BLUE, RED, WHITE};
|
|||
typedef CGAL::Arr_extended_dcel<Traits, Color, bool, unsigned int> Dcel;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int main() {
|
||||
// Construct the arrangement containing two intersecting triangles.
|
||||
Traits traits;
|
||||
Ex_arrangement arr(&traits);
|
||||
|
|
|
|||
|
|
@ -1,64 +1,50 @@
|
|||
//! \file examples/Arrangement_on_surface_2/dcel_extension_io.cpp
|
||||
// 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 <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};
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, const Color& color)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
std::ostream& operator<<(std::ostream& os, const Color& color) {
|
||||
switch (color) {
|
||||
case BLUE: os << "BLUE"; break;
|
||||
case RED: os << "RED"; break;
|
||||
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;
|
||||
is >> str;
|
||||
|
||||
if (str == "BLUE")
|
||||
color = BLUE;
|
||||
else if (str == "RED")
|
||||
color = RED;
|
||||
else if (str == "WHITE")
|
||||
color = WHITE;
|
||||
|
||||
return (is);
|
||||
if (str == "BLUE") color = BLUE;
|
||||
else if (str == "RED") color = RED;
|
||||
else if (str == "WHITE") color = WHITE;
|
||||
return is;
|
||||
}
|
||||
|
||||
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||
typedef Traits_2::Point_2 Point_2;
|
||||
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
||||
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;
|
||||
typedef CGAL::Arr_extended_dcel<Traits, Color, bool, int> Ext_dcel;
|
||||
typedef CGAL::Arrangement_2<Traits, Ext_dcel> Ext_arrangement;
|
||||
typedef CGAL::Arr_extended_dcel_text_formatter<Ext_arrangement> Formatter;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int main() {
|
||||
// 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_2 s2 (Point_2(1, 6), Point_2(7, 6));
|
||||
Segment_2 s3 (Point_2(4, 1), Point_2(1, 6));
|
||||
Segment_2 s4 (Point_2(1, 3), Point_2(7, 3));
|
||||
Segment_2 s5 (Point_2(1, 3), Point_2(4, 8));
|
||||
Segment_2 s6 (Point_2(4, 8), Point_2(7, 3));
|
||||
Segment s1(Point(4, 1), Point(7, 6));
|
||||
Segment s2(Point(1, 6), Point(7, 6));
|
||||
Segment s3(Point(4, 1), Point(1, 6));
|
||||
Segment s4(Point(1, 3), Point(7, 3));
|
||||
Segment s5(Point(1, 3), Point(4, 8));
|
||||
Segment s6(Point(4, 8), Point(7, 3));
|
||||
|
||||
insert_non_intersecting_curve(arr, s1);
|
||||
insert_non_intersecting_curve(arr, s2);
|
||||
|
|
@ -68,46 +54,29 @@ int main ()
|
|||
insert(arr, s6);
|
||||
|
||||
// Go over all arrangement vertices and set their colors.
|
||||
Arrangement_2::Vertex_iterator vit;
|
||||
std::size_t degree;
|
||||
|
||||
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit)
|
||||
{
|
||||
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.
|
||||
for (auto vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
|
||||
auto 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.
|
||||
Arrangement_2::Edge_iterator eit;
|
||||
bool flag;
|
||||
|
||||
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
|
||||
{
|
||||
for (auto eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) {
|
||||
// Check if the halfedge has the same direction as its associated
|
||||
// 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->twin()->set_data(! flag);
|
||||
}
|
||||
|
||||
// Go over all arrangement faces and print their outer boundary and indices.
|
||||
Arrangement_2::Face_iterator fit;
|
||||
Arrangement_2::Ccb_halfedge_circulator curr;
|
||||
int boundary_size;
|
||||
|
||||
for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit)
|
||||
{
|
||||
for (auto fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) {
|
||||
boundary_size = 0;
|
||||
if (! fit->is_unbounded())
|
||||
{
|
||||
curr = fit->outer_ccb();
|
||||
do
|
||||
{
|
||||
if (! fit->is_unbounded()) {
|
||||
auto curr = fit->outer_ccb();
|
||||
do {
|
||||
++boundary_size;
|
||||
++curr;
|
||||
} while (curr != fit->outer_ccb());
|
||||
|
|
@ -118,20 +87,19 @@ int main ()
|
|||
// Write the arrangement to a file.
|
||||
std::ofstream out_file("arr_ex_dcel_io.dat");
|
||||
Formatter formatter;
|
||||
|
||||
write(arr, out_file, formatter);
|
||||
out_file.close();
|
||||
|
||||
// Read the arrangement from the file.
|
||||
Arrangement_2 arr2;
|
||||
Ext_arrangement arr2;
|
||||
std::ifstream in_file("arr_ex_dcel_io.dat");
|
||||
|
||||
read(arr2, in_file, formatter);
|
||||
in_file.close();
|
||||
|
||||
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;
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
#include "arr_linear.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
|
||||
// points.dat file if no command-line parameters are given.
|
||||
const char* filename = (argc > 1) ? argv[1] : "points.dat";
|
||||
|
|
|
|||
|
|
@ -4,42 +4,33 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Exact_rational.h>
|
||||
#include <CGAL/Arr_linear_traits_2.h>
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Arr_curve_data_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
#include "arr_linear.h"
|
||||
#include "read_objects.h"
|
||||
|
||||
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
|
||||
typedef CGAL::Arr_linear_traits_2<Kernel> Linear_traits_2;
|
||||
typedef Linear_traits_2::Point_2 Point_2;
|
||||
typedef Linear_traits_2::Line_2 Line_2;
|
||||
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;
|
||||
typedef CGAL::Arr_curve_data_traits_2<Traits, size_t> Data_traits;
|
||||
typedef Data_traits::X_monotone_curve_2 Data_x_monotone_curve_2;
|
||||
typedef CGAL::Arrangement_2<Data_traits> Data_arrangement;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int main(int argc, char* argv[]) {
|
||||
// Get the name of the input file from the command line, or use the default
|
||||
// points.dat file if no command-line parameters are given.
|
||||
const char* filename = (argc > 1) ? argv[1] : "coll_points.dat";
|
||||
|
||||
std::vector<Point_2> points;
|
||||
|
||||
read_objects<Point_2>(filename, std::back_inserter(points));
|
||||
std::vector<X_monotone_curve_2> dual_lines(points.size());
|
||||
std::vector<Point> points;
|
||||
read_objects<Point>(filename, std::back_inserter(points));
|
||||
std::vector<Data_x_monotone_curve_2> dual_lines(points.size());
|
||||
size_t k{0};
|
||||
std::transform(points.begin(), points.end(), dual_lines.begin(),
|
||||
[&](const Point_2& p) {
|
||||
Line_2 dual_line(p.x(), CGAL::Exact_rational(-1), -(p.y()));
|
||||
return X_monotone_curve_2(dual_line, k++);
|
||||
[&](const Point& p) {
|
||||
Line dual_line(p.x(), -1, -(p.y()));
|
||||
return Data_x_monotone_curve_2(dual_line, k++);
|
||||
});
|
||||
|
||||
// Construct the dual arrangement by aggregately inserting the lines.
|
||||
Arrangement_2 arr;
|
||||
Data_arrangement arr;
|
||||
insert(arr, dual_lines.begin(), dual_lines.end());
|
||||
|
||||
// Look for vertices whose degree is greater than 4.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_inexact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_inexact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Step (a)---construct a rectangular face.
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ typedef CGAL::Arrangement_with_history_2<Traits> Arr_with_hist;
|
|||
typedef Arr_with_hist::Curve_handle Curve_handle;
|
||||
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
|
||||
// C[1], ..., C[8] of radius 1.
|
||||
const Number_type _7_halves = Number_type(7) / Number_type(2);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ private:
|
|||
size_t n_faces; // the current number of faces
|
||||
|
||||
public:
|
||||
|
||||
Face_index_observer(Ex_arrangement& arr) :
|
||||
CGAL::Arr_observer<Ex_arrangement>(arr), n_faces(0)
|
||||
{
|
||||
|
|
@ -31,8 +30,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
int main() {
|
||||
// Construct the arrangement containing two intersecting triangles.
|
||||
Ex_arrangement arr;
|
||||
Face_index_observer obs(arr);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ typedef CGAL::Arr_face_overlay_traits<Ex_arrangement, Ex_arrangement,
|
|||
std::logical_and<bool> >
|
||||
Overlay_traits;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Construct the first arrangement, containing a square-shaped face.
|
||||
Ex_arrangement arr1;
|
||||
insert_non_intersecting_curve(arr1, Segment(Point(2, 2), Point(6, 2)));
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ typedef Ex_traits::Curve_2 Ex_polyline;
|
|||
typedef Ex_traits::X_monotone_curve_2 Ex_x_monotone_polyline;
|
||||
typedef CGAL::Arrangement_2<Ex_traits> Ex_arrangement;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Construct an arrangement of four polylines named A--D.
|
||||
Ex_traits traits;
|
||||
Ex_arrangement arr(&traits);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main ()
|
||||
{
|
||||
int main() {
|
||||
Segment S1[] = {Segment(Point(1, 3), Point(4, 6)),
|
||||
Segment(Point(1, 3), Point(6, 3)),
|
||||
Segment(Point(1, 3), Point(4, 0)),
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Create an arrangement of four line segments forming an H-shape:
|
||||
Arrangement arr;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@
|
|||
typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl;
|
||||
typedef CGAL::Arr_point_location_result<Arrangement>::Type Pl_result_type;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Construct the arrangement of five intersecting segments.
|
||||
Arrangement arr;
|
||||
Naive_pl pl(arr);
|
||||
|
|
|
|||
|
|
@ -1,48 +1,34 @@
|
|||
//! \file examples/Arrangement_on_surface_2/io.cpp
|
||||
// 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 <CGAL/basic.h>
|
||||
#include <CGAL/IO/Arr_iostream.h>
|
||||
|
||||
#include "arr_inexact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
#include "point_location_utils.h"
|
||||
|
||||
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int main() {
|
||||
// Construct the arrangement.
|
||||
Arrangement_2 arr;
|
||||
|
||||
construct_segments_arr (arr);
|
||||
|
||||
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;
|
||||
Arrangement arr1;
|
||||
construct_segments_arr(arr1);
|
||||
std::cout << "Writing" << std::endl;
|
||||
print_arrangement_size(arr1);
|
||||
|
||||
// Write the arrangement to a file.
|
||||
std::ofstream out_file("arr_ex_io.dat");
|
||||
|
||||
out_file << arr;
|
||||
out_file << arr1;
|
||||
out_file.close();
|
||||
|
||||
// Read the arrangement from the file.
|
||||
Arrangement_2 arr2;
|
||||
Arrangement arr2;
|
||||
std::ifstream in_file("arr_ex_io.dat");
|
||||
|
||||
in_file >> arr2;
|
||||
in_file.close();
|
||||
std::cout << "Reading" << std::endl;
|
||||
print_arrangement_size(arr2);
|
||||
|
||||
std::cout << "Read an arrangement of size:" << std::endl
|
||||
<< " V = " << arr2.number_of_vertices()
|
||||
<< ", E = " << arr2.number_of_edges()
|
||||
<< ", F = " << arr2.number_of_faces() << std::endl;
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,57 +1,46 @@
|
|||
//! \file examples/Arrangement_on_surface_2/io_curve_history.cpp
|
||||
// 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>
|
||||
|
||||
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||
typedef Traits_2::Point_2 Point_2;
|
||||
typedef Traits_2::Curve_2 Segment_2;
|
||||
typedef CGAL::Arrangement_with_history_2<Traits_2> Arr_with_hist_2;
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Arrangement_with_history_2.h>
|
||||
#include <CGAL/IO/Arr_with_history_iostream.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
Arr_with_hist_2 arr;
|
||||
#include "arr_exact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arrangement_with_history_2<Traits> Arr_with_hist;
|
||||
|
||||
int main() {
|
||||
// Insert six additional segments aggregately:
|
||||
Segment_2 segs[6];
|
||||
segs[0] = Segment_2 (Point_2 (2, 6), Point_2 (7, 1));
|
||||
segs[1] = Segment_2 (Point_2 (3, 2), Point_2 (3, 5));
|
||||
segs[2] = Segment_2 (Point_2 (2, 3), Point_2 (5, 3));
|
||||
segs[3] = Segment_2 (Point_2 (2, 6), Point_2 (7, 1));
|
||||
segs[4] = Segment_2 (Point_2 (0, 0), Point_2 (2, 6));
|
||||
segs[5] = Segment_2 (Point_2 (3, 4), Point_2 (6, 4));
|
||||
insert (arr, segs, segs + 6);
|
||||
Segment segs[6];
|
||||
segs[0] = Segment(Point(2, 6), Point(7, 1));
|
||||
segs[1] = Segment(Point(3, 2), Point(3, 5));
|
||||
segs[2] = Segment(Point(2, 3), Point(5, 3));
|
||||
segs[3] = Segment(Point(2, 6), Point(7, 1));
|
||||
segs[4] = Segment(Point(0, 0), Point(2, 6));
|
||||
segs[5] = Segment(Point(3, 4), Point(6, 4));
|
||||
|
||||
Arr_with_hist arr1;
|
||||
insert(arr1, segs, segs + 6);
|
||||
std::cout << "Writing an arrangement of "
|
||||
<< arr.number_of_curves() << " input segments:" << std::endl
|
||||
<< " V = " << arr.number_of_vertices()
|
||||
<< ", E = " << arr.number_of_edges()
|
||||
<< ", F = " << arr.number_of_faces() << std::endl;
|
||||
<< arr1.number_of_curves() << " input segments:" << std::endl;
|
||||
print_arrangement_size(arr1);
|
||||
|
||||
// Write the arrangement to a file.
|
||||
std::ofstream out_file("arr_ex_io_hist.dat");
|
||||
|
||||
out_file << arr;
|
||||
out_file << arr1;
|
||||
out_file.close();
|
||||
|
||||
// Read the arrangement from the file.
|
||||
Arr_with_hist_2 arr2;
|
||||
Arr_with_hist arr2;
|
||||
std::ifstream in_file("arr_ex_io_hist.dat");
|
||||
|
||||
in_file >> arr2;
|
||||
in_file.close();
|
||||
|
||||
std::cout << "Read an arrangement of "
|
||||
<< arr2.number_of_curves() << " input segments:" << std::endl
|
||||
<< " V = " << arr2.number_of_vertices()
|
||||
<< ", E = " << arr2.number_of_edges()
|
||||
<< ", F = " << arr2.number_of_faces() << std::endl;
|
||||
<< arr2.number_of_curves() << " input segments:" << std::endl;
|
||||
print_arrangement_size(arr2);
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,24 @@
|
|||
//! \file examples/Arrangement_2/io_unbounded.cpp
|
||||
// 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 <fstream>
|
||||
|
||||
typedef CGAL::Cartesian<CGAL::Exact_rational> Kernel;
|
||||
typedef CGAL::Arr_linear_traits_2<Kernel> Traits_2;
|
||||
typedef Traits_2::Point_2 Point_2;
|
||||
typedef Traits_2::Segment_2 Segment_2;
|
||||
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;
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/IO/Arr_iostream.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
#include "arr_linear.h"
|
||||
|
||||
int main() {
|
||||
// Construct an arrangement of five linear objects.
|
||||
Arrangement_2 arr;
|
||||
std::list<X_monotone_curve_2> curves;
|
||||
Arrangement arr;
|
||||
std::list<X_monotone_curve> curves;
|
||||
|
||||
curves.push_back (Line_2 (Point_2 (0, 0), Point_2 (2, 1)));
|
||||
curves.push_back (Line_2 (Point_2 (0, 0), Point_2 (2, -1)));
|
||||
curves.push_back (Line_2 (Point_2 (-1, 0), Point_2 (-1, 1)));
|
||||
curves.push_back (Ray_2 (Point_2 (2, 3), Point_2 (2, 4)));
|
||||
curves.push_back (Segment_2 (Point_2 (0, 1), Point_2 (0, 2)));
|
||||
curves.push_back(Line(Point(0, 0), Point(2, 1)));
|
||||
curves.push_back(Line(Point(0, 0), Point(2, -1)));
|
||||
curves.push_back(Line(Point(-1, 0), Point(-1, 1)));
|
||||
curves.push_back(Ray(Point(2, 3), Point(2, 4)));
|
||||
curves.push_back(Segment(Point(0, 1), Point(0, 2)));
|
||||
|
||||
insert(arr, curves.begin(), curves.end());
|
||||
|
||||
|
|
@ -49,7 +39,7 @@ int main ()
|
|||
out_file.close();
|
||||
|
||||
// Read the arrangement from the file.
|
||||
Arrangement_2 arr2;
|
||||
Arrangement arr2;
|
||||
std::ifstream in_file("arr_ex_io_unbounded.dat");
|
||||
|
||||
in_file >> arr2;
|
||||
|
|
@ -64,5 +54,5 @@ int main ()
|
|||
<< " (" << arr2.number_of_unbounded_faces() << " unbounded)"
|
||||
<< std::endl << std::endl;
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_inexact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Insert isolated points.
|
||||
Arrangement arr;
|
||||
Face_handle uf = arr.unbounded_face();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
// An observer that receives notifications of face splits and face mergers.
|
||||
class My_observer : public CGAL::Arr_observer<Arrangement> {
|
||||
public:
|
||||
|
||||
My_observer(Arrangement& arr) : CGAL::Arr_observer<Arrangement>(arr) {}
|
||||
|
||||
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.
|
||||
Arrangement arr;
|
||||
My_observer obs(arr);
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Construct the first arrangement, containing a square-shaped face.
|
||||
Arrangement arr1;
|
||||
insert_non_intersecting_curve(arr1, Segment(Point(2, 2), Point(6, 2)));
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ typedef unsigned int Color;
|
|||
typedef CGAL::Arr_extended_dcel<Traits, Color, Color, Color> Dcel;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
const Color vcol1(0x00000080), hcol1(0x000000ff), fcol1(0x00ccccff);
|
||||
const Color vcol2(0x00800000), hcol2(0x00ff0000), fcol2(0x00ffcccc);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@ typedef CGAL::Arr_face_overlay_traits<Arrangement_blue, Arrangement_red,
|
|||
Arrangement_res, Overlay_label>
|
||||
Overlay_traits;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Construct the first arrangement, induced by two lines y = x and y = -x.
|
||||
Arrangement_blue arr1;
|
||||
insert(arr1, Line(Point(0, 0), Point(1, 1)));
|
||||
|
|
|
|||
|
|
@ -11,23 +11,22 @@
|
|||
typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl;
|
||||
typedef CGAL::Arr_landmarks_point_location<Arrangement> Landmarks_pl;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int main() {
|
||||
// Construct the arrangement.
|
||||
Arrangement arr;
|
||||
construct_segments_arr(arr);
|
||||
|
||||
// Perform some point-location queries using the naive strategy.
|
||||
Naive_pl naive_pl(arr);
|
||||
point_location_query(naive_pl, Point(1, 4)); // q1
|
||||
point_location_query(naive_pl, Point(4, 3)); // q2
|
||||
point_location_query(naive_pl, Point(6, 3)); // q3
|
||||
locate_point(naive_pl, Point(1, 4)); // q1
|
||||
locate_point(naive_pl, Point(4, 3)); // q2
|
||||
locate_point(naive_pl, Point(6, 3)); // q3
|
||||
|
||||
// Perform some point-location queries using the landmark strategy.
|
||||
Landmarks_pl landmarks_pl(arr);
|
||||
point_location_query(landmarks_pl, Point(3, 2)); // q4
|
||||
point_location_query(landmarks_pl, Point(5, 2)); // q5
|
||||
point_location_query(landmarks_pl, Point(1, 0)); // q6
|
||||
locate_point(landmarks_pl, Point(3, 2)); // q4
|
||||
locate_point(landmarks_pl, Point(5, 2)); // q5
|
||||
locate_point(landmarks_pl, Point(1, 0)); // q6
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,46 +6,30 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
std::cout << "Sorry, this example needs CORE ..." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/CORE_algebraic_number_traits.h>
|
||||
#include <CGAL/Arr_Bezier_curve_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Arr_polycurve_traits_2.h>
|
||||
|
||||
#include "arr_Bezier.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::CORE_algebraic_number_traits Nt_traits;
|
||||
typedef Nt_traits::Rational NT;
|
||||
typedef Nt_traits::Rational Rational;
|
||||
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;
|
||||
typedef CGAL::Arr_polycurve_traits_2<Traits> Polycurve_bezier_traits;
|
||||
typedef Polycurve_bezier_traits::X_monotone_curve_2 X_mono_polycurve;
|
||||
typedef CGAL::Arrangement_2<Polycurve_bezier_traits> Arrangement_2;
|
||||
|
||||
int main()
|
||||
{
|
||||
Polycurve_bezier_traits_2 pc_traits;
|
||||
Bezier_traits bezier_traits;
|
||||
int main() {
|
||||
Polycurve_bezier_traits pc_traits;
|
||||
Traits bezier_traits;
|
||||
|
||||
Polycurve_bezier_traits_2::Construct_x_monotone_curve_2
|
||||
construct_x_mono_polycurve =
|
||||
pc_traits.construct_x_monotone_curve_2_object();
|
||||
auto ctr_xpolycurve = 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
|
||||
// Bezier.dat file if no command-line parameters are given.
|
||||
const char* filename = "Bezier_polycurve.dat";
|
||||
|
|
@ -60,8 +44,8 @@ int main()
|
|||
|
||||
// Read the curves from the input file.
|
||||
unsigned int n_curves;
|
||||
std::list<Bezier_x_curve_2> x_curves;
|
||||
Bezier_curve_2 B;
|
||||
std::list<Bezier_x_monotone_curve> x_curves;
|
||||
Bezier_curve B;
|
||||
|
||||
in_file >> n_curves;
|
||||
unsigned int k;
|
||||
|
|
@ -71,13 +55,12 @@ int main()
|
|||
//convert it into x-monotone bezier curve.
|
||||
std::vector<CGAL::Object> obj_vector;
|
||||
bezier_traits.make_x_monotone_2_object()(B, std::back_inserter(obj_vector));
|
||||
Bezier_x_curve_2 x_seg =
|
||||
CGAL::object_cast<Bezier_x_curve_2>((obj_vector[0]));
|
||||
Bezier_x_monotone_curve x_seg =
|
||||
CGAL::object_cast<Bezier_x_monotone_curve>((obj_vector[0]));
|
||||
x_curves.push_back(x_seg);
|
||||
}
|
||||
|
||||
X_mono_polycurve polycurve =
|
||||
construct_x_mono_polycurve(x_curves.begin(), x_curves.end());
|
||||
X_mono_polycurve polycurve = ctr_xpolycurve(x_curves.begin(), x_curves.end());
|
||||
|
||||
// Construct the arrangement.
|
||||
Arrangement_2 arr;
|
||||
|
|
|
|||
|
|
@ -6,70 +6,57 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
std::cout << "Sorry, this example needs CORE ..." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Quotient.h>
|
||||
#include <CGAL/MP_Float.h>
|
||||
#include <CGAL/CORE_algebraic_number_traits.h>
|
||||
#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_circle_segment_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
#include "arr_circular.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Quotient<CGAL::MP_Float> Number_type;
|
||||
typedef CGAL::Cartesian<Number_type> Kernel;
|
||||
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Arc_traits_2;
|
||||
typedef CGAL::Arr_polycurve_traits_2<Arc_traits_2> Polycurve_arc_traits_2;
|
||||
|
||||
typedef Arc_traits_2::CoordNT CoordNT;
|
||||
typedef Arc_traits_2::Point_2 Point_2;
|
||||
typedef Arc_traits_2::Curve_2 Arc_section_2;
|
||||
typedef Arc_traits_2::X_monotone_curve_2 Arc_x_monotone_section_2;
|
||||
|
||||
typedef Polycurve_arc_traits_2::X_monotone_curve_2 X_monotone_polycurve;
|
||||
typedef Polycurve_arc_traits_2::Curve_2 Polycurve;
|
||||
typedef CGAL::Arr_polycurve_traits_2<Traits> Polycurve_traits;
|
||||
typedef Polycurve_traits::X_monotone_curve_2 X_monotone_polycurve;
|
||||
typedef Polycurve_traits::Curve_2 Polycurve;
|
||||
typedef Kernel::Circle_2 Circle_2;
|
||||
typedef CGAL::Arrangement_2<Polycurve_arc_traits_2>
|
||||
Polycurve_circ_arc_arrangment;
|
||||
typedef CGAL::Arrangement_2<Polycurve_traits> Polycurve_circ_arc_arrangment;
|
||||
|
||||
int main()
|
||||
{
|
||||
Polycurve_arc_traits_2 traits;
|
||||
int main() {
|
||||
Polycurve_traits traits;
|
||||
auto ctr_curve = traits.construct_curve_2_object();
|
||||
auto ctr_xcurve = traits.construct_x_monotone_curve_2_object();
|
||||
|
||||
//Containers to store conic curves that will be used to create polycurve.
|
||||
std::vector<Arc_section_2> curves;
|
||||
std::vector<Arc_x_monotone_section_2> x_curves;
|
||||
std::vector<Curve> curves;
|
||||
std::vector<X_monotone_curve> x_curves;
|
||||
|
||||
// Create a circular arc of the circle, directed clockwise from
|
||||
// (-1, 0) to (1, 0) centered at (0,0). Note that we orient the
|
||||
// supporting circle accordingly.
|
||||
Kernel::Point_2 c1(0, 0);
|
||||
Point_2 s1(Number_type(-1, 1), Number_type(0, 1));
|
||||
Point_2 t1(Number_type(1, 1), Number_type(0, 1));
|
||||
Arc_section_2 circ_arc1(c1, 1, CGAL::CLOCKWISE, s1, t1);
|
||||
Rational_point c1(0, 0);
|
||||
Point s1(Number_type(-1), Number_type(0));
|
||||
Point t1(Number_type(1), Number_type(0));
|
||||
Curve circ_arc1(c1, 1, CGAL::CLOCKWISE, s1, t1);
|
||||
curves.push_back(circ_arc1);
|
||||
|
||||
// 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
|
||||
// supporting circle accordingly.
|
||||
Kernel::Point_2 c2(3, 0);
|
||||
Point_2 s2(Number_type(1, 1), Number_type(0, 1));
|
||||
Point_2 t2(Number_type(5, 1), Number_type(0, 1));
|
||||
Arc_section_2 circ_arc2(c2, 2, CGAL::CLOCKWISE, s2, t2);
|
||||
Rational_point c2(3, 0);
|
||||
Point s2(Number_type(1), Number_type(0));
|
||||
Point t2(Number_type(5), Number_type(0));
|
||||
Curve circ_arc2(c2, 2, CGAL::CLOCKWISE, s2, t2);
|
||||
curves.push_back(circ_arc2);
|
||||
|
||||
// Create polycurve
|
||||
Polycurve polycurve_1 =
|
||||
traits.construct_curve_2_object()(curves.begin(), curves.end());
|
||||
Polycurve polycurve_1 = ctr_curve(curves.begin(), curves.end());
|
||||
|
||||
// Empty the vector in order to create another polycurve.
|
||||
curves.clear();
|
||||
|
|
@ -77,46 +64,44 @@ int main()
|
|||
// Create a circular arc of the circle, directed clockwise from
|
||||
// (-10, 13) to (-7, 10) centered at (-10,10). Note that we orient the
|
||||
// supporting circle accordingly.
|
||||
Kernel::Point_2 c3(-10, 10);
|
||||
Point_2 s3(Number_type(-10, 1), Number_type(13, 1));
|
||||
Point_2 t3(Number_type(-7, 1), Number_type(10, 1));
|
||||
Arc_section_2 circ_arc3(c3, 3, CGAL::CLOCKWISE, s3, t3);
|
||||
Rational_point c3(-10, 10);
|
||||
Point s3(Number_type(-10), Number_type(13));
|
||||
Point t3(Number_type(-7), Number_type(10));
|
||||
Curve circ_arc3(c3, 3, CGAL::CLOCKWISE, s3, t3);
|
||||
curves.push_back(circ_arc3);
|
||||
|
||||
Kernel::Point_2 c4(-20, 10);
|
||||
Point_2 s4(Number_type(-7, 1), Number_type(10, 1));
|
||||
Point_2 t4(Number_type(-20, 1), Number_type(23, 1));
|
||||
Arc_section_2 circ_arc4(c4, 13, CGAL::CLOCKWISE, s4, t4);
|
||||
Rational_point c4(-20, 10);
|
||||
Point s4(Number_type(-7), Number_type(10));
|
||||
Point t4(Number_type(-20), Number_type(23));
|
||||
Curve circ_arc4(c4, 13, CGAL::CLOCKWISE, s4, t4);
|
||||
curves.push_back(circ_arc4);
|
||||
|
||||
Kernel::Point_2 c5(-20, 25);
|
||||
Point_2 s5(Number_type(-20, 1), Number_type(23, 1));
|
||||
Point_2 t5(Number_type(-20, 1), Number_type(27, 1));
|
||||
Arc_section_2 circ_arc5(c5, 2, CGAL::CLOCKWISE, s5, t5);
|
||||
Rational_point c5(-20, 25);
|
||||
Point s5(Number_type(-20), Number_type(23));
|
||||
Point t5(Number_type(-20), Number_type(27));
|
||||
Curve circ_arc5(c5, 2, CGAL::CLOCKWISE, s5, t5);
|
||||
curves.push_back(circ_arc5);
|
||||
|
||||
Polycurve polycurve_2 =
|
||||
traits.construct_curve_2_object()(curves.begin(), curves.end());
|
||||
Polycurve polycurve_2 = ctr_curve(curves.begin(), curves.end());
|
||||
|
||||
//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);
|
||||
Point_2 s6(Number_type(8, 1), Number_type(10, 1));
|
||||
Point_2 t6(Number_type(12, 1), Number_type(10, 1));
|
||||
Arc_x_monotone_section_2 xc1(circ_1, s6, t6, CGAL::CLOCKWISE);
|
||||
Point s6(Number_type(8), Number_type(10));
|
||||
Point t6(Number_type(12), Number_type(10));
|
||||
X_monotone_curve xc1(circ_1, s6, t6, CGAL::CLOCKWISE);
|
||||
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);
|
||||
Point_2 s7(Number_type(12, 1), Number_type(10, 1));
|
||||
Point_2 t7(Number_type(14, 1), Number_type(10, 1));
|
||||
Arc_x_monotone_section_2 xc2(circ_2, s7, t7, CGAL::CLOCKWISE);
|
||||
Point s7(Number_type(12), Number_type(10));
|
||||
Point t7(Number_type(14), Number_type(10));
|
||||
X_monotone_curve xc2(circ_2, s7, t7, CGAL::CLOCKWISE);
|
||||
x_curves.push_back(xc2);
|
||||
|
||||
//create x-monotone polycurve
|
||||
X_monotone_polycurve x_polycurve_1 =
|
||||
traits.construct_x_monotone_curve_2_object()(x_curves.begin(),
|
||||
x_curves.end());
|
||||
ctr_xcurve(x_curves.begin(), x_curves.end());
|
||||
|
||||
// Insert polycurves to Arangment and print.
|
||||
Polycurve_circ_arc_arrangment polycurve_arrangment(&traits);
|
||||
|
|
|
|||
|
|
@ -6,108 +6,90 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
std::cout << "Sorry, this example needs CORE ..." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Quotient.h>
|
||||
#include <CGAL/MP_Float.h>
|
||||
#include <CGAL/CORE_algebraic_number_traits.h>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include <CGAL/basic.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"
|
||||
|
||||
typedef CGAL::CORE_algebraic_number_traits Nt_traits;
|
||||
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 CGAL::Arr_polycurve_traits_2<Traits> Polycurve_conic_traits_2;
|
||||
typedef Polycurve_conic_traits_2::X_monotone_curve_2 X_monotone_polycurve;
|
||||
typedef Polycurve_conic_traits_2::Curve_2 Polycurve;
|
||||
typedef CGAL::Arrangement_2<Polycurve_conic_traits_2> Polycurve_conic_arrangment;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Polycurve_conic_traits_2 traits;
|
||||
|
||||
// Polycurve construction functors
|
||||
Polycurve_conic_traits_2::Construct_x_monotone_curve_2
|
||||
construct_x_mono_polycurve = traits.construct_x_monotone_curve_2_object();
|
||||
Polycurve_conic_traits_2::Construct_curve_2 construct_polycurve =
|
||||
traits.construct_curve_2_object();
|
||||
auto ctr_xpolycurve = traits.construct_x_monotone_curve_2_object();
|
||||
auto ctr_polycurve = traits.construct_curve_2_object();
|
||||
|
||||
// Containers to store conic curves that will be used to create polycurve.
|
||||
std::vector<Conic_curve_2> conic_curves;
|
||||
std::vector<Conic_x_monotone_curve_2> xmono_conic_curves_2;
|
||||
std::vector<Conic_arc> conic_curves;
|
||||
std::vector<X_monotone_conic_arc> xmono_conic_curves_2;
|
||||
|
||||
// Create polycurves
|
||||
// y=x^2
|
||||
Conic_curve_2 c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Conic_point_2(Algebraic(0), Algebraic(0)),
|
||||
Conic_point_2(Algebraic(3), Algebraic(9)));
|
||||
Conic_curve_2 c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Conic_point_2(Algebraic(3), Algebraic(9)),
|
||||
Conic_point_2(Algebraic(5), Algebraic(25)));
|
||||
Conic_curve_2 c5(0,1,0,1,0,0, CGAL::COUNTERCLOCKWISE,
|
||||
Conic_point_2(Algebraic(-25), Algebraic(-5)),
|
||||
Conic_point_2(Algebraic(0), Algebraic(0)));
|
||||
Conic_arc c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Point(Algebraic(0), Algebraic(0)),
|
||||
Point(Algebraic(3), Algebraic(9)));
|
||||
Conic_arc c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Point(Algebraic(3), Algebraic(9)),
|
||||
Point(Algebraic(5), Algebraic(25)));
|
||||
Conic_arc c5(0,1,0,1,0,0, CGAL::COUNTERCLOCKWISE,
|
||||
Point(Algebraic(-25), Algebraic(-5)),
|
||||
Point(Algebraic(0), Algebraic(0)));
|
||||
|
||||
Conic_curve_2 c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE,
|
||||
Conic_point_2(Algebraic(-7), Algebraic(13)),
|
||||
Conic_point_2(Algebraic(-3), Algebraic(9)));
|
||||
Conic_curve_2 c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Conic_point_2(Algebraic(-3), Algebraic(9)),
|
||||
Conic_point_2(Algebraic(0), Algebraic(0)));
|
||||
Conic_curve_2 c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE,
|
||||
Conic_point_2(Algebraic(0), Algebraic(0)),
|
||||
Conic_point_2(Algebraic(4), Algebraic(-2)));
|
||||
Conic_arc c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE,
|
||||
Point(Algebraic(-7), Algebraic(13)),
|
||||
Point(Algebraic(-3), Algebraic(9)));
|
||||
Conic_arc c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Point(Algebraic(-3), Algebraic(9)),
|
||||
Point(Algebraic(0), Algebraic(0)));
|
||||
Conic_arc c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE,
|
||||
Point(Algebraic(0), Algebraic(0)),
|
||||
Point(Algebraic(4), Algebraic(-2)));
|
||||
|
||||
Conic_curve_2 c9(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Conic_point_2(Algebraic(-5), Algebraic(25)),
|
||||
Conic_point_2(Algebraic(5), Algebraic(25)));
|
||||
Conic_arc c9(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Point(Algebraic(-5), Algebraic(25)),
|
||||
Point(Algebraic(5), Algebraic(25)));
|
||||
|
||||
// Construct poly-curve
|
||||
conic_curves.clear();
|
||||
conic_curves.push_back(c9);
|
||||
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_point_2(Algebraic(25), Algebraic(-5)),
|
||||
Conic_point_2(Algebraic(0), Algebraic(0)));
|
||||
Conic_curve_2 c12(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Conic_point_2(Algebraic(0), Algebraic(0)),
|
||||
Conic_point_2(Algebraic(5), Algebraic(25)));
|
||||
Conic_arc c11(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE,
|
||||
Point(Algebraic(25), Algebraic(-5)),
|
||||
Point(Algebraic(0), Algebraic(0)));
|
||||
Conic_arc c12(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
|
||||
Point(Algebraic(0), Algebraic(0)),
|
||||
Point(Algebraic(5), Algebraic(25)));
|
||||
|
||||
// Construct poly-curve
|
||||
conic_curves.clear();
|
||||
conic_curves.push_back(c11);
|
||||
conic_curves.push_back(c12);
|
||||
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
|
||||
Conic_x_monotone_curve_2 xc3(c3);
|
||||
Conic_x_monotone_curve_2 xc4(c4);
|
||||
Conic_x_monotone_curve_2 xc5(c5);
|
||||
Conic_x_monotone_curve_2 xc6(c6);
|
||||
Conic_x_monotone_curve_2 xc7(c7);
|
||||
Conic_x_monotone_curve_2 xc8(c8);
|
||||
X_monotone_conic_arc xc3(c3);
|
||||
X_monotone_conic_arc xc4(c4);
|
||||
X_monotone_conic_arc xc5(c5);
|
||||
X_monotone_conic_arc xc6(c6);
|
||||
X_monotone_conic_arc xc7(c7);
|
||||
X_monotone_conic_arc xc8(c8);
|
||||
|
||||
// Construct x-monotone poly-curve from x-monotone conic curves.
|
||||
xmono_conic_curves_2.clear();
|
||||
|
|
@ -115,7 +97,7 @@ int main()
|
|||
xmono_conic_curves_2.push_back(xc3);
|
||||
xmono_conic_curves_2.push_back(xc4);
|
||||
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());
|
||||
|
||||
// Construct x-monotone poly-curve.
|
||||
|
|
@ -124,8 +106,7 @@ int main()
|
|||
xmono_conic_curves_2.push_back(xc7);
|
||||
xmono_conic_curves_2.push_back(xc8);
|
||||
X_monotone_polycurve conic_x_mono_polycurve_2 =
|
||||
construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
|
||||
xmono_conic_curves_2.end());
|
||||
ctr_xpolycurve(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end());
|
||||
|
||||
// Insert the Polycurves into arrangment and print.
|
||||
Polycurve_conic_arrangment x_pc_arrangment(&traits);
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Segment_arr;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Segment_traits_2 seg_traits;
|
||||
Segment_traits_2::Construct_point_2 ctr_p =
|
||||
seg_traits.construct_point_2_object();
|
||||
|
|
|
|||
|
|
@ -1,44 +1,41 @@
|
|||
//! \file examples/Arrangement_on_surface_2/polylines.cpp
|
||||
// Constructing an arrangement of polylines.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Arr_directional_non_caching_segment_basic_traits_2.h>
|
||||
#include <CGAL/Arr_polycurve_basic_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef CGAL::Arr_directional_non_caching_segment_basic_traits_2<Kernel>
|
||||
Subcurve_traits_2;
|
||||
typedef CGAL::Arr_polycurve_basic_traits_2<Subcurve_traits_2>
|
||||
Geom_traits_2;
|
||||
typedef Geom_traits_2::Point_2 Point_2;
|
||||
typedef Subcurve_traits_2::X_monotone_curve_2 X_monotone_subcurve_2;
|
||||
typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef CGAL::Arrangement_2<Geom_traits_2> Arrangement_2;
|
||||
Subcurve_traits;
|
||||
typedef CGAL::Arr_polycurve_basic_traits_2<Subcurve_traits> Geom_traits;
|
||||
typedef Geom_traits::Point_2 Point;
|
||||
typedef Subcurve_traits::X_monotone_curve_2 X_monotone_subcurve;
|
||||
typedef Geom_traits::X_monotone_curve_2 X_monotone_curve;
|
||||
typedef CGAL::Arrangement_2<Geom_traits> Arrangement;
|
||||
|
||||
int main()
|
||||
{
|
||||
Geom_traits_2 traits;
|
||||
Arrangement_2 arr(&traits);
|
||||
int main() {
|
||||
Geom_traits traits;
|
||||
Arrangement arr(&traits);
|
||||
|
||||
Geom_traits_2::Construct_x_monotone_curve_2 ctr =
|
||||
traits.construct_x_monotone_curve_2_object();
|
||||
auto ctr = traits.construct_x_monotone_curve_2_object();
|
||||
|
||||
std::vector<X_monotone_subcurve_2> segs1;
|
||||
segs1.push_back(X_monotone_subcurve_2(Point_2(0, 0), Point_2(1, 1)));
|
||||
segs1.push_back(X_monotone_subcurve_2(Point_2(1, 1), Point_2(2, 2)));
|
||||
segs1.push_back(X_monotone_subcurve_2(Point_2(2, 2), Point_2(3, 1)));
|
||||
segs1.push_back(X_monotone_subcurve_2(Point_2(3, 1), Point_2(4, 0)));
|
||||
X_monotone_curve_2 pc1 = ctr(segs1.begin(), segs1.end());
|
||||
std::vector<X_monotone_subcurve> segs1;
|
||||
segs1.push_back(X_monotone_subcurve(Point(0, 0), Point(1, 1)));
|
||||
segs1.push_back(X_monotone_subcurve(Point(1, 1), Point(2, 2)));
|
||||
segs1.push_back(X_monotone_subcurve(Point(2, 2), Point(3, 1)));
|
||||
segs1.push_back(X_monotone_subcurve(Point(3, 1), Point(4, 0)));
|
||||
X_monotone_curve pc1 = ctr(segs1.begin(), segs1.end());
|
||||
|
||||
std::vector<X_monotone_subcurve_2> segs2;
|
||||
segs2.push_back(X_monotone_subcurve_2(Point_2(0, 0), Point_2(1, 1)));
|
||||
segs2.push_back(X_monotone_subcurve_2(Point_2(1, 1), Point_2(2, 2)));
|
||||
segs2.push_back(X_monotone_subcurve_2(Point_2(2, 2), Point_2(3, 1)));
|
||||
segs2.push_back(X_monotone_subcurve_2(Point_2(3, 1), Point_2(4, 0)));
|
||||
X_monotone_curve_2 pc2 = ctr(segs2.begin(), segs2.end());
|
||||
std::vector<X_monotone_subcurve> segs2;
|
||||
segs2.push_back(X_monotone_subcurve(Point(0, 0), Point(1, 1)));
|
||||
segs2.push_back(X_monotone_subcurve(Point(1, 1), Point(2, 2)));
|
||||
segs2.push_back(X_monotone_subcurve(Point(2, 2), Point(3, 1)));
|
||||
segs2.push_back(X_monotone_subcurve(Point(3, 1), Point(4, 0)));
|
||||
X_monotone_curve pc2 = ctr(segs2.begin(), segs2.end());
|
||||
|
||||
insert_non_intersecting_curve(arr, pc1);
|
||||
insert_non_intersecting_curve(arr, pc2);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ typedef Geom_traits_2::Segment_2 Segment_2;
|
|||
typedef Geom_traits_2::Curve_2 Polyline_2;
|
||||
typedef CGAL::Arrangement_2<Geom_traits_2> Arrangement_2;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Geom_traits_2 traits;
|
||||
Arrangement_2 arr(&traits);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ typedef Traits_2::Point_2 Point_2;
|
|||
typedef Traits_2::X_monotone_curve_2 Segment_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
|
||||
// fan_grids.dat file if no command-line parameters are given.
|
||||
const char* filename = (argc > 1) ? argv[1] : "fan_grids.dat";
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ typedef Traits_2::Point_2 Point_2;
|
|||
typedef Traits_2::X_monotone_curve_2 Segment_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
|
||||
// Europe.dat file if no command-line parameters are given.
|
||||
const char* filename = (argc > 1) ? argv[1] : "Europe.dat";
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_rat_functions.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
CGAL::set_pretty_mode(std::cout); // for nice printouts.
|
||||
|
||||
// Define a traits class object and a constructor for rational functions.
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
|
||||
#ifndef CGAL_USE_CORE
|
||||
#include <iostream>
|
||||
int main ()
|
||||
{
|
||||
int main() {
|
||||
std::cout << "Sorry, this example needs CORE ..." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -29,8 +28,7 @@ typedef Traits_2::Algebraic_real_1 Alg_real_1;
|
|||
|
||||
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int main() {
|
||||
CGAL::set_pretty_mode(std::cout); // for nice printouts.
|
||||
|
||||
// Traits class object
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ typedef Gm::Vertex_const_handle Vertex_const_handle;
|
|||
typedef Gm::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef Gm::Face_const_handle Face_const_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Gm_polyhedron p;
|
||||
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));
|
||||
|
|
@ -85,11 +84,11 @@ protected:
|
|||
ctr_point(0, 0, -1)
|
||||
};
|
||||
|
||||
point_location_query(naive_pl, points[0]);
|
||||
point_location_query(naive_pl, points[1]);
|
||||
point_location_query(naive_pl, points[2]);
|
||||
locate_point(naive_pl, points[0]);
|
||||
locate_point(naive_pl, points[1]);
|
||||
locate_point(naive_pl, points[2]);
|
||||
|
||||
// point_location_query(trap_pl, points[0]);
|
||||
// locate_point(trap_pl, points[0]);
|
||||
|
||||
////////
|
||||
std::list<Query_result> results;
|
||||
|
|
@ -97,8 +96,7 @@ protected:
|
|||
// CGAL::locate(gm, &points[0], &points[3], std::back_inserter(results));
|
||||
|
||||
// Print the results.
|
||||
std::list<Query_result>::const_iterator it;
|
||||
for (it = results.begin(); it != results.end(); ++it) {
|
||||
for (auto it = results.begin(); it != results.end(); ++it) {
|
||||
std::cout << "The point (" << it->first << ") is located ";
|
||||
if (const Face_const_handle* f =
|
||||
boost::get<Face_const_handle>(&(it->second))) // inside a face
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_inexact_construction_segments.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);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
|
|||
Arrangement_2;
|
||||
typedef Arrangement_2::Vertex_handle Vertex_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Geom_traits_2 traits;
|
||||
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object();
|
||||
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv =
|
||||
|
|
|
|||
|
|
@ -23,12 +23,10 @@ typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
|
|||
Arrangement_2;
|
||||
typedef Arrangement_2::Vertex_handle Vertex_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Geom_traits_2 traits;
|
||||
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object();
|
||||
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv =
|
||||
traits.construct_x_monotone_curve_2_object();
|
||||
auto ctr_p = traits.construct_point_2_object();
|
||||
auto ctr_xcv = traits.construct_x_monotone_curve_2_object();
|
||||
Arrangement_2 arr(&traits);
|
||||
Point_2 sp = ctr_p(0, 0, -1);
|
||||
Point_2 np = ctr_p(0, 0, 1);
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
|
|||
Arrangement_2;
|
||||
typedef Arrangement_2::Vertex_handle Vertex_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Geom_traits_2 traits;
|
||||
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object();
|
||||
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv =
|
||||
|
|
@ -89,7 +88,8 @@ int main()
|
|||
unsigned subsets = (1 << xcvs.size());
|
||||
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++) {
|
||||
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 << "subsetcurves #" << u << " has size: " << xcvs_sub.size() << std::endl;
|
||||
std::cout << "subsetpoints #" << up << " has size: "
|
||||
<< points_sub.size() << std::endl;
|
||||
std::cout << "subsetcurves #" << u << " has size: "
|
||||
<< xcvs_sub.size() << std::endl;
|
||||
|
||||
#if 1
|
||||
Arrangement_2 arr;
|
||||
|
|
@ -120,7 +122,8 @@ int main()
|
|||
<< std::endl;
|
||||
|
||||
// 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.
|
||||
std::cout << "The arrangement size:" << std::endl
|
||||
|
|
@ -128,7 +131,8 @@ int main()
|
|||
<< ", E = " << arr.number_of_edges()
|
||||
<< ", F = " << arr.number_of_faces() << std::endl;
|
||||
|
||||
std::cout << "=======================================================" << std::endl << std::endl << std::endl;
|
||||
std::cout << "======================================================="
|
||||
<< std::endl << std::endl << std::endl;
|
||||
#endif
|
||||
//std::cout << "arr: " << arr << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Arrangement_2;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Construct the arrangement from 12 geodesic arcs.
|
||||
Geom_traits_2 traits;
|
||||
Arrangement_2 arr(&traits);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
|
|||
Arrangement_2;
|
||||
typedef CGAL::Arr_default_overlay_traits<Arrangement_2> Overlay_traits;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Geom_traits_2 traits;
|
||||
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object();
|
||||
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv =
|
||||
|
|
|
|||
|
|
@ -1,43 +1,37 @@
|
|||
//! \file examples/Arrangement_on_surface_2/tracing_counting.cpp
|
||||
// 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>
|
||||
|
||||
typedef CGAL::Quotient<int> Number_type;
|
||||
typedef CGAL::Cartesian<Number_type> Kernel;
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Segment_traits_2;
|
||||
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;
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Arr_tracing_traits_2.h>
|
||||
#include <CGAL/Arr_counting_traits_2.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
const Segment_2 s1(Point_2(0, 0), Point_2(2, 2));
|
||||
const Segment_2 s2(Point_2(2, 0), Point_2(0, 2));
|
||||
std::list<Segment_2> segments;
|
||||
#include "arr_exact_construction_segments.h"
|
||||
|
||||
typedef CGAL::Arr_tracing_traits_2<Traits> Tracing_traits;
|
||||
typedef CGAL::Arr_counting_traits_2<Tracing_traits> Geom_traits;
|
||||
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(s2);
|
||||
|
||||
Geom_traits_2 traits;
|
||||
Geom_traits traits;
|
||||
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:
|
||||
Arrangement_2 arr1(&traits);
|
||||
My_arrangement arr1(&traits);
|
||||
insert(arr1, segments.begin(), segments.end());
|
||||
std::cout << traits << std::endl;
|
||||
traits.clear_counters();
|
||||
|
||||
// Construct an arrangement using incremental insertion:
|
||||
Arrangement_2 arr2(&traits);
|
||||
My_arrangement arr2(&traits);
|
||||
insert(arr2, s1);
|
||||
insert(arr2, s2);
|
||||
std::cout << traits << std::endl;
|
||||
|
|
|
|||
|
|
@ -1,68 +1,50 @@
|
|||
//! \file examples/Arrangement_on_surface_2/vertical_decomposition.cpp
|
||||
// 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>
|
||||
|
||||
typedef CGAL::MP_Float Number_type;
|
||||
typedef CGAL::Cartesian<Number_type> Kernel;
|
||||
typedef CGAL::Arr_linear_traits_2<Kernel> Traits_2;
|
||||
typedef Traits_2::Point_2 Point_2;
|
||||
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;
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Arr_vertical_decomposition_2.h>
|
||||
|
||||
#include "arr_linear.h"
|
||||
|
||||
typedef std::pair<Vertex_const_handle, std::pair<CGAL::Object, CGAL::Object> >
|
||||
Vert_decomp_entry;
|
||||
typedef std::list<Vert_decomp_entry> Vert_decomp_list;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int main() {
|
||||
// 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_2(Point_2(1, 1), Point_2(2, 2)));
|
||||
insert_non_intersecting_curve(arr, Segment_2(Point_2(2, 2), Point_2(3, 0)));
|
||||
insert_non_intersecting_curve(arr, Segment_2(Point_2(2, 2), Point_2(5, 0)));
|
||||
insert_non_intersecting_curve(arr, Segment_2(Point_2(3, 2), Point_2(5, 0)));
|
||||
insert_non_intersecting_curve(arr, Segment_2(Point_2(2, 3), Point_2(3, 3)));
|
||||
insert_non_intersecting_curve(arr, Segment_2(Point_2(0, 3), Point_2(6, 4)));
|
||||
insert_non_intersecting_curve(arr, Segment_2(Point_2(4, 4), Point_2(4, 5)));
|
||||
insert_non_intersecting_curve(arr, Segment(Point(1, 1), Point(3, 0)));
|
||||
insert_non_intersecting_curve(arr, Segment(Point(1, 1), Point(2, 2)));
|
||||
insert_non_intersecting_curve(arr, Segment(Point(2, 2), Point(3, 0)));
|
||||
insert_non_intersecting_curve(arr, Segment(Point(2, 2), Point(5, 0)));
|
||||
insert_non_intersecting_curve(arr, Segment(Point(3, 2), Point(5, 0)));
|
||||
insert_non_intersecting_curve(arr, Segment(Point(2, 3), Point(3, 3)));
|
||||
insert_non_intersecting_curve(arr, Segment(Point(0, 3), Point(6, 4)));
|
||||
insert_non_intersecting_curve(arr, Segment(Point(4, 4), Point(4, 5)));
|
||||
|
||||
// Perform vertical ray-shooting from every vertex and locate the feature
|
||||
// that lie below it and the feature that lies above it.
|
||||
Vert_decomp_list vd_list;
|
||||
|
||||
CGAL::decompose(arr, std::back_inserter(vd_list));
|
||||
|
||||
// Print the results.
|
||||
Vert_decomp_list::const_iterator vd_iter;
|
||||
std::pair<CGAL::Object, CGAL::Object> curr;
|
||||
Vertex_const_handle vh;
|
||||
Halfedge_const_handle hh;
|
||||
Face_const_handle fh;
|
||||
|
||||
for (vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
|
||||
for (auto vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
|
||||
curr = vd_iter->second;
|
||||
std::cout << "Vertex (" << vd_iter->first->point() << ") : ";
|
||||
|
||||
std::cout << " feature below: ";
|
||||
if (CGAL::assign (vh, curr.first))
|
||||
std::cout << '(' << vh->point() << ')';
|
||||
if (CGAL::assign (vh, curr.first)) std::cout << '(' << vh->point() << ')';
|
||||
else if (CGAL::assign (hh, curr.first))
|
||||
if (!hh->is_fictitious())
|
||||
std::cout << '[' << hh->curve() << ']';
|
||||
else
|
||||
std::cout << "NONE";
|
||||
else
|
||||
std::cout << "EMPTY";
|
||||
if (!hh->is_fictitious()) std::cout << '[' << hh->curve() << ']';
|
||||
else std::cout << "NONE";
|
||||
else std::cout << "EMPTY";
|
||||
|
||||
std::cout << " feature above: ";
|
||||
if (CGAL::assign (vh, curr.second))
|
||||
|
|
@ -70,10 +52,8 @@ int main ()
|
|||
else if (CGAL::assign (hh, curr.second))
|
||||
if (!hh->is_fictitious())
|
||||
std::cout << '[' << hh->curve() << ']' << std::endl;
|
||||
else
|
||||
std::cout << "NONE" << std::endl;
|
||||
else
|
||||
std::cout << "EMPTY" << std::endl;
|
||||
else std::cout << "NONE" << std::endl;
|
||||
else std::cout << "EMPTY" << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
#include "arr_linear.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Arrangement arr;
|
||||
|
||||
// Insert a line in the (currently single) unbounded face of the arrangement;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "arr_rat_functions.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
CGAL::set_pretty_mode(std::cout); // for nice printouts.
|
||||
|
||||
// Define a traits class object and a constructor for rational functions.
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@
|
|||
typedef CGAL::Arr_walk_along_line_point_location<Arrangement> Walk_pl;
|
||||
typedef CGAL::Arr_trapezoid_ric_point_location<Arrangement> Trap_pl;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// Construct the arrangement.
|
||||
Arrangement arr;
|
||||
construct_segments_arr(arr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue