Reputation: 175
I have this code snippet that just computes the arrangement for a few edges.:
#include <iostream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2; // Traits for segments
typedef Traits_2::Segment_2 Segment_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main() {
Arrangement_2 arrangement;
std::vector<Segment_2> segments = {
Segment_2(Kernel::Point_2(0.5, 0), Kernel::Point_2(2, 2)),
Segment_2(Kernel::Point_2(0, 1.5), Kernel::Point_2(2, 1)),
Segment_2(Kernel::Point_2(1, 0), Kernel::Point_2(1, 2)),
Segment_2(Kernel::Point_2(0, 2), Kernel::Point_2(2, 0)),
Segment_2(Kernel::Point_2(0, 1.5), Kernel::Point_2(2, 2))
};
CGAL::insert(arrangement, segments.begin(), segments.end());
std::cout << "Vertices:" << std::endl;
for (auto vit = arrangement.vertices_begin(); vit != arrangement.vertices_end(); ++vit) {
std::cout << "(" << vit->point() << ")" << std::endl;
}
return 0;
}
Now in a Project I need the functionality that I can derive the original segment of which an halfedge is a sub-segment from, e.g., in the example I have the half-edge e and would like to now know that it is a sub-segment of GH:
Is there a way to do this within CGAL? It seems like a natural functionality but i could not find it anywhere.
Upvotes: 3
Views: 54