CGAL 6.3 - 1D Arrangements
Loading...
Searching...
No Matches
Arrangement_on_curve_1/simple.cpp
#include <iostream>
#include <string>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Arrangement_on_curve_1/Arrangement_on_curve_1.h>
#include <CGAL/Arrangement_on_curve_1/Ft_traits_1.h>
#include <CGAL/Arrangement_on_curve_1/insert.h>
#include <CGAL/Arrangement_on_curve_1/Unbounded_topology_traits.h>
// Use std::vector to store the vertices and force increasing lexicographical order on the vertices.
// It forces inserting the points in increasing lexicographical order.
using Point = Geom_traits::Point_1;
int main() {
auto traits_ptr = std::make_shared<const Geom_traits>();
Arrangement arr(traits_ptr);
std::cout << "Inserting raw coordinate fields into 1D track...\n";
auto v2 = CGAL::Arrangement_on_curve_1::insert(arr, Kernel::FT(2.0));
auto v3 = CGAL::Arrangement_on_curve_1::insert(arr, Kernel::FT(5.25));
auto v1 = CGAL::Arrangement_on_curve_1::insert(arr, Kernel::FT(10.5));
// Modify user-extended data fields on vertices
auto v_data_map = arr.vertex_data_map();
put(v_data_map, v1, "Right Node");
put(v_data_map, v2, "Left Node");
put(v_data_map, v3, "Center Node");
// Traverse and inspect the arrangement
std::cout << "\nResulting Sorted Sequence along the 1D Line:\n";
auto v_pnt_map = arr.vertex_point_map();
auto e = arr.unbounded_left_edge();
while (arr.has_right_vertex(e)) {
auto v = arr.right_vertex(e);
std::cout << " Vertex Point: (" << get(v_pnt_map, v) << ") | Extension ID: " << get(v_data_map, v) << "\n";
e = arr.right_edge(v);
}
return 0;
}
Definition Arrangement_on_curve_1.h:30
Ft_traits_1 is a minimal, scalar model of the AocTraits_1 concept.
Definition Ft_traits_1.h:20
The class template Unbounded_topology_traits provides a model of the AocTopologyTraits concept for 1D...
Definition Unbounded_topology_traits.h:38
Arrangement_on_curve_1< GeometryTraits, TopologyTraits >::Vertex_descriptor insert(Arrangement_on_curve_1< GeometryTraits, TopologyTraits > &arr, const typename GeometryTraits::Point_1 &p)
inserts a point into an arrangement.