37 #ifndef MYARRANGEMENT_H
38 #define MYARRANGEMENT_H
42 #include <CGAL/Arr_segment_traits_2.h>
43 #include <CGAL/Arrangement_2.h>
44 #include <CGAL/Arr_extended_dcel.h>
45 #include <CGAL/Arr_observer.h>
47 typedef CGAL::Arr_segment_traits_2<Extended_kernel> ArrTraits;
48 typedef CGAL::Arr_extended_dcel<ArrTraits, bool, short, bool> DCEL;
49 typedef CGAL::Arrangement_2<ArrTraits, DCEL> Arrangement;
57 class MyObserver :
public CGAL::Arr_observer<Arrangement> {
70 MyObserver(Arrangement& arr) : CGAL::Arr_observer<Arrangement>(arr) { _starterEdge =
true; }
88 virtual void before_create_edge (
const X_monotone_curve_2& s, Vertex_handle v1, Vertex_handle v2) {
89 if (_starterEdge)
return;
90 Segment sIni = (Segment) s;
91 if (Segment(v1->point(), v2->point()).direction() != sIni.direction()) {
106 e->set_data(_nextVal);
107 e->twin()->set_data(_nextValTwin);
111 e->twin()->set_data(-1);
119 virtual void before_split_edge (Halfedge_handle e, Vertex_handle v,
const X_monotone_curve_2& s1,
const X_monotone_curve_2& s2){
120 _nextVal = e->data();
121 _nextValTwin = e->twin()->data();
131 e1->set_data(_nextVal);
132 e2->set_data(_nextVal);
133 e1->twin()->set_data(_nextValTwin);
134 e2->twin()->set_data(_nextValTwin);
146 if (Segment(e->source()->point(), e->target()->point()).direction() != _originalSeg.direction()) {
147 if (e->data() == 0) {
153 if (e->data() == 1) {
168 e->set_data(_nextVal);
169 e->twin()->set_data(_nextValTwin);
virtual void after_modify_edge(Halfedge_handle e)
Definition: Arrangement.h:166
MyObserver(Arrangement &arr)
Definition: Arrangement.h:70
Definition: Arrangement.h:57
virtual void before_modify_edge(Halfedge_handle e, const X_monotone_curve_2 &s)
Definition: Arrangement.h:143
virtual void after_split_edge(Halfedge_handle e1, Halfedge_handle e2)
Definition: Arrangement.h:130
void setStarterEdge(bool b)
Definition: Arrangement.h:76
void setOriginalSeg(Segment seg)
Definition: Arrangement.h:82
virtual void before_split_edge(Halfedge_handle e, Vertex_handle v, const X_monotone_curve_2 &s1, const X_monotone_curve_2 &s2)
Definition: Arrangement.h:119
virtual void before_create_edge(const X_monotone_curve_2 &s, Vertex_handle v1, Vertex_handle v2)
Definition: Arrangement.h:88
virtual void after_create_edge(Halfedge_handle e)
Definition: Arrangement.h:104