From b6fb9a5aa1798438bffa9f6466f206e9086dc8f0 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 30 Jan 2024 14:48:59 +0200 Subject: [PATCH] Made all members of the cell-extension records unique (e.g., added 'env_'); this enables the simultaneous extensions required by other packages; for example, having a lower envelope diagram with history. --- .../Envelope_divide_and_conquer_3.h | 603 +++++++++--------- .../Envelope_3/Envelope_element_visitor_3.h | 403 ++++++------ .../CGAL/Envelope_3/Envelope_overlay_2.h | 224 +++---- .../Envelope_3/Envelope_overlay_functor.h | 119 ++-- .../CGAL/Envelope_3/Envelope_pm_dcel.h | 159 +++-- Envelope_3/test/Envelope_3/Envelope_test_3.h | 104 +-- .../Envelope_test_overlay_functor.h | 38 +- .../Envelope_3/Envelope_triangles_test_3.h | 61 +- 8 files changed, 823 insertions(+), 888 deletions(-) diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h index 2bc19cf65c7..ad237a7e99f 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h @@ -34,9 +34,10 @@ #include #ifdef CGAL_ENVELOPE_USE_BFS_FACE_ORDER +#include + #include #include -#include #endif // this base divide & conquer algorithm splits the input into 2 groups, @@ -129,7 +130,7 @@ public: m_own_traits = true; // Allocate the Envelope resolver with our traits - resolver = new Envelope_resolver(m_geom_traits, type); + m_resolver = new Envelope_resolver(m_geom_traits, type); m_is_lower = ((type == ENVELOPE_LOWER) ? true : false); } @@ -141,7 +142,7 @@ public: m_own_traits = false; // Allocate the Envelope resolver with our traits - resolver = new Envelope_resolver(m_geom_traits, type); + m_resolver = new Envelope_resolver(m_geom_traits, type); m_is_lower = ((type == ENVELOPE_LOWER) ? true : false); } @@ -152,7 +153,7 @@ public: if (m_own_traits) delete m_geom_traits; // Free the resolver - delete resolver; + delete m_resolver; } // compute the envelope of surfaces in 3D, using the default arbitrary @@ -213,7 +214,7 @@ public: /*! Access the traits object. */ const Traits* get_traits() const { return m_geom_traits; } - void reset() { resolver->reset(); } + void reset() { m_resolver->reset(); } protected: @@ -276,8 +277,7 @@ protected: return; } - for (auto boundary_it = boundary.begin(); - boundary_it != boundary.end(); + for (auto boundary_it = boundary.begin(); boundary_it != boundary.end(); ++boundary_it) { if (const Boundary_xcurve* boundary_cv = std::get_if(&(*boundary_it))) { @@ -287,8 +287,8 @@ protected: if (side == ON_ORIENTED_BOUNDARY) { // vertical xy-surface - he->face()->set_no_data(); - he->twin()->face()->set_no_data(); + he->face()->set_no_env_data(); + he->twin()->face()->set_no_env_data(); continue; } @@ -301,49 +301,45 @@ protected: if (side == ON_NEGATIVE_SIDE) { // the surface is below cv. f = he->twin()->face(); f->set_env_data(surf); - he->face()->set_no_data(); + he->face()->set_no_env_data(); } else { CGAL_assertion(side == ON_POSITIVE_SIDE); f = he->face(); f->set_env_data(surf); - he->twin()->face()->set_no_data(); + he->twin()->face()->set_no_env_data(); } // init auxiliary data for f and its boundaries. for (auto ocit = f->outer_ccbs_begin(); ocit != f->outer_ccbs_end(); - ocit++) { + ++ocit) { Ccb_halfedge_circulator face_hec = *ocit; Ccb_halfedge_circulator face_hec_begin = face_hec; do { - face_hec->set_is_equal_data_in_face(true); - face_hec->set_has_equal_data_in_face(true); - face_hec->set_has_equal_data_in_target_and_face(true); + face_hec->set_is_equal_env_data_in_face(true); + face_hec->set_has_equal_env_data_in_face(true); + face_hec->set_has_equal_env_data_in_target_and_face(true); - face_hec->twin()->set_is_equal_data_in_face(false); - face_hec->twin()->set_has_equal_data_in_face(false); - face_hec->twin()->set_has_equal_data_in_target_and_face(false); - - ++face_hec; - } - while(face_hec != face_hec_begin); + face_hec->twin()->set_is_equal_env_data_in_face(false); + face_hec->twin()->set_has_equal_env_data_in_face(false); + face_hec->twin()->set_has_equal_env_data_in_target_and_face(false); + } + while (++face_hec != face_hec_begin); } for (auto icit = f->inner_ccbs_begin(); icit != f->inner_ccbs_end(); - icit++) { + ++icit) { Ccb_halfedge_circulator face_hec = *icit; Ccb_halfedge_circulator face_hec_begin = face_hec; do { - face_hec->set_is_equal_data_in_face(true); - face_hec->set_has_equal_data_in_face(true); - face_hec->set_has_equal_data_in_target_and_face(true); + face_hec->set_is_equal_env_data_in_face(true); + face_hec->set_has_equal_env_data_in_face(true); + face_hec->set_has_equal_env_data_in_target_and_face(true); - face_hec->twin()->set_is_equal_data_in_face(false); - face_hec->twin()->set_has_equal_data_in_face(false); - face_hec->twin()->set_has_equal_data_in_target_and_face(false); - - ++face_hec; - } - while(face_hec != face_hec_begin); + face_hec->twin()->set_is_equal_env_data_in_face(false); + face_hec->twin()->set_has_equal_env_data_in_face(false); + face_hec->twin()->set_has_equal_env_data_in_target_and_face(false); + } + while (++face_hec != face_hec_begin); } } } @@ -363,17 +359,17 @@ protected: // since all the edges & vertices have their envelope data equal to the // current surface, we can set is/has equal_data_in_target of all // halfedges to true - hi->set_is_equal_data_in_target(true); - hi->set_has_equal_data_in_target(true); + hi->set_is_equal_env_data_in_target(true); + hi->set_has_equal_env_data_in_target(true); } for (auto vi = result.vertices_begin(); vi != result.vertices_end(); ++vi) { vi->set_env_data(surf); if (vi->is_isolated()) { // update the is/has equal_data_in_face flags according to the face data - bool equal_data = !vi->face()->has_no_data(); - vi->set_is_equal_data_in_face(equal_data); - vi->set_has_equal_data_in_face(equal_data); + bool equal_data = !vi->face()->has_no_env_data(); + vi->set_is_equal_env_data_in_face(equal_data); + vi->set_has_equal_env_data_in_face(equal_data); } } } @@ -409,9 +405,9 @@ public: Halfedge_handle hh = ei; // there must be data from at least one map, because all the surfaces // are continuous - if (!get_aux_is_set(hh, 0) || !get_aux_is_set(hh, 1)) continue; - CGAL_assertion(get_aux_is_set(hh, 0)); - CGAL_assertion(get_aux_is_set(hh, 1)); + if (! aux_is_set(hh, 0) || !aux_is_set(hh, 1)) continue; + CGAL_assertion(aux_is_set(hh, 0)); + CGAL_assertion(aux_is_set(hh, 1)); CGAL_assertion(!aux_has_no_data(hh, 1) || !aux_has_no_data(hh, 0)); if (aux_has_no_data(hh, 0) && !aux_has_no_data(hh, 1)) { hh->set_decision(DAC_DECISION_SECOND); @@ -426,12 +422,12 @@ public: bool should_resolve = true; #ifdef CGAL_ENVELOPE_SAVE_COMPARISONS - if (hh->get_has_equal_aux_data_in_face(0) && - hh->get_has_equal_aux_data_in_face(1)) + if (hh->has_equal_aux_data_in_face(0) && + hh->has_equal_aux_data_in_face(1)) should_resolve = false; - if (hh->twin()->get_has_equal_aux_data_in_face(0) && - hh->twin()->get_has_equal_aux_data_in_face(1)) + if (hh->twin()->has_equal_aux_data_in_face(0) && + hh->twin()->has_equal_aux_data_in_face(1)) should_resolve = false; #endif @@ -442,7 +438,7 @@ public: } // now deal with the edges for (auto li = edges_to_resolve.begin(); li != edges_to_resolve.end(); ++li) - resolver->resolve(*li, result); + m_resolver->resolve(*li, result); edges_to_resolve.clear(); // decompose the result, to have faces without holes @@ -480,39 +476,36 @@ public: // traverse the faces in arbitrary order for (auto fi = result.faces_begin(); fi != result.faces_end(); ++fi) { Face_handle fh = fi; - // if a surface of one map doesn't exist, then we set the second surface - if (aux_has_no_data(fh, 0) && !aux_has_no_data(fh, 1)) { - fh->set_decision(DAC_DECISION_SECOND); - continue; - } - else if (aux_has_no_data(fh, 0) && aux_has_no_data(fh, 1)) { - fh->set_decision(EQUAL); - fh->set_no_data(); - - continue; - } - else if (!aux_has_no_data(fh, 0) && aux_has_no_data(fh, 1)) { - fh->set_decision(DAC_DECISION_FIRST); - continue; - } - - // here, we have both surfaces. - // we save the face in a list for a later treatment, because the - // face can change and destroy the iterator - faces_to_split.push_back(fh); + // if a surface of one map doesn't exist, then we set the second surface + if (aux_has_no_data(fh, 0) && !aux_has_no_data(fh, 1)) { + fh->set_decision(DAC_DECISION_SECOND); + continue; } + else if (aux_has_no_data(fh, 0) && aux_has_no_data(fh, 1)) { + fh->set_decision(EQUAL); + fh->set_no_env_data(); + continue; + } + else if (!aux_has_no_data(fh, 0) && aux_has_no_data(fh, 1)) { + fh->set_decision(DAC_DECISION_FIRST); + continue; + } + + // here, we have both surfaces. + // we save the face in a list for a later treatment, because the + // face can change and destroy the iterator + faces_to_split.push_back(fh); + } #endif deal_with_faces_to_split(faces_to_split, result); -// #ifndef CGAL_ENVELOPE_SAVE_COMPARISONS -// hi = result.halfedges_begin(); -// for (; hi != result.halfedges_end(); ++hi, ++hi) -// { -// if (!hi->is_decision_set()) -// resolver->resolve(hi, result); -// } -// #endif + // #ifndef CGAL_ENVELOPE_SAVE_COMPARISONS + // hi = result.halfedges_begin(); + // for (; hi != result.halfedges_end(); ++hi, ++hi) { + // if (!hi->is_decision_set()) m_resolver->resolve(hi, result); + // } + // #endif // detach the edge_observer from result, since no need for it anymore edge_observer.detach(); @@ -520,12 +513,11 @@ public: // compute the surface on the envelope for each vertex for (auto vi = result.vertices_begin(); vi != result.vertices_end(); ++vi) { Vertex_handle vh = vi; - if (vh->is_decision_set()) - continue; + if (vh->is_decision_set()) continue; // there must be data from at least one map, because all the surfaces // are continuous - CGAL_assertion(get_aux_is_set(vh, 0)); - CGAL_assertion(get_aux_is_set(vh, 1)); + CGAL_assertion(aux_is_set(vh, 0)); + CGAL_assertion(aux_is_set(vh, 1)); CGAL_assertion(!aux_has_no_data(vh, 1) || !aux_has_no_data(vh, 0)); if (aux_has_no_data(vh, 0) && !aux_has_no_data(vh, 1)) { vh->set_decision(DAC_DECISION_SECOND); @@ -535,8 +527,7 @@ public: vh->set_decision(DAC_DECISION_FIRST); continue; } - resolver->resolve(vh); - + m_resolver->resolve(vh); } CGAL_expensive_assertion_msg(result.is_valid(), @@ -562,7 +553,7 @@ public: CGAL_expensive_assertion_msg(result.is_valid(), "after remove vertices result is not valid"); - // update is_equal_data and has_equal_data of halfedge->face and + // update is_equal_env_data and has_equal_env_data of halfedge->face and // vertex->face relations, according to the decision, and the aux // similar flags update_flags(result); @@ -577,21 +568,21 @@ public: "after merge result is not valid"); } - protected: - void deal_with_faces_to_split(std::list& faces_to_split, Minimization_diagram_2& result) { // for each face in faces_to_split, find the intersection over the face, // and split the face for (auto li = faces_to_split.begin(); li != faces_to_split.end(); ++li) - resolver->resolve(*li, result); + m_resolver->resolve(*li, result); faces_to_split.clear(); } template - bool is_equal_data(const InputIterator& begin1, const InputIterator& end1, - const InputIterator& begin2, const InputIterator& end2) { + bool is_equal_env_data(const InputIterator& begin1, + const InputIterator& end1, + const InputIterator& begin2, + const InputIterator& end2) { // insert the input data objects into a set std::set first(begin1, end1); std::set second(begin2, end2); @@ -603,10 +594,10 @@ protected: // todo: should remove the uses of this method from this class template - bool has_equal_data(const InputIterator& begin1, - const InputIterator& end1, - const InputIterator& begin2, - const InputIterator& end2) { + bool has_equal_env_data(const InputIterator& begin1, + const InputIterator& end1, + const InputIterator& begin2, + const InputIterator& end2) { // insert the input data objects into a set std::set first(begin1, end1); std::set second(begin2, end2); @@ -623,9 +614,9 @@ protected: bool has_equal_aux_data(unsigned int id, FeatureHandle1 fh1, FeatureHandle2 fh2) { Envelope_data_iterator begin1, end1, begin2, end2; - get_aux_data_iterators(id, fh1, begin1, end1); - get_aux_data_iterators(id, fh2, begin2, end2); - bool has_eq = has_equal_data(begin1, end1, begin2, end2); + aux_data_iterators(id, fh1, begin1, end1); + aux_data_iterators(id, fh2, begin2, end2); + bool has_eq = has_equal_env_data(begin1, end1, begin2, end2); return has_eq; } @@ -641,7 +632,7 @@ protected: if (can_remove_edge(hh)) edges.push_back(hh); } - for (auto ci = edges.begin(); ci != edges.end(); ++ci) { + for (auto ci = edges.begin(); ci != edges.end(); ++ci) { // if the endpoints become isolated after the removal we need to remove // them if they have the same data as the edge Halfedge_handle h = *ci; @@ -650,20 +641,20 @@ protected: CGAL_assertion_code(Face_handle h_face = h->face()); bool remove_src = can_remove_edge_target(h->twin()); bool remove_trg = can_remove_edge_target(h); - bool src_is_equal_0 = (h->twin()->get_is_equal_aux_data_in_face(0) && - h->twin()->get_is_equal_aux_data_in_target(0)); - bool src_is_equal_1 = (h->twin()->get_is_equal_aux_data_in_face(1) && - h->twin()->get_is_equal_aux_data_in_target(1)); - bool trg_is_equal_0 = (h->get_is_equal_aux_data_in_face(0) && - h->get_is_equal_aux_data_in_target(0)); - bool trg_is_equal_1 = (h->get_is_equal_aux_data_in_face(1) && - h->get_is_equal_aux_data_in_target(1)); + bool src_is_equal_0 = (h->twin()->is_equal_aux_data_in_face(0) && + h->twin()->is_equal_aux_data_in_target(0)); + bool src_is_equal_1 = (h->twin()->is_equal_aux_data_in_face(1) && + h->twin()->is_equal_aux_data_in_target(1)); + bool trg_is_equal_0 = (h->is_equal_aux_data_in_face(0) && + h->is_equal_aux_data_in_target(0)); + bool trg_is_equal_1 = (h->is_equal_aux_data_in_face(1) && + h->is_equal_aux_data_in_target(1)); bool src_has_equal_0 = - h->twin()->get_has_equal_aux_data_in_target_and_face(0); + h->twin()->has_equal_aux_data_in_target_and_face(0); bool src_has_equal_1 = - h->twin()->get_has_equal_aux_data_in_target_and_face(1); - bool trg_has_equal_0 = h->get_has_equal_aux_data_in_target_and_face(0); - bool trg_has_equal_1 = h->get_has_equal_aux_data_in_target_and_face(1); + h->twin()->has_equal_aux_data_in_target_and_face(1); + bool trg_has_equal_0 = h->has_equal_aux_data_in_target_and_face(0); + bool trg_has_equal_1 = h->has_equal_aux_data_in_target_and_face(1); /* A vertex at an open boundary is removed once it becomes redundant * regardless of the boolean values passed as the 2nd and 3rd argument @@ -690,8 +681,7 @@ protected: src->set_has_equal_aux_data_in_face(0, src_has_equal_0); src->set_has_equal_aux_data_in_face(1, src_has_equal_1); } - if (!remove_trg && trg->is_isolated()) - { + if (! remove_trg && trg->is_isolated()) { trg->set_is_equal_aux_data_in_face(0, trg_is_equal_0); trg->set_is_equal_aux_data_in_face(1, trg_is_equal_1); // make sure h_face is also trg face @@ -707,15 +697,15 @@ protected: } template - void get_aux_data_iterators(unsigned int id, FeatureHandle fh, - Envelope_data_iterator& begin, - Envelope_data_iterator& end) { + void aux_data_iterators(unsigned int id, FeatureHandle fh, + Envelope_data_iterator& begin, + Envelope_data_iterator& end) { Halfedge_handle h; Vertex_handle v; Face_handle f; - const Object& o = fh->get_aux_source(id); - CGAL_assertion(!o.is_empty()); + const Object& o = fh->aux_source(id); + CGAL_assertion(! o.is_empty()); // aux source of a face must be a face! // aux source of a halfedge can be face or halfedge @@ -725,19 +715,19 @@ protected: // and last vertex if (assign(f, o)) { - begin = f->begin_data(); - end = f->end_data(); + begin = f->begin_env_data(); + end = f->end_env_data(); } else if (assign(h, o)) { - begin = h->begin_data(); - end = h->end_data(); + begin = h->begin_env_data(); + end = h->end_env_data(); } else { CGAL_assertion_code(bool b = ) assign(v, o); CGAL_assertion(b); - begin = v->begin_data(); - end = v->end_data(); + begin = v->begin_env_data(); + end = v->end_env_data(); } } @@ -752,18 +742,18 @@ protected: // done on the faces. if not, then the envelope surfaces must differ CGAL_assertion(hh->is_decision_set() && f1->is_decision_set() && f2->is_decision_set()); - if (hh->get_decision() != f1->get_decision() || - hh->get_decision() != f2->get_decision()) + if (hh->decision() != f1->decision() || + hh->decision() != f2->decision()) { return false; } // now, check the equality of the surfaces list according to the decision - CGAL::Dac_decision decision = hh->get_decision(); - bool equal_first = (hh->get_is_equal_aux_data_in_face(0) && - hh->twin()->get_is_equal_aux_data_in_face(0)); - bool equal_second = (hh->get_is_equal_aux_data_in_face(1) && - hh->twin()->get_is_equal_aux_data_in_face(1)); + CGAL::Dac_decision decision = hh->decision(); + bool equal_first = (hh->is_equal_aux_data_in_face(0) && + hh->twin()->is_equal_aux_data_in_face(0)); + bool equal_second = (hh->is_equal_aux_data_in_face(1) && + hh->twin()->is_equal_aux_data_in_face(1)); if (decision == DAC_DECISION_FIRST) return equal_first; @@ -792,10 +782,10 @@ protected: Vertex_handle v = h->target(); if (v->is_at_open_boundary()) return false; - /* if (v->get_is_fake() && !v->is_decision_set()) return true; - * if (h->get_is_fake() && !h->is_decision_set()) { - * h->set_decision(h->face()->get_decision()); - * h->twin()->set_decision(h->get_decision()); + /* if (v->is_fake() && !v->is_decision_set()) return true; + * if (h->is_fake() && !h->is_decision_set()) { + * h->set_decision(h->face()->decision()); + * h->twin()->set_decision(h->decision()); * } */ CGAL_assertion(v->is_decision_set()); @@ -803,13 +793,13 @@ protected: // if the decision done on the vertex and edge are different, // the envelope differs too. - if (h->get_decision() != v->get_decision()) return false; + if (h->decision() != v->decision()) return false; // now, check the equality of the surfaces list according to the decision - CGAL::Dac_decision decision = h->get_decision(); - bool equal_first = (h->get_is_equal_aux_data_in_target(0)); - bool equal_second = (h->get_is_equal_aux_data_in_target(1)); + CGAL::Dac_decision decision = h->decision(); + bool equal_first = (h->is_equal_aux_data_in_target(0)); + bool equal_second = (h->is_equal_aux_data_in_target(1)); if (decision == DAC_DECISION_FIRST) return equal_first; @@ -826,13 +816,13 @@ protected: CGAL_assertion(vh->is_decision_set() && f->is_decision_set()); // if the decision done on the vertex and face are different, // the envelope differs too. - if (vh->get_decision() != f->get_decision()) return false; + if (vh->decision() != f->decision()) return false; // now, check the equality of the surfaces list according to the decision - CGAL::Dac_decision decision = vh->get_decision(); + CGAL::Dac_decision decision = vh->decision(); - bool equal_first = (vh->get_is_equal_aux_data_in_face(0)); - bool equal_second = (vh->get_is_equal_aux_data_in_face(1)); + bool equal_first = (vh->is_equal_aux_data_in_face(0)); + bool equal_second = (vh->is_equal_aux_data_in_face(1)); if (decision == DAC_DECISION_FIRST) return equal_first; @@ -853,8 +843,8 @@ protected: CGAL_assertion(he1 != he2); CGAL_assertion(he1->is_decision_set() && he2->is_decision_set()); - /* if (vh->get_is_fake()) { - * CGAL_assertion(he1->get_decision() == he2->get_decision()); + /* if (vh->is_fake()) { + * CGAL_assertion(he1->decision() == he2->decision()); * return true; * } */ @@ -863,16 +853,16 @@ protected: // if the decision done on the vertex and its incident halfedges are // different, the envelope differs too. CGAL_assertion(vh == he1->target() && vh == he2->target()); - if (vh->get_decision() != he1->get_decision() || - vh->get_decision() != he2->get_decision()) + if (vh->decision() != he1->decision() || + vh->decision() != he2->decision()) return false; // now, check the equality of the surfaces list according to the decision - CGAL::Dac_decision decision = vh->get_decision(); - bool equal_first = (he1->get_is_equal_aux_data_in_target(0) && - he2->get_is_equal_aux_data_in_target(0)); - bool equal_second = (he1->get_is_equal_aux_data_in_target(1) && - he2->get_is_equal_aux_data_in_target(1)); + CGAL::Dac_decision decision = vh->decision(); + bool equal_first = (he1->is_equal_aux_data_in_target(0) && + he2->is_equal_aux_data_in_target(0)); + bool equal_second = (he1->is_equal_aux_data_in_target(1) && + he2->is_equal_aux_data_in_target(1)); if (decision == DAC_DECISION_FIRST) return equal_first; @@ -949,30 +939,30 @@ protected: // <----------- ------------> // he1->twin() he2->twin() he1->set_is_equal_aux_data_in_target - (0, he2->twin()->get_is_equal_aux_data_in_target(0)); + (0, he2->twin()->is_equal_aux_data_in_target(0)); he1->set_is_equal_aux_data_in_target - (1, he2->twin()->get_is_equal_aux_data_in_target(1)); + (1, he2->twin()->is_equal_aux_data_in_target(1)); he1->set_has_equal_aux_data_in_target - (0, he2->twin()->get_has_equal_aux_data_in_target(0)); + (0, he2->twin()->has_equal_aux_data_in_target(0)); he1->set_has_equal_aux_data_in_target - (1, he2->twin()->get_has_equal_aux_data_in_target(1)); + (1, he2->twin()->has_equal_aux_data_in_target(1)); he1->set_has_equal_aux_data_in_target_and_face - (0, he2->twin()->get_has_equal_aux_data_in_target_and_face(0)); + (0, he2->twin()->has_equal_aux_data_in_target_and_face(0)); he1->set_has_equal_aux_data_in_target_and_face - (1, he2->twin()->get_has_equal_aux_data_in_target_and_face(1)); + (1, he2->twin()->has_equal_aux_data_in_target_and_face(1)); he2->set_is_equal_aux_data_in_target - (0, he1->twin()->get_is_equal_aux_data_in_target(0)); + (0, he1->twin()->is_equal_aux_data_in_target(0)); he2->set_is_equal_aux_data_in_target - (1, he1->twin()->get_is_equal_aux_data_in_target(1)); + (1, he1->twin()->is_equal_aux_data_in_target(1)); he2->set_has_equal_aux_data_in_target - (0, he1->twin()->get_has_equal_aux_data_in_target(0)); + (0, he1->twin()->has_equal_aux_data_in_target(0)); he2->set_has_equal_aux_data_in_target - (1, he1->twin()->get_has_equal_aux_data_in_target(1)); + (1, he1->twin()->has_equal_aux_data_in_target(1)); he2->set_has_equal_aux_data_in_target_and_face - (0, he1->twin()->get_has_equal_aux_data_in_target_and_face(0)); + (0, he1->twin()->has_equal_aux_data_in_target_and_face(0)); he2->set_has_equal_aux_data_in_target_and_face - (1, he1->twin()->get_has_equal_aux_data_in_target_and_face(1)); + (1, he1->twin()->has_equal_aux_data_in_target_and_face(1)); // order of halfedges for merge doesn't matter #if !defined(CGAL_NO_ASSERTIONS) @@ -1000,7 +990,7 @@ protected: template void update_envelope_surfaces_by_decision(FeatureHandle fh) { - CGAL::Dac_decision decision = fh->get_decision(); + CGAL::Dac_decision decision = fh->decision(); Halfedge_handle h; Vertex_handle v; @@ -1008,16 +998,16 @@ protected: if (decision == DAC_DECISION_FIRST || decision == DAC_DECISION_BOTH) { Envelope_data_iterator begin, end; - get_aux_data_iterators(0, fh, begin, end); + aux_data_iterators(0, fh, begin, end); fh->set_env_data(begin, end); } if (decision == DAC_DECISION_SECOND || decision == DAC_DECISION_BOTH) { // copy data from second envelope Envelope_data_iterator begin, end; - get_aux_data_iterators(1, fh, begin, end); + aux_data_iterators(1, fh, begin, end); if (decision == DAC_DECISION_SECOND) fh->set_env_data(begin, end); - else fh->add_data(begin, end); + else fh->add_env_data(begin, end); } } @@ -1040,19 +1030,19 @@ protected: // update the is_equal/has_equal flags of the result envelope void update_edge_face_flags(Halfedge_handle h) { bool is_equal, has_equal; - is_equal = (h->get_decision() == h->face()->get_decision()); + is_equal = (h->decision() == h->face()->decision()); // has equal can be true even if the decision is not the same, // but has same surfaces, i.e. one of the features got DAC_DECISION_BOTH // decision, and the other didn't - has_equal = (h->get_decision() == h->face()->get_decision() || - h->get_decision() == DAC_DECISION_BOTH || - h->face()->get_decision() == DAC_DECISION_BOTH); + has_equal = (h->decision() == h->face()->decision() || + h->decision() == DAC_DECISION_BOTH || + h->face()->decision() == DAC_DECISION_BOTH); - CGAL::Dac_decision decision = h->face()->get_decision(); - bool is_equal_first = (h->get_is_equal_aux_data_in_face(0)); - bool has_equal_first = (h->get_has_equal_aux_data_in_face(0)); - bool is_equal_second = (h->get_is_equal_aux_data_in_face(1)); - bool has_equal_second = (h->get_has_equal_aux_data_in_face(1)); + CGAL::Dac_decision decision = h->face()->decision(); + bool is_equal_first = (h->is_equal_aux_data_in_face(0)); + bool has_equal_first = (h->has_equal_aux_data_in_face(0)); + bool is_equal_second = (h->is_equal_aux_data_in_face(1)); + bool has_equal_second = (h->has_equal_aux_data_in_face(1)); if (decision == DAC_DECISION_FIRST) { is_equal &= is_equal_first; has_equal &= has_equal_first; @@ -1066,32 +1056,32 @@ protected: // we check if the halfedge has a different decision, and if so, // we update the flag according to the halfedge decision - decision = h->get_decision(); + decision = h->decision(); if (decision == DAC_DECISION_FIRST) has_equal &= has_equal_first; else if (decision == DAC_DECISION_SECOND) has_equal &= has_equal_second; else has_equal &= (has_equal_first & has_equal_second); } - h->set_is_equal_data_in_face(is_equal); - h->set_has_equal_data_in_face(has_equal); + h->set_is_equal_env_data_in_face(is_equal); + h->set_has_equal_env_data_in_face(has_equal); } void update_edge_target_flags(Halfedge_handle h) { bool is_equal, has_equal; - is_equal = (h->get_decision() == h->target()->get_decision()); + is_equal = (h->decision() == h->target()->decision()); // has equal can be true even if the decision is not the same, // but has same surfaces, i.e. one of the features got DAC_DECISION_BOTH // decision, and the other didn't - has_equal = (h->get_decision() == h->target()->get_decision() || - h->get_decision() == DAC_DECISION_BOTH || - h->target()->get_decision() == DAC_DECISION_BOTH); + has_equal = (h->decision() == h->target()->decision() || + h->decision() == DAC_DECISION_BOTH || + h->target()->decision() == DAC_DECISION_BOTH); - CGAL::Dac_decision decision = h->get_decision(); - bool is_equal_first = (h->get_is_equal_aux_data_in_target(0)); - bool has_equal_first = (h->get_has_equal_aux_data_in_target(0)); - bool is_equal_second = (h->get_is_equal_aux_data_in_target(1)); - bool has_equal_second = (h->get_has_equal_aux_data_in_target(1)); + CGAL::Dac_decision decision = h->decision(); + bool is_equal_first = (h->is_equal_aux_data_in_target(0)); + bool has_equal_first = (h->has_equal_aux_data_in_target(0)); + bool is_equal_second = (h->is_equal_aux_data_in_target(1)); + bool has_equal_second = (h->has_equal_aux_data_in_target(1)); if (decision == DAC_DECISION_FIRST) { is_equal &= is_equal_first; has_equal &= has_equal_first; @@ -1104,7 +1094,7 @@ protected: is_equal &= (is_equal_first & is_equal_second); // we check if the vertex has a different decision, and if so, // we update the flag according to the vertex decision - decision = h->target()->get_decision(); + decision = h->target()->decision(); if (decision == DAC_DECISION_FIRST) has_equal &= has_equal_first; else if (decision == DAC_DECISION_SECOND) @@ -1113,8 +1103,8 @@ protected: else has_equal &= (has_equal_first & has_equal_second); } - h->set_is_equal_data_in_target(is_equal); - h->set_has_equal_data_in_target(has_equal); + h->set_is_equal_env_data_in_target(is_equal); + h->set_has_equal_env_data_in_target(has_equal); } void update_target_face_flags(Halfedge_handle h) { @@ -1122,42 +1112,42 @@ protected: // has equal can be true even if the decision is not the same, // but has same surfaces, i.e. one of the features got DAC_DECISION_BOTH // decision, and the other didn't - has_equal = (h->face()->get_decision() == h->target()->get_decision() || - h->face()->get_decision() == DAC_DECISION_BOTH || - h->target()->get_decision() == DAC_DECISION_BOTH); + has_equal = (h->face()->decision() == h->target()->decision() || + h->face()->decision() == DAC_DECISION_BOTH || + h->target()->decision() == DAC_DECISION_BOTH); - CGAL::Dac_decision decision = h->face()->get_decision(); - bool has_equal_first = (h->get_has_equal_aux_data_in_target_and_face(0)); - bool has_equal_second = (h->get_has_equal_aux_data_in_target_and_face(1)); + CGAL::Dac_decision decision = h->face()->decision(); + bool has_equal_first = (h->has_equal_aux_data_in_target_and_face(0)); + bool has_equal_second = (h->has_equal_aux_data_in_target_and_face(1)); if (decision == DAC_DECISION_FIRST) has_equal &= has_equal_first; else if (decision == DAC_DECISION_SECOND) has_equal &= has_equal_second; else { // we check if the vertex has a different decision, and if so, // we update the flag according to the vertex decision - decision = h->target()->get_decision(); + decision = h->target()->decision(); if (decision == DAC_DECISION_FIRST) has_equal &= has_equal_first; else if (decision == DAC_DECISION_SECOND) has_equal &= has_equal_second; else has_equal &= (has_equal_first & has_equal_second); } - h->set_has_equal_data_in_target_and_face(has_equal); + h->set_has_equal_env_data_in_target_and_face(has_equal); } void update_vertex_face_flags(Vertex_handle v, Face_handle f) { bool is_equal, has_equal; - is_equal = (v->get_decision() == f->get_decision()); + is_equal = (v->decision() == f->decision()); // has equal can be true even if the decision is not the same, // but has same surfaces, i.e. one of the features got DAC_DECISION_BOTH // decision, and the other didn't - has_equal = (v->get_decision() == f->get_decision() || - v->get_decision() == DAC_DECISION_BOTH || - f->get_decision() == DAC_DECISION_BOTH); + has_equal = (v->decision() == f->decision() || + v->decision() == DAC_DECISION_BOTH || + f->decision() == DAC_DECISION_BOTH); - CGAL::Dac_decision decision = v->get_decision(); - bool is_equal_first = (v->get_is_equal_aux_data_in_face(0)); - bool has_equal_first = (v->get_has_equal_aux_data_in_face(0)); - bool is_equal_second = (v->get_is_equal_aux_data_in_face(1)); - bool has_equal_second = (v->get_has_equal_aux_data_in_face(1)); + CGAL::Dac_decision decision = v->decision(); + bool is_equal_first = (v->is_equal_aux_data_in_face(0)); + bool has_equal_first = (v->has_equal_aux_data_in_face(0)); + bool is_equal_second = (v->is_equal_aux_data_in_face(1)); + bool has_equal_second = (v->has_equal_aux_data_in_face(1)); if (decision == DAC_DECISION_FIRST) { is_equal &= is_equal_first; has_equal &= has_equal_first; @@ -1170,7 +1160,7 @@ protected: is_equal &= (is_equal_first & is_equal_second); // we check if the face has a different decision, and if so, // we update the flag according to the face decision - decision = f->get_decision(); + decision = f->decision(); if (decision == DAC_DECISION_FIRST) has_equal &= has_equal_first; else if (decision == DAC_DECISION_SECOND) @@ -1178,8 +1168,8 @@ protected: else has_equal &= (has_equal_first & has_equal_second); } - v->set_is_equal_data_in_face(is_equal); - v->set_has_equal_data_in_face(has_equal); + v->set_is_equal_env_data_in_face(is_equal); + v->set_has_equal_env_data_in_face(has_equal); } void update_flags(Minimization_diagram_2& result) { @@ -1197,12 +1187,12 @@ protected: } template - bool get_aux_is_set(FeatureHandle fh, unsigned int id) - { return fh->get_aux_is_set(id); } + bool aux_is_set(FeatureHandle fh, unsigned int id) + { return fh->aux_is_set(id); } template bool aux_has_no_data(FeatureHandle fh, unsigned int id) { - const Object& o = fh->get_aux_source(id); + const Object& o = fh->aux_source(id); Halfedge_handle h; Vertex_handle v; Face_handle f; @@ -1212,13 +1202,13 @@ protected: // aux source of a vertex can be face, halfedge or vertex // this is why we start with a check for a face, then halfedge // and last vertex - if (assign(f, o)) return f->has_no_data(); - else if (assign(h, o)) return h->has_no_data(); + if (assign(f, o)) return f->has_no_env_data(); + else if (assign(h, o)) return h->has_no_env_data(); else { CGAL_assertion_code(bool b =) assign(v, o); CGAL_assertion(b); - return v->has_no_data(); + return v->has_no_env_data(); } } @@ -1228,7 +1218,7 @@ protected: // methods for assertion and checking //*************************************************************************** - void get_data_iterators(Object aux_src, + void env_data_iterators(Object aux_src, Envelope_data_iterator& begin, Envelope_data_iterator& end) { CGAL_assertion(!aux_src.is_empty()); @@ -1237,49 +1227,51 @@ protected: Face_handle f; if (assign(v, aux_src)) { - begin = v->begin_data(); - end = v->end_data(); + begin = v->begin_env_data(); + end = v->end_env_data(); } else if (assign(h, aux_src)) { - begin = h->begin_data(); - end = h->end_data(); + begin = h->begin_env_data(); + end = h->end_env_data(); } else { CGAL_assertion(assign(f, aux_src)); assign(f, aux_src); - begin = f->begin_data(); - end = f->end_data(); + begin = f->begin_env_data(); + end = f->end_env_data(); } } - bool is_equal_data(Object o, - Envelope_data_iterator begin, Envelope_data_iterator end) { + + bool is_equal_env_data(Object o, + Envelope_data_iterator begin, + Envelope_data_iterator end) { + CGAL_assertion(! o.is_empty()); + Vertex_handle v; + Halfedge_handle h; + Face_handle f; + + if (assign(v, o)) return v->is_equal_env_data(begin, end); + else if (assign(h, o)) return h->is_equal_env_data(begin, end); + else { + CGAL_assertion(assign(f, o)); + assign(f, o); + return f->is_equal_env_data(begin, end); + } + } + bool has_equal_env_data(Object o, + Envelope_data_iterator begin, + Envelope_data_iterator end) { CGAL_assertion(!o.is_empty()); Vertex_handle v; Halfedge_handle h; Face_handle f; - if (assign(v, o)) return v->is_equal_data(begin, end); - else if (assign(h, o)) return h->is_equal_data(begin, end); + if (assign(v, o)) return v->has_equal_env_data(begin, end); + else if (assign(h, o)) return h->has_equal_env_data(begin, end); else { CGAL_assertion(assign(f, o)); assign(f, o); - return f->is_equal_data(begin, end); - } - } - bool has_equal_data(Object o, - Envelope_data_iterator begin, - Envelope_data_iterator end) { - CGAL_assertion(!o.is_empty()); - Vertex_handle v; - Halfedge_handle h; - Face_handle f; - - if (assign(v, o)) return v->has_equal_data(begin, end); - else if (assign(h, o)) return h->has_equal_data(begin, end); - else { - CGAL_assertion(assign(f, o)); - assign(f, o); - return f->has_equal_data(begin, end); + return f->has_equal_env_data(begin, end); } } @@ -1295,9 +1287,8 @@ protected: for (auto inner_iter = fh->holes_begin(); inner_iter != fh->holes_end(); ++inner_iter) { face_hec = face_hec_begin = (*inner_iter); - do { - ++face_hec; - } while(face_hec != face_hec_begin); + do ++face_hec; + while(face_hec != face_hec_begin); } } } @@ -1309,10 +1300,10 @@ protected: bool all_ok = true; for (auto vi = result.vertices_begin(); vi != result.vertices_end(); ++vi) { Vertex_handle vh = vi; - // if (vh->get_is_fake()) continue; - all_ok &= (vh->get_aux_is_set(0)); + // if (vh->is_fake()) continue; + all_ok &= (vh->aux_is_set(0)); CGAL_assertion_msg(all_ok, "aux source (0) not set over vertex"); - all_ok &= (vh->get_aux_is_set(1)); + all_ok &= (vh->aux_is_set(1)); CGAL_assertion_msg(all_ok, "aux source (1) not set over vertex"); all_ok &= (vh->is_decision_set()); CGAL_assertion_msg(all_ok, "decision was not set over vertex"); @@ -1321,13 +1312,11 @@ protected: for (auto hi = result.halfedges_begin(); hi != result.halfedges_end(); ++hi) { Halfedge_handle hh = hi; - /* if (hh->get_is_fake()) - * continue; - */ + // if (hh->is_fake()) continue; - all_ok &= (hh->get_aux_is_set(0)); + all_ok &= (hh->aux_is_set(0)); CGAL_assertion_msg(all_ok, "aux source (0) not set over edge"); - all_ok &= (hh->get_aux_is_set(1)); + all_ok &= (hh->aux_is_set(1)); CGAL_assertion_msg(all_ok, "aux source (1) not set over edge"); all_ok &= (hh->is_decision_set()); CGAL_assertion_msg(all_ok, "decision was not set over edge"); @@ -1335,9 +1324,9 @@ protected: for (auto fi = result.faces_begin(); fi != result.faces_end(); ++fi) { Face_handle fh = fi; - all_ok &= (fh->get_aux_is_set(0)); + all_ok &= (fh->aux_is_set(0)); CGAL_assertion_msg(all_ok, "aux source (0) not set over face"); - all_ok &= (fh->get_aux_is_set(1)); + all_ok &= (fh->aux_is_set(1)); CGAL_assertion_msg(all_ok, "aux source (1) not set over face"); all_ok &= (fh->is_decision_set()); CGAL_assertion_msg(all_ok, "decision was not set over face"); @@ -1352,12 +1341,12 @@ protected: for (auto vi = result.vertices_begin(); vi != result.vertices_end(); ++vi) { Vertex_handle vh = vi; - all_ok &= (vh->get_is_set()); + all_ok &= (vh->env_is_set()); CGAL_assertion_msg(all_ok, "data not set over vertex"); - all_ok &= (!vh->has_no_data()); + all_ok &= (!vh->has_no_env_data()); CGAL_assertion_msg(all_ok, "data empty over vertex"); - /* all_ok &= (!vh->get_is_fake());*/ + /* all_ok &= (!vh->is_fake());*/ CGAL_assertion_msg(all_ok, "fake vertex in envelope"); } @@ -1365,20 +1354,20 @@ protected: { Halfedge_handle hh = hi; - all_ok &= (hh->get_is_set()); + all_ok &= (hh->env_is_set()); if (!all_ok) std::cerr << "edge: " << hh->curve() << std::endl; CGAL_assertion_msg(all_ok, "data not set over edge"); - all_ok &= (!hh->has_no_data()); + all_ok &= (!hh->has_no_env_data()); if (!all_ok) std::cerr << "edge: " << hh->curve() << std::endl; CGAL_assertion_msg(all_ok, "data empty over edge"); - /*all_ok &= (!hh->get_is_fake());*/ + /*all_ok &= (!hh->is_fake());*/ CGAL_assertion_msg(all_ok, "fake edge in envelope"); } for (auto fi = result.faces_begin(); fi != result.faces_end(); ++fi) { Face_handle fh = fi; - all_ok &= (fh->get_is_set()); + all_ok &= (fh->env_is_set()); CGAL_assertion_msg(all_ok, "data not set over face"); } return all_ok; @@ -1397,12 +1386,12 @@ protected: Face_handle new_f, bool /* is_hole*/) override { // update data in the new face from the original face - if (org_f->get_aux_is_set(0)) - new_f->set_aux_source(0, org_f->get_aux_source(0)); - if (org_f->get_aux_is_set(1)) - new_f->set_aux_source(1, org_f->get_aux_source(1)); + if (org_f->aux_is_set(0)) + new_f->set_aux_source(0, org_f->aux_source(0)); + if (org_f->aux_is_set(1)) + new_f->set_aux_source(1, org_f->aux_source(1)); if (org_f->is_decision_set()) - new_f->set_decision(org_f->get_decision()); + new_f->set_decision(org_f->decision()); } }; @@ -1438,97 +1427,95 @@ protected: CGAL_assertion(he2->source() == he1->target()); Vertex_handle new_vertex; -// if (he2->source() == he1->target() || -// he2->source() == he1->source()) + // if (he2->source() == he1->target() || he2->source() == he1->source()) new_vertex = he2->source(); -// else -// new_vertex = he2->target(); + // else new_vertex = he2->target(); CGAL_assertion(!new_vertex->is_decision_set()); - CGAL_assertion(!new_vertex->get_aux_is_set(0)); - CGAL_assertion(!new_vertex->get_aux_is_set(1)); + CGAL_assertion(!new_vertex->aux_is_set(0)); + CGAL_assertion(!new_vertex->aux_is_set(1)); // find the halfedge with the additional information, to be copied into // the second halfedge Halfedge_handle org_he = he1, new_he = he2; if (org_he->is_decision_set()) { - new_he->set_decision(org_he->get_decision()); - new_he->twin()->set_decision(org_he->get_decision()); - new_vertex->set_decision(org_he->get_decision()); + new_he->set_decision(org_he->decision()); + new_he->twin()->set_decision(org_he->decision()); + new_vertex->set_decision(org_he->decision()); } - if (org_he->get_aux_is_set(0)) { - new_vertex->set_aux_source(0, org_he->get_aux_source(0)); - new_he->set_aux_source(0, org_he->get_aux_source(0)); - new_he->twin()->set_aux_source(0, org_he->twin()->get_aux_source(0)); + if (org_he->aux_is_set(0)) { + new_vertex->set_aux_source(0, org_he->aux_source(0)); + new_he->set_aux_source(0, org_he->aux_source(0)); + new_he->twin()->set_aux_source(0, org_he->twin()->aux_source(0)); } - if (org_he->get_aux_is_set(1)) { - new_vertex->set_aux_source(1, org_he->get_aux_source(1)); - new_he->set_aux_source(1, org_he->get_aux_source(1)); - new_he->twin()->set_aux_source(1, org_he->twin()->get_aux_source(1)); + if (org_he->aux_is_set(1)) { + new_vertex->set_aux_source(1, org_he->aux_source(1)); + new_he->set_aux_source(1, org_he->aux_source(1)); + new_he->twin()->set_aux_source(1, org_he->twin()->aux_source(1)); } - /*new_he->set_is_fake(org_he->get_is_fake());*/ - /*new_he->twin()->set_is_fake(org_he->get_is_fake());*/ - /*new_vertex->set_is_fake(org_he->get_is_fake());*/ + // new_he->set_is_fake(org_he->is_fake()); + // new_he->twin()->set_is_fake(org_he->is_fake()); + // new_vertex->set_is_fake(org_he->is_fake()); // update all new bools new_he->set_is_equal_aux_data_in_face - (0, org_he->get_is_equal_aux_data_in_face(0)); + (0, org_he->is_equal_aux_data_in_face(0)); new_he->twin()->set_is_equal_aux_data_in_face - (0, org_he->twin()->get_is_equal_aux_data_in_face(0)); + (0, org_he->twin()->is_equal_aux_data_in_face(0)); new_he->set_is_equal_aux_data_in_face - (1, org_he->get_is_equal_aux_data_in_face(1)); + (1, org_he->is_equal_aux_data_in_face(1)); new_he->twin()->set_is_equal_aux_data_in_face - (1, org_he->twin()->get_is_equal_aux_data_in_face(1)); + (1, org_he->twin()->is_equal_aux_data_in_face(1)); new_he->set_has_equal_aux_data_in_face - (0, org_he->get_has_equal_aux_data_in_face(0)); + (0, org_he->has_equal_aux_data_in_face(0)); new_he->twin()->set_has_equal_aux_data_in_face - (0, org_he->twin()->get_has_equal_aux_data_in_face(0)); + (0, org_he->twin()->has_equal_aux_data_in_face(0)); new_he->set_has_equal_aux_data_in_face - (1, org_he->get_has_equal_aux_data_in_face(1)); + (1, org_he->has_equal_aux_data_in_face(1)); new_he->twin()->set_has_equal_aux_data_in_face - (1, org_he->twin()->get_has_equal_aux_data_in_face(1)); + (1, org_he->twin()->has_equal_aux_data_in_face(1)); // new_he->target is the original edge's target, and org_he->target // is the new vertex new_he->set_is_equal_aux_data_in_target - (0, org_he->get_is_equal_aux_data_in_target(0)); + (0, org_he->is_equal_aux_data_in_target(0)); new_he->set_is_equal_aux_data_in_target - (1, org_he->get_is_equal_aux_data_in_target(1)); + (1, org_he->is_equal_aux_data_in_target(1)); org_he->set_is_equal_aux_data_in_target(0, true); org_he->set_is_equal_aux_data_in_target(1, true); new_he->set_has_equal_aux_data_in_target - (0, org_he->get_has_equal_aux_data_in_target(0)); + (0, org_he->has_equal_aux_data_in_target(0)); new_he->set_has_equal_aux_data_in_target - (1, org_he->get_has_equal_aux_data_in_target(1)); + (1, org_he->has_equal_aux_data_in_target(1)); org_he->set_has_equal_aux_data_in_target (0, !base->aux_has_no_data(org_he, 0)); org_he->set_has_equal_aux_data_in_target (1, !base->aux_has_no_data(org_he, 1)); new_he->set_has_equal_aux_data_in_target_and_face - (0, org_he->get_has_equal_aux_data_in_target_and_face(0)); + (0, org_he->has_equal_aux_data_in_target_and_face(0)); new_he->set_has_equal_aux_data_in_target_and_face - (1, org_he->get_has_equal_aux_data_in_target_and_face(1)); + (1, org_he->has_equal_aux_data_in_target_and_face(1)); org_he->set_has_equal_aux_data_in_target_and_face - (0, org_he->get_has_equal_aux_data_in_face(0)); + (0, org_he->has_equal_aux_data_in_face(0)); org_he->set_has_equal_aux_data_in_target_and_face - (1, org_he->get_has_equal_aux_data_in_face(1)); + (1, org_he->has_equal_aux_data_in_face(1)); // new_he->source is the new vertex, and org_he->source is the // original vertex new_he->twin()->set_is_equal_aux_data_in_target(0, true); new_he->twin()->set_is_equal_aux_data_in_target(1, true); new_he->twin()->set_has_equal_aux_data_in_target - (0,!base->aux_has_no_data(org_he, 0)); + (0, ! base->aux_has_no_data(org_he, 0)); new_he->twin()->set_has_equal_aux_data_in_target - (1,!base->aux_has_no_data(org_he, 1)); + (1, ! base->aux_has_no_data(org_he, 1)); new_he->twin()->set_has_equal_aux_data_in_target_and_face - (0, org_he->twin()->get_has_equal_aux_data_in_face(0)); + (0, org_he->twin()->has_equal_aux_data_in_face(0)); new_he->twin()->set_has_equal_aux_data_in_target_and_face - (1, org_he->twin()->get_has_equal_aux_data_in_face(1)); + (1, org_he->twin()->has_equal_aux_data_in_face(1)); } protected: @@ -1573,7 +1560,7 @@ protected: else if (base->aux_has_no_data(fh, 0) && base->aux_has_no_data(fh, 1)) { fh->set_decision(EQUAL); - fh->set_no_data(); + fh->set_no_env_data(); } else if (!base->aux_has_no_data(fh, 0) && base->aux_has_no_data(fh, 1)) fh->set_decision(DAC_DECISION_FIRST); @@ -1587,7 +1574,7 @@ protected: #endif protected: - Envelope_resolver* resolver; + Envelope_resolver* m_resolver; const Traits* m_geom_traits; bool m_own_traits; bool m_is_lower; diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h index 8d50d5bcd1a..07e2d706d14 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h @@ -166,21 +166,21 @@ public: // get a face with 2 surfaces defined over it, and compute the arrangement // of the/ envelope of these surfaces over the face void resolve(Face_handle face, Minimization_diagram_2& result) { - CGAL_assertion(face->get_aux_is_set(0)); - CGAL_assertion(face->get_aux_is_set(1)); + CGAL_assertion(face->aux_is_set(0)); + CGAL_assertion(face->aux_is_set(1)); // we are interested with the envelope's shape over the current face, // so we only need to check the first surface from each group, since // all the surfaces in a group overlap over the current face. - const Xy_monotone_surface_3& surf1 = get_aux_surface(face, 0); - const Xy_monotone_surface_3& surf2 = get_aux_surface(face, 1); + const Xy_monotone_surface_3& surf1 = aux_surface(face, 0); + const Xy_monotone_surface_3& surf2 = aux_surface(face, 1); // find the projected intersections of the surfaces. if none - we have // a simple case: // need only resolve non-intersecting and return std::list> inter_objs; - get_projected_intersections(surf1, surf2, std::back_inserter(inter_objs)); + projected_intersections(surf1, surf2, std::back_inserter(inter_objs)); if (inter_objs.size() == 0) { // here for resolve we can compare the surfaces over the edges only @@ -234,7 +234,7 @@ public: // projected intersection that created it. Halfedges_w_type_list result_new_edges; // 3. the collection of faces that form the face before any insertion - Faces_list result_face_parts; + Faces_list result_face_parts; // 4. the collection of special vertices, which contains: // - new vertices that were created inside the original face // (both isolated and not isolated) @@ -289,8 +289,7 @@ public: // in order to use resolve_minimal_face with intersection halfedge, we // go over the new edges, and set data over their faces - typename Halfedges_w_type_list::iterator new_edge_it; - for (new_edge_it = result_new_edges.begin(); + for (auto new_edge_it = result_new_edges.begin(); new_edge_it != result_new_edges.end(); ++new_edge_it) { Halfedge_handle new_he = (*new_edge_it).first; Halfedge_handle new_he_twin = new_he->twin(); @@ -298,10 +297,10 @@ public: Multiplicity itype = (*new_edge_it).second; #endif // set sources of the new edge - new_he->set_aux_source(0, face->get_aux_source(0)); - new_he->set_aux_source(1, face->get_aux_source(1)); - new_he_twin->set_aux_source(0, face->get_aux_source(0)); - new_he_twin->set_aux_source(1, face->get_aux_source(1)); + new_he->set_aux_source(0, face->aux_source(0)); + new_he->set_aux_source(1, face->aux_source(1)); + new_he_twin->set_aux_source(0, face->aux_source(0)); + new_he_twin->set_aux_source(1, face->aux_source(1)); // set data on new edges new_he->set_decision(EQUAL); @@ -312,7 +311,7 @@ public: // to f1, not only the opposite Face_handle f1 = new_he->face(), f2 = new_he_twin->face(); Comparison_result res; - if (! f1->is_decision_set() && !f2->is_decision_set()) { + if (! f1->is_decision_set() && ! f2->is_decision_set()) { res = resolve_minimal_face(f1, &new_he); copy_data_by_comparison_result(face, f1, res); } @@ -324,7 +323,7 @@ public: if (! f2->is_decision_set()) { #ifdef CGAL_ENVELOPE_SAVE_COMPARISONS if (itype != 0) { - res = convert_decision_to_comparison_result(f1->get_decision()); + res = convert_decision_to_comparison_result(f1->decision()); res = resolve_by_intersection_type(res, itype); CGAL_expensive_assertion_code (Comparison_result tmp_res = @@ -340,7 +339,7 @@ public: if (! f1->is_decision_set()) { #ifdef CGAL_ENVELOPE_SAVE_COMPARISONS if (itype != 0) { - res = convert_decision_to_comparison_result(f2->get_decision()); + res = convert_decision_to_comparison_result(f2->decision()); res = resolve_by_intersection_type(res, itype); CGAL_expensive_assertion_code (Comparison_result tmp_res = resolve_minimal_face(f1, &new_he)); @@ -357,8 +356,7 @@ public: // we also need to check the faces incident to the halfedges in // special_edges since the envelope data over them should be computed // using compare_left/right versions - Halfedges_list_iterator special_edge_it; - for (special_edge_it = result_special_edges.begin(); + for (auto special_edge_it = result_special_edges.begin(); special_edge_it != result_special_edges.end(); ++special_edge_it) { // we assume that the halfedge given points to the correct face // (which is inside the original face) @@ -372,17 +370,17 @@ public: // take care for the edge, if necessary if (! special_he->is_decision_set() && can_copy_decision_from_face_to_edge(special_he)) { - // if (!special_he->get_aux_is_set(0) || !special_he->get_aux_is_set(1)) + // if (!special_he->aux_is_set(0) || !special_he->aux_is_set(1)) // { // // this can only happen when the edge is fake, since the edge is on //// the face's boundary - // CGAL_assertion(special_he->get_is_fake()); - // special_he->set_aux_source(0, face->get_aux_source(0)); - // special_he->set_aux_source(1, face->get_aux_source(1)); - // special_he->twin()->set_aux_source(0, face->get_aux_source(0)); - // special_he->twin()->set_aux_source(1, face->get_aux_source(1)); + // CGAL_assertion(special_he->is_fake()); + // special_he->set_aux_source(0, face->aux_source(0)); + // special_he->set_aux_source(1, face->aux_source(1)); + // special_he->twin()->set_aux_source(0, face->aux_source(0)); + // special_he->twin()->set_aux_source(1, face->aux_source(1)); // } - //if (special_he->get_is_fake()) + //if (special_he->is_fake()) //{ // // this edge is not fake anymore, as it coincides with a projected // // intersection @@ -400,22 +398,19 @@ public: ++special_vertex_it) { Vertex_handle special_v = *special_vertex_it; if (! special_v->is_decision_set()) { - if (special_v->get_aux_is_set(0) && special_v->get_aux_is_set(1)) + if (special_v->aux_is_set(0) && special_v->aux_is_set(1)) set_data_by_comparison_result(special_v, EQUAL); else // this is a new vertex inside the face, so we need to update its // aux source information from face also (done in method) copy_all_data_to_vertex(face, special_v); } - else - CGAL_assertion(special_v->get_aux_is_set(0) && \ - special_v->get_aux_is_set(1)); + else CGAL_assertion(special_v->aux_is_set(0) && special_v->aux_is_set(1)); } // assert all new faces got data set, if not, then maybe no curve cuts // the face, and should use regular resolve_minimal_face - typename std::list::iterator new_face_it; - for (new_face_it = result_face_parts.begin(); + for (auto new_face_it = result_face_parts.begin(); new_face_it != result_face_parts.end(); ++new_face_it) { Face_handle new_face = *new_face_it; if (! new_face->is_decision_set()) { @@ -433,12 +428,12 @@ public: // get an edge with 2 surfaces defined over it, and split it to get the shape // of the envelope of these surfaces over the edge void resolve(Halfedge_handle edge, Minimization_diagram_2& result) { - const Xy_monotone_surface_3& surf1 = get_aux_surface(edge, 0); - const Xy_monotone_surface_3& surf2 = get_aux_surface(edge, 1); + const Xy_monotone_surface_3& surf1 = aux_surface(edge, 0); + const Xy_monotone_surface_3& surf2 = aux_surface(edge, 1); // find the projected intersections std::list> inter_objs; - get_projected_intersections(surf1, surf2, std::back_inserter(inter_objs)); + projected_intersections(surf1, surf2, std::back_inserter(inter_objs)); if (inter_objs.size() == 0) { resolve_minimal_edge(edge, edge); @@ -560,8 +555,7 @@ public: (original_src->is_at_open_boundary() && is_min_end_at_inf)) { source_is_special = true; - if (split_points.front().third == true) - overlaps++; + if (split_points.front().third == true) ++overlaps; } // check if target is a special vertex, by checking the last point in @@ -687,8 +681,8 @@ public: void resolve(Vertex_handle vertex) { // it is enough to compare only one surface from each group (because they // all overlap over the vertex), but set all the group - const Xy_monotone_surface_3& surf1 = get_aux_surface(vertex, 0); - const Xy_monotone_surface_3& surf2 = get_aux_surface(vertex, 1); + const Xy_monotone_surface_3& surf1 = aux_surface(vertex, 0); + const Xy_monotone_surface_3& surf2 = aux_surface(vertex, 1); const Point_2& point_2 = vertex->point(); Comparison_result cur_res = compare_distance_to_envelope(point_2, surf1, surf2); @@ -754,8 +748,8 @@ protected: if (success) return res; - const Xy_monotone_surface_3& surf1 = get_aux_surface(face, 0); - const Xy_monotone_surface_3& surf2 = get_aux_surface(face, 1); + const Xy_monotone_surface_3& surf1 = aux_surface(face, 0); + const Xy_monotone_surface_3& surf2 = aux_surface(face, 1); Ccb_halfedge_circulator hec; if (he == nullptr) { @@ -767,7 +761,7 @@ protected: Ccb_halfedge_circulator curr = hec; do { Halfedge_handle he = hec; - if(he->is_fictitious()) ++hec; + if (he->is_fictitious()) ++hec; else { found_edge = true; const X_monotone_curve_2& cv = hec->curve(); @@ -775,7 +769,7 @@ protected: break; } } - while(curr != hec); + while (curr != hec); } if (! found_edge) { @@ -801,7 +795,7 @@ protected: CGAL_assertion_code(Ccb_halfedge_circulator hec_begin = hec; ++hec; while (hec != hec_begin) { - if(hec->is_fictitious()) { + if (hec->is_fictitious()) { ++hec; continue; } @@ -857,9 +851,9 @@ protected: // find intersections between 2 xy-monotone surfaces // use caching for repeating questions of same pair of surfaces template - OutputIterator get_projected_intersections(const Xy_monotone_surface_3& s1, - const Xy_monotone_surface_3& s2, - OutputIterator o) { + OutputIterator projected_intersections(const Xy_monotone_surface_3& s1, + const Xy_monotone_surface_3& s2, + OutputIterator o) { return m_traits->construct_projected_intersections_2_object()(s1, s2, o); } @@ -893,9 +887,8 @@ protected: // helper method to get the surfaces we need to work on template - const Xy_monotone_surface_3& get_aux_surface(FeatureHandle fh, - unsigned int id) { - const Object& o = fh->get_aux_source(id); + const Xy_monotone_surface_3& aux_surface(FeatureHandle fh, unsigned int id) { + const Object& o = fh->aux_source(id); CGAL_assertion(!o.is_empty()); // aux source of a face must be a face! @@ -904,30 +897,30 @@ protected: // this is why we start with a check for a face, then halfedge // and last vertex Face_handle f; - if (assign(f, o)) return f->get_env_data(); + if (assign(f, o)) return f->env_data_front(); Halfedge_handle h; - if (assign(h, o)) return h->get_env_data(); + if (assign(h, o)) return h->env_data_front(); Vertex_handle v; CGAL_assertion_code(bool b =) assign(v, o); CGAL_assertion(b); - return v->get_env_data(); + return v->env_data_front(); } bool can_copy_decision_from_face_to_edge(Halfedge_handle h) { // can copy decision from face to its incident edge if the aux // envelopes are continuous over the face and edge - return (h->get_has_equal_aux_data_in_face(0) && - h->get_has_equal_aux_data_in_face(1)); + return (h->has_equal_aux_data_in_face(0) && + h->has_equal_aux_data_in_face(1)); } bool can_copy_decision_from_edge_to_vertex(Halfedge_handle h) { // can copy decision from face to its incident edge if the aux // envelopes are continuous over the face and edge - return (h->get_has_equal_aux_data_in_target(0) && - h->get_has_equal_aux_data_in_target(1)); + return (h->has_equal_aux_data_in_target(0) && + h->has_equal_aux_data_in_target(1)); } @@ -957,7 +950,7 @@ protected: if (! vh->is_decision_set() && has_equal_aux_data_with_face(vh)) // can copy the data from the face, since we already took care of // the vertices of projected intersections - vh->set_decision(face->get_decision()); + vh->set_decision(face->decision()); } } @@ -966,21 +959,18 @@ protected: Ccb_halfedge_circulator hec_begin = hec; do { Halfedge_handle hh = hec; - if (hh->is_fictitious()) { - ++hec; - continue; - } + if (hh->is_fictitious()) continue; CGAL_assertion(face == hh->face()); // if it is a vertical decomposition edge, copy data from face - /*if (!hh->is_decision_set() && hh->get_is_fake()) - { - hh->set_decision(face->get_decision()); - hh->twin()->set_decision(face->get_decision()); - }*/ + /* if (!hh->is_decision_set() && hh->is_fake()) { + * hh->set_decision(face->decision()); + * hh->twin()->set_decision(face->decision()); + * } + */ if (! hh->is_decision_set() && can_copy_decision_from_face_to_edge(hh)) { // copy the decision from face to the edge - hh->set_decision(face->get_decision()); - hh->twin()->set_decision(hh->get_decision()); + hh->set_decision(face->decision()); + hh->twin()->set_decision(hh->decision()); } // TODO: is this correct? shouldn't we split the edge first? // I think it is correct, because there is no intersection (of @@ -992,19 +982,18 @@ protected: // from the face to the edge, the envelope goes closer), then if the // second map wins on the face, it wins on the edge also else if (! hh->is_decision_set() && - face->get_decision() == DAC_DECISION_SECOND && - hh->get_has_equal_aux_data_in_face(0) && - ! hh->get_has_equal_aux_data_in_face(1)) { + face->decision() == DAC_DECISION_SECOND && + hh->has_equal_aux_data_in_face(0) && + ! hh->has_equal_aux_data_in_face(1)) { hh->set_decision(DAC_DECISION_SECOND); hh->twin()->set_decision(DAC_DECISION_SECOND); - } // if the second map is continuous, but the first isn't, then if the // first map wins on the face, it wins on the edge also else if (! hh->is_decision_set() && - face->get_decision() == DAC_DECISION_FIRST && - ! hh->get_has_equal_aux_data_in_face(0) && - hh->get_has_equal_aux_data_in_face(1)) { + face->decision() == DAC_DECISION_FIRST && + ! hh->has_equal_aux_data_in_face(0) && + hh->has_equal_aux_data_in_face(1)) { hh->set_decision(DAC_DECISION_FIRST); hh->twin()->set_decision(DAC_DECISION_FIRST); } @@ -1014,9 +1003,7 @@ protected: // conclude from one edge, bt can conclude from the other conclude_decision_to_vertex(hh->source(), hh->twin(), face, false); conclude_decision_to_vertex(hh->target(), hh, face, true); - - hec++; - } while(hec != hec_begin); + } while (++hec != hec_begin); } // try to conclude the decision from the halfedge or the face to the vertex @@ -1028,23 +1015,23 @@ protected: Face_handle fh, bool try_vertex_face) { if (vh->is_decision_set()) return; -// first, we try to copy decision from edge, then from face + // first, we try to copy decision from edge, then from face if (hh->is_decision_set() && can_copy_decision_from_edge_to_vertex(hh)) - vh->set_decision(hh->get_decision()); + vh->set_decision(hh->decision()); // if the first map is continuous, but the second isn't (i.e. when we move // from the edge to the vertex, the envelope goes closer), then if the // second map wins on the edge, it wins on the vertex also - else if (hh->get_decision() == DAC_DECISION_SECOND && - hh->get_has_equal_aux_data_in_target(0) && - ! hh->get_has_equal_aux_data_in_target(1)) + else if (hh->decision() == DAC_DECISION_SECOND && + hh->has_equal_aux_data_in_target(0) && + ! hh->has_equal_aux_data_in_target(1)) vh->set_decision(DAC_DECISION_SECOND); // if the second map is continuous, but the first isn't, then if the // first map wins on the edge, it wins on the vertex also - else if (hh->get_decision() == DAC_DECISION_FIRST && - ! hh->get_has_equal_aux_data_in_target(0) && - hh->get_has_equal_aux_data_in_target(1)) + else if (hh->decision() == DAC_DECISION_FIRST && + ! hh->has_equal_aux_data_in_target(0) && + hh->has_equal_aux_data_in_target(1)) vh->set_decision(DAC_DECISION_FIRST); // check if we can copy from the face @@ -1056,15 +1043,17 @@ protected: if (has_equal_aux_data_in_target_and_face(hh)) { // can copy the data from the face, since we already took care of // the vertices of projected intersections - vh->set_decision(fh->get_decision()); + vh->set_decision(fh->decision()); } } } // todo: this is for checking template - bool has_equal_data(const InputIterator& begin1, const InputIterator& end1, - const InputIterator& begin2, const InputIterator& end2) { + bool has_equal_env_data(const InputIterator& begin1, + const InputIterator& end1, + const InputIterator& begin2, + const InputIterator& end2) { // insert the input data objects into a set std::set first(begin1, end1); std::set second(begin2, end2); @@ -1078,29 +1067,29 @@ protected: // todo: this is for checking template - void get_aux_data_iterators(unsigned int id, FeatureHandle fh, - Envelope_data_iterator& begin, - Envelope_data_iterator& end) { + void aux_data_iterators(unsigned int id, FeatureHandle fh, + Envelope_data_iterator& begin, + Envelope_data_iterator& end) { Halfedge_handle h; Vertex_handle v; Face_handle f; - const Object& o = fh->get_aux_source(id); + const Object& o = fh->aux_source(id); CGAL_assertion(!o.is_empty()); if (assign(v, o)) { - begin = v->begin_data(); - end = v->end_data(); + begin = v->begin_env_data(); + end = v->end_env_data(); } else if (assign(h, o)) { - begin = h->begin_data(); - end = h->end_data(); + begin = h->begin_env_data(); + end = h->end_env_data(); } else { CGAL_assertion(assign(f, o)); assign(f, o); - begin = f->begin_data(); - end = f->end_data(); + begin = f->begin_env_data(); + end = f->end_env_data(); } } @@ -1109,9 +1098,9 @@ protected: bool has_equal_aux_data(unsigned int id, FeatureHandle1 fh1, FeatureHandle2 fh2) { Envelope_data_iterator begin1, end1, begin2, end2; - get_aux_data_iterators(id, fh1, begin1, end1); - get_aux_data_iterators(id, fh2, begin2, end2); - bool has_eq = has_equal_data(begin1, end1, begin2, end2); + aux_data_iterators(id, fh1, begin1, end1); + aux_data_iterators(id, fh2, begin2, end2); + bool has_eq = has_equal_env_data(begin1, end1, begin2, end2); return has_eq; } @@ -1122,7 +1111,6 @@ protected: has_equal_aux_data(1, fh1, fh2)); } - // check if we can copy the decision made on a boundary edge to the face // if so, res will contain this decision's comparison result bool can_copy_decision_from_boundary_edge(Face_handle face, @@ -1138,37 +1126,33 @@ protected: hec_begin = hec; do { Halfedge_handle hh = hec; - if(hh->is_fictitious()) { - ++hec; - continue; - } + if (hh->is_fictitious()) continue; if (can_copy_decision_from_face_to_edge(hh) && hh->is_decision_set() && - hh->get_decision() != DAC_DECISION_BOTH) { - res = convert_decision_to_comparison_result(hh->get_decision()); + hh->decision() != DAC_DECISION_BOTH) { + res = convert_decision_to_comparison_result(hh->decision()); result = true; } // if the first map is continuous, but the second isn't (i.e. when we // move from the edge to the face, the envelope goes farther), then // if the first map wins on the edge, it wins on the face also else if (hh->is_decision_set() && - hh->get_decision() == DAC_DECISION_FIRST && - hh->get_has_equal_aux_data_in_face(0) && - ! hh->get_has_equal_aux_data_in_face(1)) { + hh->decision() == DAC_DECISION_FIRST && + hh->has_equal_aux_data_in_face(0) && + ! hh->has_equal_aux_data_in_face(1)) { res = convert_decision_to_comparison_result(DAC_DECISION_FIRST); result = true; } // if the second map is continuous, but the first isn't, then if the // second map wins on the edge, it wins on the face also else if (hh->is_decision_set() && - hh->get_decision() == DAC_DECISION_SECOND && - !hh->get_has_equal_aux_data_in_face(0) && - hh->get_has_equal_aux_data_in_face(1)) { + hh->decision() == DAC_DECISION_SECOND && + !hh->has_equal_aux_data_in_face(0) && + hh->has_equal_aux_data_in_face(1)) { res = convert_decision_to_comparison_result(DAC_DECISION_SECOND); result = true; } - hec++; - } while(hec != hec_begin && !result); + } while ((++hec != hec_begin) && ! result); if (result) return true; } @@ -1182,33 +1166,30 @@ protected: Halfedge_handle hh = hec; if (can_copy_decision_from_face_to_edge(hh) && hh->is_decision_set() && - hh->get_decision() != DAC_DECISION_BOTH) { - res = convert_decision_to_comparison_result(hh->get_decision()); + hh->decision() != DAC_DECISION_BOTH) { + res = convert_decision_to_comparison_result(hh->decision()); result = true; } // if the first map is continuous, but the second isn't (i.e. when we // move from the edge to the face, the envelope goes farther), then // if the first map wins on the edge, it wins on the face also else if (hh->is_decision_set() && - hh->get_decision() == DAC_DECISION_FIRST && - hh->get_has_equal_aux_data_in_face(0) && - ! hh->get_has_equal_aux_data_in_face(1)) { + hh->decision() == DAC_DECISION_FIRST && + hh->has_equal_aux_data_in_face(0) && + ! hh->has_equal_aux_data_in_face(1)) { res = convert_decision_to_comparison_result(DAC_DECISION_FIRST); - result = true; } // if the second map is continuous, but the first isn't, then if the // second map wins on the edge, it wins on the face also else if (hh->is_decision_set() && - hh->get_decision() == DAC_DECISION_SECOND && - ! hh->get_has_equal_aux_data_in_face(0) && - hh->get_has_equal_aux_data_in_face(1)) { + hh->decision() == DAC_DECISION_SECOND && + ! hh->has_equal_aux_data_in_face(0) && + hh->has_equal_aux_data_in_face(1)) { res = convert_decision_to_comparison_result(DAC_DECISION_SECOND); result = true; } - - hec++; - } while(hec != hec_begin && !result); + } while ((++hec != hec_begin) && ! result); if (result) return true; } @@ -1228,13 +1209,13 @@ protected: bool has_equal_aux_data_with_face(Vertex_handle v) { CGAL_assertion(v->is_isolated()); - return (v->get_has_equal_aux_data_in_face(0) && - v->get_has_equal_aux_data_in_face(1)); + return (v->has_equal_aux_data_in_face(0) && + v->has_equal_aux_data_in_face(1)); } bool has_equal_aux_data_in_target_and_face(Halfedge_handle h) { - return (h->get_has_equal_aux_data_in_target_and_face(0) && - h->get_has_equal_aux_data_in_target_and_face(1)); + return (h->has_equal_aux_data_in_target_and_face(0) && + h->has_equal_aux_data_in_target_and_face(1)); } // check the aux data on the endpoint vertices of the edge @@ -1246,20 +1227,20 @@ protected: can_copy_decision_from_edge_to_vertex(edge->twin())) // can copy the data from the edge, since we already took care of // the vertices of projected intersections - edge->source()->set_decision(edge->get_decision()); + edge->source()->set_decision(edge->decision()); // if the first map is continuous, but the second isn't (i.e. when we move // from the edge to the vertex, the envelope goes closer), then if the // second map wins on the edge, it wins on the vertex also - else if (edge->get_decision() == DAC_DECISION_SECOND && - edge->twin()->get_has_equal_aux_data_in_target(0) && - !edge->twin()->get_has_equal_aux_data_in_target(1)) { + else if (edge->decision() == DAC_DECISION_SECOND && + edge->twin()->has_equal_aux_data_in_target(0) && + !edge->twin()->has_equal_aux_data_in_target(1)) { edge->source()->set_decision(DAC_DECISION_SECOND); } // if the second map is continuous, but the first isn't, then if the // first map wins on the edge, it wins on the vertex also - else if (edge->get_decision() == DAC_DECISION_FIRST && - !edge->twin()->get_has_equal_aux_data_in_target(0) && - edge->twin()->get_has_equal_aux_data_in_target(1)) { + else if (edge->decision() == DAC_DECISION_FIRST && + !edge->twin()->has_equal_aux_data_in_target(0) && + edge->twin()->has_equal_aux_data_in_target(1)) { edge->source()->set_decision(DAC_DECISION_FIRST); } @@ -1268,20 +1249,20 @@ protected: can_copy_decision_from_edge_to_vertex(edge)) // can copy the data from the edge, since we already took care of // the vertices of projected intersections - edge->target()->set_decision(edge->get_decision()); + edge->target()->set_decision(edge->decision()); // if the first map is continuous, but the second isn't (i.e. when we move // from the edge to the vertex, the envelope goes closer), then if the // second map wins on the edge, it wins on the vertex also - else if (edge->get_decision() == DAC_DECISION_SECOND && - edge->get_has_equal_aux_data_in_target(0) && - !edge->get_has_equal_aux_data_in_target(1)) { + else if (edge->decision() == DAC_DECISION_SECOND && + edge->has_equal_aux_data_in_target(0) && + !edge->has_equal_aux_data_in_target(1)) { edge->target()->set_decision(DAC_DECISION_SECOND); } // if the second map is continuous, but the first isn't, then if the // first map wins on the edge, it wins on the vertex also - else if (edge->get_decision() == DAC_DECISION_FIRST && - !edge->get_has_equal_aux_data_in_target(0) && - edge->get_has_equal_aux_data_in_target(1)) { + else if (edge->decision() == DAC_DECISION_FIRST && + !edge->has_equal_aux_data_in_target(0) && + edge->has_equal_aux_data_in_target(1)) { edge->target()->set_decision(DAC_DECISION_FIRST); } } @@ -1454,8 +1435,7 @@ protected: CGAL_assertion(tmp == copied_prev_v2); bool new_face; - if (is_outer_ccb) - { + if (is_outer_ccb) { // if it is the first face created, and the last halfedge to // insert, this is a regular outer ccb, with no special // degeneracies (around the current vertices, at least) @@ -1469,8 +1449,8 @@ protected: copied_prev_v2->next(), new_face, dummy_swapped_predecessors); - // TODO EBEB 2012-08-06 do we have to care if order has been swapped, - // or do we have to disallow swapping? + // TODO EBEB 2012-08-06 do we have to care if order has been + // swapped, or do we have to disallow swapping? CGAL_assertion(new_face); } @@ -1503,8 +1483,8 @@ protected: copied_prev_he->next(), new_face, dummy_swapped_predecessors); - // TODO EBEB 2012-08-06 do we have to care if order has been swapped, - // or do we have to disallow swapping? + // TODO EBEB 2012-08-06 do we have to care if order has been + // swapped, or do we have to disallow swapping? CGAL_assertion(new_face); copied_new_he = copied_new_he->twin(); @@ -1522,9 +1502,7 @@ protected: copied_prev_he = copied_new_he; } } - hec++; - } while(hec != hec_begin); - + } while (++hec != hec_begin); } void copy_ccb_unbounded(Ccb_halfedge_circulator hec, @@ -1543,8 +1521,7 @@ protected: non_fict = hec; break; } - ++hec; - } while(hec != hec_end); + } while (++hec != hec_end); // Find an anchor halfedge he_from along the original CCB and locate // its image he_to in the target CCB. @@ -1712,26 +1689,26 @@ protected: // aux data of face "from" void copy_data_by_comparison_result(Face_handle from, Face_handle to, Comparison_result res) { - CGAL_assertion_msg(from->get_aux_is_set(0), "aux_data(0) is not set"); - CGAL_assertion_msg(from->get_aux_is_set(1), "aux_data(1) is not set"); - to->set_aux_source(0, from->get_aux_source(0)); - to->set_aux_source(1, from->get_aux_source(1)); + CGAL_assertion_msg(from->aux_is_set(0), "aux_data(0) is not set"); + CGAL_assertion_msg(from->aux_is_set(1), "aux_data(1) is not set"); + to->set_aux_source(0, from->aux_source(0)); + to->set_aux_source(1, from->aux_source(1)); to->set_decision(res); } // set envelope data in vertex "v" according to the comparison result of the // aux data of "v" void set_data_by_comparison_result(Vertex_handle v, Comparison_result res) { - CGAL_assertion_msg(v->get_aux_is_set(0), "aux_data(0) is not set"); - CGAL_assertion_msg(v->get_aux_is_set(1), "aux_data(1) is not set"); + CGAL_assertion_msg(v->aux_is_set(0), "aux_data(0) is not set"); + CGAL_assertion_msg(v->aux_is_set(1), "aux_data(1) is not set"); v->set_decision(res); } // set envelope data in halfedge "h" according to the comparison result of // the aux data of "h" void set_data_by_comparison_result(Halfedge_handle h, Comparison_result res) { - CGAL_assertion_msg(h->get_aux_is_set(0), "aux_data(0) is not set"); - CGAL_assertion_msg(h->get_aux_is_set(1), "aux_data(1) is not set"); + CGAL_assertion_msg(h->aux_is_set(0), "aux_data(0) is not set"); + CGAL_assertion_msg(h->aux_is_set(1), "aux_data(1) is not set"); h->set_decision(res); } @@ -1741,38 +1718,38 @@ protected: // Vertex_handle template void copy_all_data_to_vertex(FeatureHabdle from, Vertex_handle to) { - CGAL_assertion_msg(from->get_aux_is_set(0), "aux_data(0) is not set"); - CGAL_assertion_msg(from->get_aux_is_set(1), "aux_data(1) is not set"); + CGAL_assertion_msg(from->aux_is_set(0), "aux_data(0) is not set"); + CGAL_assertion_msg(from->aux_is_set(1), "aux_data(1) is not set"); CGAL_assertion_msg(!to->is_decision_set(), "data is set in new vertex"); - to->set_aux_source(0, from->get_aux_source(0)); - to->set_aux_source(1, from->get_aux_source(1)); + to->set_aux_source(0, from->aux_source(0)); + to->set_aux_source(1, from->aux_source(1)); to->set_decision(EQUAL); } // void deal_with_new_vertex(Halfedge_handle orig_he, Vertex_handle new_v) // { - // const Xy_monotone_surface_3& surf1 = get_aux_surface(orig_he, 0); - // const Xy_monotone_surface_3& surf2 = get_aux_surface(orig_he, 1); + // const Xy_monotone_surface_3& surf1 = aux_surface(orig_he, 0); + // const Xy_monotone_surface_3& surf2 = aux_surface(orig_he, 1); // const Point_2& p = new_v->point(); // Comparison_result res = compare_distance_to_envelope(p, surf1, surf2); - // new_v->set_aux_source(0, orig_he->get_aux_source(0)); - // new_v->set_aux_source(1, orig_he->get_aux_source(1)); + // new_v->set_aux_source(0, orig_he->aux_source(0)); + // new_v->set_aux_source(1, orig_he->aux_source(1)); // new_v->set_decision(res); // } Comparison_result resolve_minimal_edge(Halfedge_handle orig_he, Halfedge_handle new_he) { // find and set the envelope data on the new edge - const Xy_monotone_surface_3& surf1 = get_aux_surface(orig_he, 0); - const Xy_monotone_surface_3& surf2 = get_aux_surface(orig_he, 1); + const Xy_monotone_surface_3& surf1 = aux_surface(orig_he, 0); + const Xy_monotone_surface_3& surf2 = aux_surface(orig_he, 1); Comparison_result res = compare_distance_to_envelope(new_he->curve(), surf1, surf2); // the observer keeps this information when splitting an edge - CGAL_assertion(new_he->get_aux_is_set(0) && new_he->get_aux_is_set(1)); - CGAL_assertion(new_he->twin()->get_aux_is_set(0) && \ - new_he->twin()->get_aux_is_set(1)); + CGAL_assertion(new_he->aux_is_set(0) && new_he->aux_is_set(1)); + CGAL_assertion(new_he->twin()->aux_is_set(0) && \ + new_he->twin()->aux_is_set(1)); new_he->set_decision(res); new_he->twin()->set_decision(res); @@ -1856,8 +1833,8 @@ protected: CGAL_assertion(map_halfedges.is_defined(org_he)); CGAL_assertion(org_he->target() == new_he->source()); - if ((map_halfedges[org_he])->get_has_equal_aux_data_in_face(0) && - (map_halfedges[org_he])->get_has_equal_aux_data_in_face(1)) + if ((map_halfedges[org_he])->has_equal_aux_data_in_face(0) && + (map_halfedges[org_he])->has_equal_aux_data_in_face(1)) (*special_vertices)[org_he->target()] = special_vertices->default_value(); @@ -1882,8 +1859,9 @@ protected: (*vertices_to_halfedges)[org_he->target()] = correct_side_he; //BZBZ - /* CGAL_assertion(vertices_to_halfedges->is_defined(correct_side_he->source()) && - vertices_to_halfedges->is_defined(correct_side_he->next()->target()));*/ + // CGAL_assertion + // (vertices_to_halfedges->is_defined(correct_side_he->source()) && + // vertices_to_halfedges->is_defined(correct_side_he->next()->target())); (*vertices_to_halfedges)[correct_side_he->next()->target()] = correct_side_he->next(); @@ -2435,8 +2413,7 @@ protected: Vertex_handle left_v, Halfedge_handle left_he, Vertex_handle right_v, Halfedge_handle right_he) { // insert the curve only if the face is ok - if (is_face_ok(face)) - { + if (is_face_ok(face)) { CGAL_assertion(copied_arr.is_valid()); Result base_result = insert_visitor.found_subcurve(cv, face, left_v, left_he, @@ -2486,17 +2463,17 @@ protected: // since we have in the new edge aux sources as in the face, // we can copy the vertex-face flags from the vertex result_new_he->set_is_equal_aux_data_in_target - (0, cur_t->get_is_equal_aux_data_in_face(0)); + (0, cur_t->is_equal_aux_data_in_face(0)); result_new_he->set_is_equal_aux_data_in_target - (1, cur_t->get_is_equal_aux_data_in_face(1)); + (1, cur_t->is_equal_aux_data_in_face(1)); result_new_he->set_has_equal_aux_data_in_target - (0, cur_t->get_has_equal_aux_data_in_face(0)); + (0, cur_t->has_equal_aux_data_in_face(0)); result_new_he->set_has_equal_aux_data_in_target - (1, cur_t->get_has_equal_aux_data_in_face(1)); + (1, cur_t->has_equal_aux_data_in_face(1)); result_new_he->set_has_equal_aux_data_in_target_and_face - (0, cur_t->get_has_equal_aux_data_in_face(0)); + (0, cur_t->has_equal_aux_data_in_face(0)); result_new_he->set_has_equal_aux_data_in_target_and_face - (1, cur_t->get_has_equal_aux_data_in_face(1)); + (1, cur_t->has_equal_aux_data_in_face(1)); } else { CGAL_assertion(copied_b_he->target() == cur_t); @@ -2505,20 +2482,20 @@ protected: bool flag; - flag = (b_he->get_is_equal_aux_data_in_face(0) && - b_he->get_is_equal_aux_data_in_target(0)); + flag = (b_he->is_equal_aux_data_in_face(0) && + b_he->is_equal_aux_data_in_target(0)); result_new_he->set_is_equal_aux_data_in_target(0, flag); - flag = (b_he->get_is_equal_aux_data_in_face(1) && - b_he->get_is_equal_aux_data_in_target(1)); + flag = (b_he->is_equal_aux_data_in_face(1) && + b_he->is_equal_aux_data_in_target(1)); result_new_he->set_is_equal_aux_data_in_target(1, flag); - flag = b_he->get_has_equal_aux_data_in_target_and_face(0); + flag = b_he->has_equal_aux_data_in_target_and_face(0); //CGAL_assertion(flag == parent->has_equal_aux_data(0, b_he->face(), b_he->target())); result_new_he->set_has_equal_aux_data_in_target(0, flag); result_new_he->set_has_equal_aux_data_in_target_and_face(0, flag); - flag = b_he->get_has_equal_aux_data_in_target_and_face(1); + flag = b_he->has_equal_aux_data_in_target_and_face(1); //CGAL_assertion(flag == parent->has_equal_aux_data(1, b_he->face(), b_he->target())); result_new_he->set_has_equal_aux_data_in_target(1, flag); result_new_he->set_has_equal_aux_data_in_target_and_face(1, flag); @@ -2544,17 +2521,17 @@ protected: // since we have in the new edge aux sources as in the face, // we can copy the vertex-face flags from the vertex result_new_he->twin()->set_is_equal_aux_data_in_target - (0, cur_t->get_is_equal_aux_data_in_face(0)); + (0, cur_t->is_equal_aux_data_in_face(0)); result_new_he->twin()->set_is_equal_aux_data_in_target - (1, cur_t->get_is_equal_aux_data_in_face(1)); + (1, cur_t->is_equal_aux_data_in_face(1)); result_new_he->twin()->set_has_equal_aux_data_in_target - (0, cur_t->get_has_equal_aux_data_in_face(0)); + (0, cur_t->has_equal_aux_data_in_face(0)); result_new_he->twin()->set_has_equal_aux_data_in_target - (1, cur_t->get_has_equal_aux_data_in_face(1)); + (1, cur_t->has_equal_aux_data_in_face(1)); result_new_he->twin()->set_has_equal_aux_data_in_target_and_face - (0, cur_t->get_has_equal_aux_data_in_face(0)); + (0, cur_t->has_equal_aux_data_in_face(0)); result_new_he->twin()->set_has_equal_aux_data_in_target_and_face - (1, cur_t->get_has_equal_aux_data_in_face(1)); + (1, cur_t->has_equal_aux_data_in_face(1)); } else { CGAL_assertion(copied_b_he->target() == cur_t); @@ -2562,20 +2539,20 @@ protected: Halfedge_handle b_he = map_halfedges[copied_b_he]; bool flag; - flag = (b_he->get_is_equal_aux_data_in_face(0) && - b_he->get_is_equal_aux_data_in_target(0)); + flag = (b_he->is_equal_aux_data_in_face(0) && + b_he->is_equal_aux_data_in_target(0)); result_new_he->twin()->set_is_equal_aux_data_in_target(0, flag); - flag = (b_he->get_is_equal_aux_data_in_face(1) && - b_he->get_is_equal_aux_data_in_target(1)); + flag = (b_he->is_equal_aux_data_in_face(1) && + b_he->is_equal_aux_data_in_target(1)); result_new_he->twin()->set_is_equal_aux_data_in_target(1, flag); - flag = b_he->get_has_equal_aux_data_in_target_and_face(0); - //CGAL_assertion(flag == parent->has_equal_aux_data(0, b_he->face(), b_he->target())); + flag = b_he->has_equal_aux_data_in_target_and_face(0); + // CGAL_assertion(flag == parent->has_equal_aux_data(0, b_he->face(), b_he->target())); result_new_he->twin()->set_has_equal_aux_data_in_target(0, flag); result_new_he->twin()->set_has_equal_aux_data_in_target_and_face(0, flag); - flag = b_he->get_has_equal_aux_data_in_target_and_face(1); + flag = b_he->has_equal_aux_data_in_target_and_face(1); //CGAL_assertion(flag == parent->has_equal_aux_data(1, b_he->face(), b_he->target())); result_new_he->twin()->set_has_equal_aux_data_in_target(1, flag); result_new_he->twin()->set_has_equal_aux_data_in_target_and_face(1, flag); @@ -2898,10 +2875,10 @@ protected: virtual void after_split_face(Face_handle org_f, Face_handle new_f, bool) override { // update the new face's aux_data from original face - if (org_f->get_aux_is_set(0)) - new_f->set_aux_source(0, org_f->get_aux_source(0)); - if (org_f->get_aux_is_set(1)) - new_f->set_aux_source(1, org_f->get_aux_source(1)); + if (org_f->aux_is_set(0)) + new_f->set_aux_source(0, org_f->aux_source(0)); + if (org_f->aux_is_set(1)) + new_f->set_aux_source(1, org_f->aux_source(1)); } }; diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_overlay_2.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_overlay_2.h index 118d9825c03..78dc81612ea 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_overlay_2.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_overlay_2.h @@ -60,135 +60,117 @@ public: } public: - /* - void print_face(Face_handle fh) - { - std::cout << (fh->is_unbounded() ? "unbounded" : "bounded"); - - if (fh->get_is_set()) - { - std::cout << " #data= " << fh->number_of_data_objects(); - if (fh->number_of_data_objects() > 0) - std::cout << " data= " << fh->get_env_data(); - } - - if (fh->get_aux_is_set(0)) - { - std::cout << " #data1= " << get_number_of_aux_data_objects(fh, 0); - if (get_number_of_aux_data_objects(fh, 0)>0) - std::cout << " data#1= " << get_aux_data(fh, 0); - } - if (fh->get_aux_is_set(1)) - { - std::cout << " #data2= " << get_number_of_aux_data_objects(fh, 1); - if (get_number_of_aux_data_objects(fh, 1)>0) - std::cout << " data#2= " << get_aux_data(fh, 1); - } - std::cout << std::endl; - } - - // print the aux data in the faces of md - void print_faces(Minimization_diagram_2& md) - { - Face_iterator fit = md.faces_begin(); - for(; fit != md.faces_end(); ++fit) - { - Face_handle fh = fit; - print_face(fh); - } - std::cout << std::endl; - } - - void print_vertices(Minimization_diagram_2& md) - { - Vertex_iterator vit = md.vertices_begin(); - for(; vit != md.vertices_end(); ++vit) - { - Vertex_handle vh = vit; - std::cout << vh->point(); - - if (vh->get_is_set()) - { - std::cout << " #data= " << vh->number_of_data_objects(); - if (vh->number_of_data_objects() > 0) - std::cout << " data= " << vh->get_env_data(); - } - - if (vh->get_aux_is_set(0)) - { - std::cout << " #data1= " << get_number_of_aux_data_objects(vh, 0); - if (get_number_of_aux_data_objects(vh, 0)>0) - std::cout << " data#1= " << get_aux_data(vh, 0); - } - if (vh->get_aux_is_set(1)) - { - std::cout << " #data2= " << get_number_of_aux_data_objects(vh, 1); - if (get_number_of_aux_data_objects(vh, 1)>0) - std::cout << " data#2= " << get_aux_data(vh, 1); - } - std::cout << std::endl; - } - std::cout << std::endl; - } - - void print_edges(Minimization_diagram_2& md) - { - Halfedge_iterator hit = md.halfedges_begin(); - for(; hit != md.halfedges_end(); ++hit, ++hit) - { - Halfedge_handle hh = hit; - std::cout << hh->curve(); - - if (hh->get_is_set()) - { - std::cout << " #data= " << hh->number_of_data_objects(); - if (hh->number_of_data_objects() > 0) - std::cout << " data= " << hh->get_env_data(); - } - - - if (hh->get_aux_is_set(0)) - { - std::cout << " #data1= " << get_number_of_aux_data_objects(hh, 0); - if (get_number_of_aux_data_objects(hh, 0)>0) - std::cout << " data#1= " << get_aux_data(hh, 0); - } - if (hh->get_aux_is_set(1)) - { - std::cout << " #data2= " << get_number_of_aux_data_objects(hh, 1); - - if (get_number_of_aux_data_objects(hh, 1)>0) - std::cout << " data#2= " << get_aux_data(hh, 1); - } - std::cout << std::endl; - } - std::cout << std::endl; - } - */ + /* void print_face(Face_handle fh) { + * std::cout << (fh->is_unbounded() ? "unbounded" : "bounded"); + * + * if (fh->env_is_set()) { + * std::cout << " #data= " << fh->env_data_size(); + * if (fh->env_data_size() > 0) + * std::cout << " data= " << fh->env_data_front(); + * } + * + * if (fh->aux_is_set(0)) { + * std::cout << " #data1= " << number_of_aux_data_objects(fh, 0); + * if (number_of_aux_data_objects(fh, 0)>0) + * std::cout << " data#1= " << aux_data(fh, 0); + * } + * if (fh->aux_is_set(1)) { + * std::cout << " #data2= " << number_of_aux_data_objects(fh, 1); + * if (number_of_aux_data_objects(fh, 1)>0) + * std::cout << " data#2= " << aux_data(fh, 1); + * } + * std::cout << std::endl; + * } + * + * // print the aux data in the faces of md + * void print_faces(Minimization_diagram_2& md) { + * Face_iterator fit = md.faces_begin(); + * for(; fit != md.faces_end(); ++fit) { + * Face_handle fh = fit; + * print_face(fh); + * } + * std::cout << std::endl; + * } + * + * void print_vertices(Minimization_diagram_2& md) { + * Vertex_iterator vit = md.vertices_begin(); + * for(; vit != md.vertices_end(); ++vit) { + * Vertex_handle vh = vit; + * std::cout << vh->point(); + * + * if (vh->env_is_set()) { + * std::cout << " #data= " << vh->env_data_size(); + * if (vh->env_data_size() > 0) + * std::cout << " data= " << vh->env_data_front(); + * } + * + * if (vh->aux_is_set(0)) { + * std::cout << " #data1= " << number_of_aux_data_objects(vh, 0); + * if (number_of_aux_data_objects(vh, 0)>0) + * std::cout << " data#1= " << aux_data(vh, 0); + * } + * if (vh->aux_is_set(1)) { + * std::cout << " #data2= " << number_of_aux_data_objects(vh, 1); + * if (number_of_aux_data_objects(vh, 1)>0) + * std::cout << " data#2= " << aux_data(vh, 1); + * } + * std::cout << std::endl; + * } + * std::cout << std::endl; + * } + * + * void print_edges(Minimization_diagram_2& md) { + * Halfedge_iterator hit = md.halfedges_begin(); + * for(; hit != md.halfedges_end(); ++hit, ++hit) { + * Halfedge_handle hh = hit; + * std::cout << hh->curve(); + * + * if (hh->env_is_set()) { + * std::cout << " #data= " << hh->env_data_size(); + * if (hh->env_data_size() > 0) + * std::cout << " data= " << hh->env_data_front(); + * } + * + * if (hh->aux_is_set(0)) { + * std::cout << " #data1= " << number_of_aux_data_objects(hh, 0); + * if (number_of_aux_data_objects(hh, 0)>0) + * std::cout << " data#1= " << aux_data(hh, 0); + * } + * if (hh->aux_is_set(1)) { + * std::cout << " #data2= " << number_of_aux_data_objects(hh, 1); + * + * if (number_of_aux_data_objects(hh, 1)>0) + * std::cout << " data#2= " << aux_data(hh, 1); + * } + * std::cout << std::endl; + * } + * std::cout << std::endl; + * } + */ void post_test_assertions(Minimization_diagram_2& md) { // check that all data is filled in result for (auto fi = md.faces_begin(); fi != md.faces_end(); ++fi) { Face_handle fh = fi; - CGAL_assertion_msg(fh->get_aux_is_set(0), + CGAL_assertion_msg(fh->aux_is_set(0), "data from md1 on face is not set"); - CGAL_assertion_msg(fh->get_aux_is_set(1), + CGAL_assertion_msg(fh->aux_is_set(1), "data from md2 on face is not set"); } for (auto hi = md.halfedges_begin(); hi != md.halfedges_end(); ++hi) { Halfedge_handle hh = hi; - CGAL_assertion_msg(hh->get_aux_is_set(0), + CGAL_assertion_msg(hh->aux_is_set(0), "data from md1 on halfedge is not set"); - CGAL_assertion_msg(hh->get_aux_is_set(1), + CGAL_assertion_msg(hh->aux_is_set(1), "data from md2 on halfedge is not set"); } for (auto vi = md.vertices_begin(); vi != md.vertices_end(); ++vi) { Vertex_handle vh = vi; - CGAL_assertion_msg(vh->get_aux_is_set(0), + CGAL_assertion_msg(vh->aux_is_set(0), "data from md1 on vertex is not set"); - CGAL_assertion_msg(vh->get_aux_is_set(1), + CGAL_assertion_msg(vh->aux_is_set(1), "data from md2 on vertex is not set"); } } @@ -196,37 +178,37 @@ public: protected: // helper methods template - Xy_monotone_surface_3 get_aux_data(FeatureHandle fh, unsigned int id) { - const Object& o = fh->get_aux_source(id); + Xy_monotone_surface_3 aux_data(FeatureHandle fh, unsigned int id) { + const Object& o = fh->aux_source(id); Xy_monotone_surface_3 data; Halfedge_handle h; Vertex_handle v; Face_handle f; - if (assign(v, o)) data = v->get_env_data(); - else if (assign(h, o)) data = h->get_env_data(); + if (assign(v, o)) data = v->env_data_front(); + else if (assign(h, o)) data = h->env_data_front(); else { CGAL_assertion(assign(f, o)); assign(f, o); - data = f->get_env_data(); + data = f->env_data_front(); } return data; } template - int get_number_of_aux_data_objects(FeatureHandle fh, unsigned int id) { - const Object& o = fh->get_aux_source(id); + int number_of_aux_data_objects(FeatureHandle fh, unsigned int id) { + const Object& o = fh->aux_source(id); int data; Halfedge_handle h; Vertex_handle v; Face_handle f; - if (assign(v, o)) data = v->number_of_data_objects(); - else if (assign(h, o)) data = h->number_of_data_objects(); + if (assign(v, o)) data = v->env_data_size(); + else if (assign(h, o)) data = h->env_data_size(); else { CGAL_assertion(assign(f, o)); assign(f, o); - data = f->number_of_data_objects(); + data = f->env_data_size(); } return data; } diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_overlay_functor.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_overlay_functor.h index 82ecf38b095..6b7c6cba674 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_overlay_functor.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_overlay_functor.h @@ -92,10 +92,10 @@ public: //res_v->set_is_intersection(false); if (v1->is_isolated() && v2->is_isolated()) { - res_v->set_is_equal_aux_data_in_face(0, v1->get_is_equal_data_in_face()); - res_v->set_is_equal_aux_data_in_face(1, v2->get_is_equal_data_in_face()); - res_v->set_has_equal_aux_data_in_face(0, v1->get_has_equal_data_in_face()); - res_v->set_has_equal_aux_data_in_face(1, v2->get_has_equal_data_in_face()); + res_v->set_is_equal_aux_data_in_face(0, v1->is_equal_env_data_in_face()); + res_v->set_is_equal_aux_data_in_face(1, v2->is_equal_env_data_in_face()); + res_v->set_has_equal_aux_data_in_face(0, v1->has_equal_env_data_in_face()); + res_v->set_has_equal_aux_data_in_face(1, v2->has_equal_env_data_in_face()); } } @@ -125,9 +125,9 @@ public: // the res_v is also isolated, and we should update the is_equal/has_equal // data in face information res_v->set_is_equal_aux_data_in_face(0, true); - res_v->set_is_equal_aux_data_in_face(1, v2->get_is_equal_data_in_face()); - res_v->set_has_equal_aux_data_in_face(0, !f1->has_no_data()); - res_v->set_has_equal_aux_data_in_face(1, v2->get_has_equal_data_in_face()); + res_v->set_is_equal_aux_data_in_face(1, v2->is_equal_env_data_in_face()); + res_v->set_has_equal_aux_data_in_face(0, ! f1->has_no_env_data()); + res_v->set_has_equal_aux_data_in_face(1, v2->has_equal_env_data_in_face()); } } @@ -140,10 +140,10 @@ public: if (v1->is_isolated()) { // the res_v is also isolated, and we should update the is_equal/has_equal // data in face information - res_v->set_is_equal_aux_data_in_face(0, v1->get_is_equal_data_in_face()); + res_v->set_is_equal_aux_data_in_face(0, v1->is_equal_env_data_in_face()); res_v->set_is_equal_aux_data_in_face(1, true); - res_v->set_has_equal_aux_data_in_face(0, v1->get_has_equal_data_in_face()); - res_v->set_has_equal_aux_data_in_face(1, !f2->has_no_data()); + res_v->set_has_equal_aux_data_in_face(0, v1->has_equal_env_data_in_face()); + res_v->set_has_equal_aux_data_in_face(1, ! f2->has_no_env_data()); } } @@ -157,19 +157,19 @@ public: res_h->twin()->set_aux_source(1, m_2.non_const_handle(h2->twin())); // update is_equal/has_equal data in face - res_h->set_is_equal_aux_data_in_face(0, h1->get_is_equal_data_in_face()); - res_h->set_is_equal_aux_data_in_face(1, h2->get_is_equal_data_in_face()); - res_h->set_has_equal_aux_data_in_face(0, h1->get_has_equal_data_in_face()); - res_h->set_has_equal_aux_data_in_face(1, h2->get_has_equal_data_in_face()); + res_h->set_is_equal_aux_data_in_face(0, h1->is_equal_env_data_in_face()); + res_h->set_is_equal_aux_data_in_face(1, h2->is_equal_env_data_in_face()); + res_h->set_has_equal_aux_data_in_face(0, h1->has_equal_env_data_in_face()); + res_h->set_has_equal_aux_data_in_face(1, h2->has_equal_env_data_in_face()); res_h->twin()->set_is_equal_aux_data_in_face(0, h1->twin()-> - get_is_equal_data_in_face()); + is_equal_env_data_in_face()); res_h->twin()->set_is_equal_aux_data_in_face(1, h2->twin()-> - get_is_equal_data_in_face()); + is_equal_env_data_in_face()); res_h->twin()->set_has_equal_aux_data_in_face(0, h1->twin()-> - get_has_equal_data_in_face()); + has_equal_env_data_in_face()); res_h->twin()->set_has_equal_aux_data_in_face(1, h2->twin()-> - get_has_equal_data_in_face()); + has_equal_env_data_in_face()); // update is_equal/has_equal data in target update_halfedge_flags_on_edge(res_h, m_1.non_const_handle(h1), 0); @@ -197,17 +197,17 @@ public: res_h->twin()->set_aux_source(1, m_2.non_const_handle(f2)); // update is_equal/has_equal data in face - res_h->set_is_equal_aux_data_in_face(0, h1->get_is_equal_data_in_face()); + res_h->set_is_equal_aux_data_in_face(0, h1->is_equal_env_data_in_face()); res_h->set_is_equal_aux_data_in_face(1, true); - res_h->set_has_equal_aux_data_in_face(0, h1->get_has_equal_data_in_face()); - res_h->set_has_equal_aux_data_in_face(1, !f2->has_no_data()); + res_h->set_has_equal_aux_data_in_face(0, h1->has_equal_env_data_in_face()); + res_h->set_has_equal_aux_data_in_face(1, ! f2->has_no_env_data()); res_h->twin()->set_is_equal_aux_data_in_face(0, h1->twin()-> - get_is_equal_data_in_face()); + is_equal_env_data_in_face()); res_h->twin()->set_is_equal_aux_data_in_face(1, true); res_h->twin()->set_has_equal_aux_data_in_face(0, h1->twin()-> - get_has_equal_data_in_face()); - res_h->twin()->set_has_equal_aux_data_in_face(1, !f2->has_no_data()); + has_equal_env_data_in_face()); + res_h->twin()->set_has_equal_aux_data_in_face(1, ! f2->has_no_env_data()); // update is_equal/has_equal data in target for the first source map update_halfedge_flags_on_edge(res_h, m_1.non_const_handle(h1), 0); @@ -234,14 +234,16 @@ public: // update halfedge-face flags of the new halfedge res_h->set_is_equal_aux_data_in_face(0, true); - res_h->set_is_equal_aux_data_in_face(1, h2->get_is_equal_data_in_face()); - res_h->set_has_equal_aux_data_in_face(0, !f1->has_no_data()); - res_h->set_has_equal_aux_data_in_face(1, h2->get_has_equal_data_in_face()); + res_h->set_is_equal_aux_data_in_face(1, h2->is_equal_env_data_in_face()); + res_h->set_has_equal_aux_data_in_face(0, ! f1->has_no_env_data()); + res_h->set_has_equal_aux_data_in_face(1, h2->has_equal_env_data_in_face()); res_h->twin()->set_is_equal_aux_data_in_face(0, true); - res_h->twin()->set_is_equal_aux_data_in_face(1, h2->twin()->get_is_equal_data_in_face()); - res_h->twin()->set_has_equal_aux_data_in_face(0, !f1->has_no_data()); - res_h->twin()->set_has_equal_aux_data_in_face(1, h2->twin()->get_has_equal_data_in_face()); + res_h->twin()->set_is_equal_aux_data_in_face + (1, h2->twin()->is_equal_env_data_in_face()); + res_h->twin()->set_has_equal_aux_data_in_face(0, ! f1->has_no_env_data()); + res_h->twin()->set_has_equal_aux_data_in_face + (1, h2->twin()->has_equal_env_data_in_face()); // update is_equal/has_equal data in target for the second source map update_halfedge_flags_on_edge(res_h, m_2.non_const_handle(h2), 1); @@ -261,8 +263,9 @@ protected: template void copy_halfedge_target_info(Halfedge_handle_t from, Res_halfedge_handle to, unsigned int id) { - to->set_is_equal_aux_data_in_target(id, from->get_is_equal_data_in_target()); - to->set_has_equal_aux_data_in_target(id, from->get_has_equal_data_in_target()); + to->set_is_equal_aux_data_in_target(id, from->is_equal_env_data_in_target()); + to->set_has_equal_aux_data_in_target + (id, from->has_equal_env_data_in_target()); } void set_halfedge_target_info(Res_halfedge_handle to, unsigned int id, bool info) { @@ -274,16 +277,17 @@ protected: void copy_halfedge_target_info_from_halfedge_face_info(Halfedge_handle_t from, Res_halfedge_handle to, unsigned int id) { - to->set_is_equal_aux_data_in_target(id, from->get_is_equal_data_in_face()); - to->set_has_equal_aux_data_in_target(id, from->get_has_equal_data_in_face()); - to->set_has_equal_aux_data_in_target_and_face(id, from->get_has_equal_data_in_face()); + to->set_is_equal_aux_data_in_target(id, from->is_equal_env_data_in_face()); + to->set_has_equal_aux_data_in_target(id, from->has_equal_env_data_in_face()); + to->set_has_equal_aux_data_in_target_and_face + (id, from->has_equal_env_data_in_face()); } template void copy_halfedge_target_info_from_vertex_face_info(Vertex_handle_t from, Res_halfedge_handle to, unsigned int id) { - to->set_is_equal_aux_data_in_target(id, from->get_is_equal_data_in_face()); - to->set_has_equal_aux_data_in_target(id, from->get_has_equal_data_in_face()); + to->set_is_equal_aux_data_in_target(id, from->is_equal_env_data_in_face()); + to->set_has_equal_aux_data_in_target(id, from->has_equal_env_data_in_face()); } // find a halfedge that v is its target and f is its face @@ -309,8 +313,7 @@ protected: traversed_vertices[Vertex_face_pair(v, hh->face())] = hh; // check for reult if (hh->face() == f) result = hh; - ++vc; - } while (vc != vc_begin); + } while (++vc != vc_begin); } else { // take it from the map @@ -329,21 +332,21 @@ protected: if(new_h->target()->is_at_open_boundary()) return; Vertex_handle vh; Halfedge_handle hh; - const Object& trg_src = new_h->target()->get_aux_source(id); + const Object& trg_src = new_h->target()->aux_source(id); if (assign(vh, trg_src)) { - // vh is the target of on_edge, and we can copy the halfedge-target information - // from on_edge + // vh is the target of on_edge, and we can copy the halfedge-target + // information from on_edge copy_halfedge_target_info(on_edge, new_h, id); new_h->set_has_equal_aux_data_in_target_and_face - (id, on_edge->get_has_equal_data_in_target_and_face()); + (id, on_edge->has_equal_env_data_in_target_and_face()); } else if (assign(hh, trg_src)) { // hh is the "HEMSHECH" of on_edge, so we need to set halfedge_target // information to true set_halfedge_target_info(new_h, id, true); - // and target-face information using the original halfedge-face information + // and target-face information using the original halfedge-face information new_h->set_has_equal_aux_data_in_target_and_face - (id, on_edge->get_has_equal_data_in_face()); + (id, on_edge->has_equal_env_data_in_face()); } else // this cannot happen, since we need to touch an edge @@ -361,34 +364,38 @@ protected: Halfedge_handle hh; Face_handle fh; // update target - const Object& trg_src = new_h->target()->get_aux_source(id); + const Object& trg_src = new_h->target()->aux_source(id); if (assign(vh, trg_src)) { if (vh->is_isolated()) { copy_halfedge_target_info_from_vertex_face_info(vh, new_h, id); // the target-face information is taken from vertex-face information too new_h->set_has_equal_aux_data_in_target_and_face - (id, vh->get_has_equal_data_in_face()); + (id, vh->has_equal_env_data_in_face()); } else { + // we have a vertex vh on the boundary of the face in_face // todo: get rid of this calculations: (using unknown value for // has_equal flag) - /*CGAL_assertion_code( - bool calc_is_equal = vh->is_equal_data(in_face->begin_data(), in_face->end_data()); - )*/ - //bool calc_has_equal = vh->has_equal_data(in_face->begin_data(), in_face->end_data()); + // CGAL_assertion_code( + // bool calc_is_equal = vh->is_equal_env_data(in_face->begin_env_data(), + // in_face->end_env_data()); + // ) + // + // bool calc_has_equal = vh->has_equal_env_data(in_face->begin_env_data(), + // in_face->end_env_data()); // find the halfedge with target vh on the boundary of in_face Halfedge_handle h_of_vh_and_in_face = find_halfedge_by_vertex_and_face(vh, in_face); // is_equal relationship is easy: - bool is_equal = h_of_vh_and_in_face->get_is_equal_data_in_face() && - h_of_vh_and_in_face->get_is_equal_data_in_target(); + bool is_equal = h_of_vh_and_in_face->is_equal_env_data_in_face() && + h_of_vh_and_in_face->is_equal_env_data_in_target(); //CGAL_assertion(is_equal == calc_is_equal); // has_equal relationship is problematic in one case: bool has_equal = - h_of_vh_and_in_face->get_has_equal_data_in_target_and_face(); + h_of_vh_and_in_face->has_equal_env_data_in_target_and_face(); /*CGAL_assertion(has_equal == calc_has_equal); if(has_equal != calc_has_equal) @@ -419,8 +426,8 @@ protected: // the face data CGAL_assertion(fh == in_face); new_h->set_is_equal_aux_data_in_target(id, true); - new_h->set_has_equal_aux_data_in_target(id, !fh->has_no_data()); - new_h->set_has_equal_aux_data_in_target_and_face(id, !fh->has_no_data()); + new_h->set_has_equal_aux_data_in_target(id, ! fh->has_no_env_data()); + new_h->set_has_equal_aux_data_in_target_and_face(id, ! fh->has_no_env_data()); } } diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_pm_dcel.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_pm_dcel.h index 999cdadc140..a7ecfc45f46 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_pm_dcel.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_pm_dcel.h @@ -36,7 +36,7 @@ public: protected: /*! data container */ - Data_container m_data; + Data_container m_env_data; /*! Indicates that the data (surfaces) have been set already */ bool m_is_set; @@ -48,14 +48,14 @@ public: Dcel_info() : m_is_set(false), m_decision(DAC_DECISION_NOT_SET) {} /*! \brief returns true iff data has been set already */ - bool get_is_set() const { return m_is_set; } + bool env_is_set() const { return m_is_set; } /*! \brief resets the flag */ void set_is_set(bool flag) { m_is_set = flag; } bool is_decision_set() { return (m_decision != DAC_DECISION_NOT_SET); } - Dac_decision get_decision() const { return m_decision; } + Dac_decision decision() const { return m_decision; } void set_decision(Comparison_result comp) { m_decision = enum_cast(comp); } @@ -63,55 +63,56 @@ public: void set_decision(Dac_decision dec) { m_decision = dec; } /*! User-friendly interface: */ - size_t number_of_surfaces() const { return m_data.size(); } + size_t number_of_surfaces() const { return m_env_data.size(); } - Data_const_iterator surfaces_begin() const { return m_data.begin(); } + Data_const_iterator surfaces_begin() const { return m_env_data.begin(); } - Data_const_iterator surfaces_end() const { return m_data.end(); } + Data_const_iterator surfaces_end() const { return m_env_data.end(); } /*! Obtain the first Xy-monotone surface associated with the face. * \pre number_of_surfaces() is not 0. */ const Data& surface() const { - CGAL_precondition(m_data.size() > 0); - return m_data.front(); + CGAL_precondition(m_env_data.size() > 0); + return m_env_data.front(); } - /*! Obtain the number of data objects associated with the face. + /*! Obtain the number of data objects associated with the cell. */ - int number_of_data_objects() const { return static_cast(m_data.size()); } + int env_data_size() const + { return static_cast(m_env_data.size()); } /*! Check whether the data is set to be empty */ - bool has_no_data() const - { return (m_is_set && (number_of_data_objects() == 0)); } + bool has_no_env_data() const + { return (m_is_set && (env_data_size() == 0)); } - /*! Obtain the first data object associated with the face. - * \pre number_of_data_objects() is not 0. + /*! Obtain the first data object associated with the cell. + * \pre m_env_data.size() is not 0. */ - const Data& get_env_data() const { - CGAL_precondition(m_data.size() > 0); - return m_data.front(); + const Data& env_data_front() const { + CGAL_precondition(m_env_data.size() > 0); + return m_env_data.front(); } /*! Obtain the data iterators (const version). */ - Data_const_iterator begin_data() const { return m_data.begin(); } + Data_const_iterator begin_env_data() const { return m_env_data.begin(); } - Data_const_iterator end_data() const { return m_data.end(); } + Data_const_iterator end_env_data() const { return m_env_data.end(); } /*! Obtain the data iterators (non-const version). */ - Data_iterator begin_data() { return m_data.begin(); } + Data_iterator begin_env_data() { return m_env_data.begin(); } - Data_iterator end_data() { return m_data.end(); } + Data_iterator end_env_data() { return m_env_data.end(); } /*! Set a data object to the face. * \param data The data object to set. */ void set_env_data(const Data& data) { - clear_data(); - add_data(data); + clear_env_data(); + add_env_data(data); } /*! Set a range of data objects to the face. @@ -120,22 +121,22 @@ public: */ template void set_env_data(InputIterator begin, InputIterator end) { - clear_data(); - add_data(begin, end); + clear_env_data(); + add_env_data(begin, end); } /*! set the data to be empty. */ - void set_no_data() { - clear_data(); + void set_no_env_data() { + clear_env_data(); m_is_set = true; } /*! Add a data object to the face. * \param data The additional data object. */ - void add_data(const Data& data) { - m_data.push_back(data); + void add_env_data(const Data& data) { + m_env_data.push_back(data); m_is_set = true; } @@ -144,15 +145,15 @@ public: * \param end A past-the-end iterator for the data range. */ template - void add_data(InputIterator begin, InputIterator end) { - for (auto it = begin; it != end; it++) m_data.push_back(*it); + void add_env_data(InputIterator begin, InputIterator end) { + for (auto it = begin; it != end; ++it) m_env_data.push_back(*it); m_is_set = true; } /*! Clear the data objects. */ - void clear_data() { - m_data.clear(); + void clear_env_data() { + m_env_data.clear(); m_is_set = false; } @@ -160,23 +161,23 @@ public: * set of data objects */ template - bool is_equal_data(InputIterator begin, InputIterator end) const { - if (! get_is_set()) return false; + bool is_equal_env_data(InputIterator begin, InputIterator end) const { + if (! env_is_set()) return false; // insert the input data objects into a set std::set input_data(begin, end); - std::set my_data(begin_data(), end_data()); + std::set my_data(begin_env_data(), end_env_data()); if (input_data.size() != my_data.size()) return false; return (my_data == input_data); } template - bool has_equal_data(InputIterator begin, InputIterator end) const { - if (! get_is_set()) return false; + bool has_equal_env_data(InputIterator begin, InputIterator end) const { + if (! env_is_set()) return false; // insert the input data objects into a set std::set input_data(begin, end); - std::set my_data(begin_data(), end_data()); + std::set my_data(begin_env_data(), end_env_data()); std::list intersection; std::set_intersection(my_data.begin(), my_data.end(), input_data.begin(), input_data.end(), @@ -185,7 +186,6 @@ public: } protected: - /*! Place holder for the source of the overlay data */ Object m_aux_source[2]; @@ -202,14 +202,14 @@ public: m_aux_source[id] = o; } - const Object& get_aux_source(unsigned int id) { + const Object& aux_source(unsigned int id) { CGAL_precondition(id < 2); CGAL_precondition (!m_aux_source[id].is_empty()); return m_aux_source[id]; } /*! \brief returns true iff the point has been set already */ - bool get_aux_is_set(unsigned int id) const { + bool aux_is_set(unsigned int id) const { CGAL_precondition(id < 2); return (! m_aux_source[id].is_empty()); } @@ -251,35 +251,25 @@ public: /*! Constructor */ Envelope_pm_vertex() : Dcel_info(), flags(0) {} - /*void set_is_fake(bool b) - { - set_bit(IS_FAKE, b); - } - bool get_is_fake() const - { - return get_bit(IS_FAKE); - }*/ + /* void set_is_fake(bool b) { set_bit(IS_FAKE, b); } + * bool is_fake() const { return get_bit(IS_FAKE); } + */ - /* void set_is_intersection(bool b) - { - set_bit(IS_INTERSECTION, b); - }*/ - /*bool get_is_intersection() const - { - return get_bit(IS_FAKE); - }*/ + /* void set_is_intersection(bool b) { set_bit(IS_INTERSECTION, b); } + * bool is_intersection() const { return get_bit(IS_FAKE); } + */ - void set_is_equal_data_in_face(bool b) { set_bit(IS_EQUAL, b); } - bool get_is_equal_data_in_face() const { return get_bit(IS_EQUAL); } + void set_is_equal_env_data_in_face(bool b) { set_bit(IS_EQUAL, b); } + bool is_equal_env_data_in_face() const { return get_bit(IS_EQUAL); } - void set_has_equal_data_in_face(bool b) { set_bit(HAS_EQUAL, b); } - bool get_has_equal_data_in_face() const { return get_bit(HAS_EQUAL); } + void set_has_equal_env_data_in_face(bool b) { set_bit(HAS_EQUAL, b); } + bool has_equal_env_data_in_face() const { return get_bit(HAS_EQUAL); } void set_is_equal_aux_data_in_face(unsigned int id, bool b) { CGAL_assertion(id < 2); set_bit(IS_EQUAL_AUX+id, b); } - bool get_is_equal_aux_data_in_face(unsigned int id) const { + bool is_equal_aux_data_in_face(unsigned int id) const { CGAL_assertion(id < 2); return get_bit(IS_EQUAL_AUX+id); } @@ -288,7 +278,7 @@ public: CGAL_assertion(id < 2); set_bit(HAS_EQUAL_AUX+id, b); } - bool get_has_equal_aux_data_in_face(unsigned int id) const { + bool has_equal_aux_data_in_face(unsigned int id) const { CGAL_assertion(id < 2); return get_bit(HAS_EQUAL_AUX+id); } @@ -359,26 +349,21 @@ public: Envelope_pm_halfedge() : Dcel_info(), flags(0) {} - /* void set_is_fake(bool b) - { - set_bit(IS_FAKE, b); - } - bool get_is_fake() const - { - return get_bit(IS_FAKE); - }*/ + /* void set_is_fake(bool b) { set_bit(IS_FAKE, b); } + * bool is_fake() const { return get_bit(IS_FAKE); } + */ - void set_is_equal_data_in_face(bool b) { set_bit(IS_EQUAL_FACE, b); } - bool get_is_equal_data_in_face() const { return get_bit(IS_EQUAL_FACE); } + void set_is_equal_env_data_in_face(bool b) { set_bit(IS_EQUAL_FACE, b); } + bool is_equal_env_data_in_face() const { return get_bit(IS_EQUAL_FACE); } - void set_has_equal_data_in_face(bool b) { set_bit(HAS_EQUAL_FACE, b); } - bool get_has_equal_data_in_face() const { return get_bit(HAS_EQUAL_FACE); } + void set_has_equal_env_data_in_face(bool b) { set_bit(HAS_EQUAL_FACE, b); } + bool has_equal_env_data_in_face() const { return get_bit(HAS_EQUAL_FACE); } void set_is_equal_aux_data_in_face(unsigned int id, bool b) { CGAL_assertion(id < 2); set_bit(IS_EQUAL_AUX_FACE+id, b); } - bool get_is_equal_aux_data_in_face(unsigned int id) const { + bool is_equal_aux_data_in_face(unsigned int id) const { CGAL_assertion(id < 2); return get_bit(IS_EQUAL_AUX_FACE+id); } @@ -387,22 +372,22 @@ public: CGAL_assertion(id < 2); set_bit(HAS_EQUAL_AUX_FACE+id, b); } - bool get_has_equal_aux_data_in_face(unsigned int id) const { + bool has_equal_aux_data_in_face(unsigned int id) const { CGAL_assertion(id < 2); return get_bit(HAS_EQUAL_AUX_FACE+id); } - void set_is_equal_data_in_target(bool b) { set_bit(IS_EQUAL_TARGET, b); } - bool get_is_equal_data_in_target() const { return get_bit(IS_EQUAL_TARGET); } + void set_is_equal_env_data_in_target(bool b) { set_bit(IS_EQUAL_TARGET, b); } + bool is_equal_env_data_in_target() const { return get_bit(IS_EQUAL_TARGET); } - void set_has_equal_data_in_target(bool b) { set_bit(HAS_EQUAL_TARGET, b); } - bool get_has_equal_data_in_target() const { return get_bit(HAS_EQUAL_TARGET); } + void set_has_equal_env_data_in_target(bool b) { set_bit(HAS_EQUAL_TARGET, b); } + bool has_equal_env_data_in_target() const { return get_bit(HAS_EQUAL_TARGET); } void set_is_equal_aux_data_in_target(unsigned int id, bool b) { CGAL_assertion(id < 2); set_bit(IS_EQUAL_AUX_TARGET+id, b); } - bool get_is_equal_aux_data_in_target(unsigned int id) const { + bool is_equal_aux_data_in_target(unsigned int id) const { CGAL_assertion(id < 2); return get_bit(IS_EQUAL_AUX_TARGET+id); } @@ -411,21 +396,21 @@ public: CGAL_assertion(id < 2); set_bit(HAS_EQUAL_AUX_TARGET+id, b); } - bool get_has_equal_aux_data_in_target(unsigned int id) const { + bool has_equal_aux_data_in_target(unsigned int id) const { CGAL_assertion(id < 2); return get_bit(HAS_EQUAL_AUX_TARGET+id); } // access to flags that contain relation between target and face - void set_has_equal_data_in_target_and_face(bool b) + void set_has_equal_env_data_in_target_and_face(bool b) { set_bit(HAS_EQUAL_F_T, b); } - bool get_has_equal_data_in_target_and_face() const + bool has_equal_env_data_in_target_and_face() const { return get_bit(HAS_EQUAL_F_T); } void set_has_equal_aux_data_in_target_and_face(unsigned int id, bool b) { CGAL_assertion(id < 2); set_bit(HAS_EQUAL_AUX_F_T+id, b); } - bool get_has_equal_aux_data_in_target_and_face(unsigned int id) const { + bool has_equal_aux_data_in_target_and_face(unsigned int id) const { CGAL_assertion(id < 2); return get_bit(HAS_EQUAL_AUX_F_T+id); } diff --git a/Envelope_3/test/Envelope_3/Envelope_test_3.h b/Envelope_3/test/Envelope_3/Envelope_test_3.h index 37c70646365..cce5cc4656a 100644 --- a/Envelope_3/test/Envelope_3/Envelope_test_3.h +++ b/Envelope_3/test/Envelope_3/Envelope_test_3.h @@ -124,34 +124,37 @@ public: Xy_monotone_surface_3& prev_surface = surfaces[j]; std::vector> inter_objs; - traits.construct_projected_intersections_2_object()(cur_surface, prev_surface, std::back_inserter(inter_objs)); + traits.construct_projected_intersections_2_object() + (cur_surface, prev_surface, std::back_inserter(inter_objs)); // we collect all intersections and use sweep to insert them for (std::size_t k = 0; k < inter_objs.size(); ++k) { if (const Point_2* point = std::get_if(&inter_objs[k])) { - #ifdef CGAL_DEBUG_ENVELOPE_TEST_3 - std::cout << "intersection between surfaces is a point: " - << point << std::endl; - #endif +#ifdef CGAL_DEBUG_ENVELOPE_TEST_3 + std::cout << "intersection between surfaces is a point: " + << point << std::endl; +#endif //insert_vertex(result, point, pl); points_col.push_back(*point); } else if (const auto* curve = std::get_if(&inter_objs[k])) { curves_col.push_back(curve->first); - /*#ifdef CGAL_DEBUG_ENVELOPE_TEST_3 - std::cout << "intersection between surfaces is a curve: " << curve.first << std::endl; - #endif - std::list objs; - traits.make_x_monotone_2_object()(curve.first, std::back_inserter(objs)); - std::list::iterator itr; - for(itr = objs.begin(); itr != objs.end(); ++itr) - { - X_monotone_curve_2 curr_cv; - assert(assign(curr_cv, *itr)); - assign(curr_cv, *itr); - curves_col.push_back(curr_cv); - }*/ + /* #ifdef CGAL_DEBUG_ENVELOPE_TEST_3 + * std::cout << "intersection between surfaces is a curve: " + * << curve.first << std::endl; + * #endif + * std::list objs; + * traits.make_x_monotone_2_object()(curve.first, + * std::back_inserter(objs)); + * std::list::iterator itr; + * for(itr = objs.begin(); itr != objs.end(); ++itr) { + * X_monotone_curve_2 curr_cv; + * assert(assign(curr_cv, *itr)); + * assign(curr_cv, *itr); + * curves_col.push_back(curr_cv); + * } + */ //insert(result, curve.first, pl); } else assert_msg(false, "wrong intersection type"); @@ -167,7 +170,8 @@ public: m_result = &result; - // now, foreach vertex, edge and face, we should determine which surfaces are minimal over it. + // now, foreach vertex, edge and face, we should determine which surfaces + // are minimal over it. // update vertices' data for (auto vi = result.vertices_begin(); vi != result.vertices_end(); ++vi) { @@ -242,16 +246,16 @@ protected: template void set_minimum_over_vertex(const Vertex_handle& v, SurfaceIterator begin, SurfaceIterator end) { - if (begin == end) v->set_no_data(); + if (begin == end) v->set_no_env_data(); else { auto si = begin; // we set the first surface as the minimum, and then compare all the others v->set_env_data(*si); ++si; for (; si != end; ++si) { - Comparison_result cr = - traits.compare_z_at_xy_3_object()(v->point(), v->get_env_data(), *si); - if (cr == EQUAL) v->add_data(*si); + auto cr = traits.compare_z_at_xy_3_object()(v->point(), + v->env_data_front(), *si); + if (cr == EQUAL) v->add_env_data(*si); // this erases all surfaces from vertex's list else if (cr == LARGER) v->set_env_data(*si); // else - new surface has no affect on the envelope @@ -264,7 +268,7 @@ protected: template void set_minimum_over_edge(const Halfedge_handle& h, SurfaceIterator begin, SurfaceIterator end) { - if (begin == end) h->set_no_data(); + if (begin == end) h->set_no_env_data(); else { if (h != current_edge) compute_point_in_current_edge(h); @@ -273,16 +277,15 @@ protected: h->set_env_data(*si); ++si; for (; si != end; ++si) { - Comparison_result cr = - traits.compare_z_at_xy_3_object()(current_point_inside_edge, - h->get_env_data(), *si); - if (cr == EQUAL) h->add_data(*si); + auto cr = traits.compare_z_at_xy_3_object()(current_point_inside_edge, + h->env_data_front(), *si); + if (cr == EQUAL) h->add_env_data(*si); // this erases all surfaces from halfedge's list else if (cr == LARGER) h->set_env_data(*si); // else - new surface has no affect on the envelope } // set twin's data - h->twin()->set_env_data(h->begin_data(), h->end_data()); + h->twin()->set_env_data(h->begin_env_data(), h->end_env_data()); } } @@ -295,7 +298,7 @@ protected: if (face->is_unbounded() || begin == end) { // a special case - no surface over the unbounded face, and when there // are no surfaces at all - face->set_no_data(); + face->set_no_env_data(); } else { auto si = begin; @@ -303,9 +306,8 @@ protected: face->set_env_data(*si); ++si; for (; si != end; ++si) { - Comparison_result cr = - compare_surfaces_over_face(face, face->get_env_data(), *si); - if (cr == EQUAL) face->add_data(*si); + auto cr = compare_surfaces_over_face(face, face->env_data_front(), *si); + if (cr == EQUAL) face->add_env_data(*si); // this erases all surfaces from face's list else if (cr == LARGER) face->set_env_data(*si); // else - new surface has no affect on the envelope @@ -329,7 +331,8 @@ protected: cur_res = traits.compare_z_at_xy_3_object()(current_point,surf1,surf2); #ifdef CGAL_DEBUG_ENVELOPE_TEST_3 - std::cout << "for comparison inside face, current result = " << cur_res << std::endl; + std::cout << "for comparison inside face, current result = " << cur_res + << std::endl; #endif return cur_res; @@ -366,7 +369,7 @@ protected: assert(! face->is_unbounded()); #ifdef CGAL_DEBUG_ENVELOPE_TEST_3 - std::cout << "in compute point inside face" << std::endl; + std::cout << "in compute point inside face" << std::endl; #endif // 1. find an edge on the outer ccb of the face that is not vertical @@ -374,12 +377,12 @@ protected: Ccb_halfedge_circulator hec_begin = hec; bool found = false; do { - if (!traits.is_vertical_2_object()(hec->curve())) { + if (! traits.is_vertical_2_object()(hec->curve())) { found = true; continue; } - hec++; - } while(hec != hec_begin && !found); + ++hec; + } while ((hec != hec_begin) && ! found); assert(found); Halfedge_handle found_hh = hec; @@ -388,10 +391,10 @@ protected: // (we use the middle of the curve) Point_2 shoot_source = traits.construct_middle_point(found_hh->curve()); - // 3. ray shoot up or down, into the face - // and find the intersection point of the ray. the segment between - // the point from which we shoot, and the intersection point lies - // inside the face. we take its middle point as a point inside the face + // 3. ray shoot up or down, into the face and find the intersection point + // of the ray. the segment between the point from which we shoot, + // and the intersection point lies inside the face. + // we take its middle point as a point inside the face bool shoot_up = true; // TODO_NEW_DESIGN - check this // if (traits.compare_x(found_hh->source()->point(), found_hh->target()->point()) == LARGER) @@ -418,20 +421,19 @@ protected: Point_2 res_point = traits.construct_middle_point(shoot_source, shoot_target); - #ifdef CGAL_DEBUG_ENVELOPE_TEST_3 - std::cout << "finished computing point in face" << std::endl; +#ifdef CGAL_DEBUG_ENVELOPE_TEST_3 + std::cout << "finished computing point in face" << std::endl; - // just for checking, locate res_point in env to find face - Object test_pl_obj = pl.locate(res_point); - Face_const_handle test_fh; - assert(assign(test_fh, test_pl_obj)); - assert(test_fh == face); - #endif + // just for checking, locate res_point in env to find face + Object test_pl_obj = pl.locate(res_point); + Face_const_handle test_fh; + assert(assign(test_fh, test_pl_obj)); + assert(test_fh == face); +#endif return res_point; } - // compute a point inside the face saved in current_face // and put the result into current_point void compute_point_in_current_face(Face_handle face) { diff --git a/Envelope_3/test/Envelope_3/Envelope_test_overlay_functor.h b/Envelope_3/test/Envelope_3/Envelope_test_overlay_functor.h index 20cbfbcafb5..aab1b001918 100644 --- a/Envelope_3/test/Envelope_3/Envelope_test_overlay_functor.h +++ b/Envelope_3/test/Envelope_3/Envelope_test_overlay_functor.h @@ -56,7 +56,7 @@ public: void create_face (Face_handle1 f1, Face_handle2 f2, Res_face_handle res_f) { res_f->set_aux_source(0, f1); res_f->set_aux_source(1, f2); - assert_msg(f1->is_equal_data(f2->begin_data(), f2->end_data()), + assert_msg(f1->is_equal_env_data(f2->begin_env_data(), f2->end_env_data()), "data different over face"); } @@ -64,7 +64,7 @@ public: Res_vertex_handle res_v) { res_v->set_aux_source(0, h1); res_v->set_aux_source(1, h2); - assert_msg(h1->is_equal_data(h2->begin_data(), h2->end_data()), + assert_msg(h1->is_equal_env_data(h2->begin_env_data(), h2->end_env_data()), "data different over vertex"); } @@ -72,40 +72,40 @@ public: Res_vertex_handle res_v) { res_v->set_aux_source(0, v1); res_v->set_aux_source(1, v2); - assert_msg(v1->is_equal_data(v2->begin_data(), v2->end_data()), - "data different over vertex"); + assert_msg(v1->is_equal_env_data(v2->begin_env_data(), v2->end_env_data()), + "data different over vertex"); } void create_vertex(Vertex_handle1 v1, Halfedge_handle2 h2, Res_vertex_handle res_v) { res_v->set_aux_source(0, v1); res_v->set_aux_source(1, h2); - assert_msg(v1->is_equal_data(h2->begin_data(), h2->end_data()), - "data different over vertex"); + assert_msg(v1->is_equal_env_data(h2->begin_env_data(), h2->end_env_data()), + "data different over vertex"); } void create_vertex(Halfedge_handle1 h1, Vertex_handle2 v2, Res_vertex_handle res_v) { res_v->set_aux_source(0, h1); res_v->set_aux_source(1, v2); - assert_msg(h1->is_equal_data(v2->begin_data(), v2->end_data()), - "data different over vertex"); + assert_msg(h1->is_equal_env_data(v2->begin_env_data(), v2->end_env_data()), + "data different over vertex"); } void create_vertex(Face_handle1 f1, Vertex_handle2 v2, Res_vertex_handle res_v) { res_v->set_aux_source(0, f1); res_v->set_aux_source(1, v2); - assert_msg(f1->is_equal_data(v2->begin_data(), v2->end_data()), - "data different over vertex"); + assert_msg(f1->is_equal_env_data(v2->begin_env_data(), v2->end_env_data()), + "data different over vertex"); } void create_vertex(Vertex_handle1 v1, Face_handle2 f2, Res_vertex_handle res_v) { res_v->set_aux_source(0, v1); res_v->set_aux_source(1, f2); - assert_msg(v1->is_equal_data(f2->begin_data(), f2->end_data()), - "data different over vertex"); + assert_msg(v1->is_equal_env_data(f2->begin_env_data(), f2->end_env_data()), + "data different over vertex"); } void create_edge(Halfedge_handle1 h1, Halfedge_handle2 h2, @@ -116,8 +116,8 @@ public: res_h->twin()->set_aux_source(0, h1->twin()); res_h->twin()->set_aux_source(1, h2->twin()); - assert_msg(h1->is_equal_data(h2->begin_data(), h2->end_data()), - "data different over edge"); + assert_msg(h1->is_equal_env_data(h2->begin_env_data(), h2->end_env_data()), + "data different over edge"); } void create_edge(Halfedge_handle1 h1, Face_handle2 f2, @@ -128,8 +128,8 @@ public: res_h->twin()->set_aux_source(0, h1->twin()); res_h->twin()->set_aux_source(1, f2); - assert_msg(h1->is_equal_data(f2->begin_data(), f2->end_data()), - "data different over edge"); + assert_msg(h1->is_equal_env_data(f2->begin_env_data(), f2->end_env_data()), + "data different over edge"); } void create_edge(Face_handle1 f1, Halfedge_handle2 h2, @@ -139,11 +139,9 @@ public: res_h->twin()->set_aux_source(0, f1); res_h->twin()->set_aux_source(1, h2->twin()); - assert_msg(f1->is_equal_data(h2->begin_data(), h2->end_data()), - "data different over edge"); - + assert_msg(f1->is_equal_env_data(h2->begin_env_data(), h2->end_env_data()), + "data different over edge"); } - }; } //namespace CGAL diff --git a/Envelope_3/test/Envelope_3/Envelope_triangles_test_3.h b/Envelope_3/test/Envelope_3/Envelope_triangles_test_3.h index 84a83a62d8a..6eec83590a9 100644 --- a/Envelope_3/test/Envelope_3/Envelope_triangles_test_3.h +++ b/Envelope_3/test/Envelope_3/Envelope_triangles_test_3.h @@ -176,9 +176,8 @@ public: Vertex_handle vh = vi; // first we find the surfaces that are defined over the vertex std::list defined_surfaces; - typename Traits::Is_defined_over is_defined_over = - traits.is_defined_over_object(); - for(std::size_t i=0; ipoint(), surfaces[i])) defined_surfaces.push_back(surfaces[i]); @@ -229,7 +228,7 @@ public: // foreach face in the test envelope, compute a point inside the face, // locate it in the other envelope and compare the surfaces over the 2 faces Md2_point_location pl(env); - bool eq, result = true; + bool result = true; for (auto fi = test_env.faces_begin(); fi != test_env.faces_end(); ++fi) { Face_handle fh = fi; if (! fh->is_unbounded()) { @@ -237,8 +236,9 @@ public: auto pl_obj = pl.locate(inside_test); // faces of env must contain the faces of test const Face_const_handle* pl_fh = std::get_if(&pl_obj); - assert(pl_fh!=nullptr); - eq = fh->is_equal_data((*pl_fh)->begin_data(), (*pl_fh)->end_data()); + assert(pl_fh != nullptr); + auto eq = fh->is_equal_env_data((*pl_fh)->begin_env_data(), + (*pl_fh)->end_env_data()); assert(eq); result &= eq; } @@ -265,16 +265,16 @@ protected: template void set_minimum_over_vertex(Vertex_handle v, SurfaceIterator begin, SurfaceIterator end) { - if (begin == end) v->set_no_data(); + if (begin == end) v->set_no_env_data(); else { auto si = begin; // we set the first surface as the minimum, and then compare all the others v->set_env_data(*si); ++si; for (; si != end; ++si) { - Comparison_result cr = - traits.compare_z_at_xy_3_object()(v->point(), v->get_env_data(), *si); - if (cr == EQUAL) v->add_data(*si); + auto cr = traits.compare_z_at_xy_3_object()(v->point(), + v->env_data_front(), *si); + if (cr == EQUAL) v->add_env_data(*si); // this erases all surfaces from vertex's list else if (cr == LARGER) v->set_env_data(*si); // else - new surface has no affect on the envelope @@ -287,7 +287,7 @@ protected: template void set_minimum_over_edge(const Halfedge_handle& h, SurfaceIterator begin, SurfaceIterator end) { - if (begin == end) h->set_no_data(); + if (begin == end) h->set_no_env_data(); else { if (h != current_edge) compute_point_in_current_edge(h); @@ -296,16 +296,15 @@ protected: h->set_env_data(*si); ++si; for (; si != end; ++si) { - Comparison_result cr = - traits.compare_z_at_xy_3_object()(current_point_inside_edge, - h->get_env_data(), *si); - if (cr == EQUAL) h->add_data(*si); + auto cr = traits.compare_z_at_xy_3_object()(current_point_inside_edge, + h->env_data_front(), *si); + if (cr == EQUAL) h->add_env_data(*si); // this erases all surfaces from halfedge's list else if (cr == LARGER) h->set_env_data(*si); // else - new surface has no affect on the envelope } // set twin's data - h->twin()->set_env_data(h->begin_data(), h->end_data()); + h->twin()->set_env_data(h->begin_env_data(), h->end_env_data()); } } // fill the face with the surface on the envelope @@ -317,7 +316,7 @@ protected: if (face->is_unbounded() || begin == end) { // a special case - no surface over the unbounded face, and when there // are no surfaces at all - face->set_no_data(); + face->set_no_env_data(); } else { auto si = begin; @@ -326,9 +325,8 @@ protected: face->set_env_data(*si); ++si; for (; si != end; ++si) { - Comparison_result cr = - compare_surfaces_over_face(face, face->get_env_data(), *si); - if (cr == EQUAL) face->add_data(*si); + auto cr = compare_surfaces_over_face(face, face->env_data_front(), *si); + if (cr == EQUAL) face->add_env_data(*si); // this erases all surfaces from face's list else if (cr == LARGER) face->set_env_data(*si); // else - new surface has no affect on the envelope @@ -392,10 +390,9 @@ protected: << cur_res << std::endl; #endif - if (cur_res != EQUAL) - found_not_equal = true; - hec++; - } while(hec != hec_begin && !found_not_equal); + if (cur_res != EQUAL) found_not_equal = true; + ++hec; + } while ((hec != hec_begin) && ! found_not_equal); // std::cout << "for comparison on vertices, result = " << cur_res // << std::endl; @@ -482,11 +479,11 @@ protected: #endif result &= tmp_result; - hec++; - } while(hec != hec_begin && result); + ++hec; + } while ((hec != hec_begin) && result); } - if (result == false) return result; + if (! result) return result; // check vertices on holes boundary Hole_iterator hi; @@ -502,9 +499,9 @@ protected: #endif result &= tmp_result; - hec++; - } while(hec != hec_begin && result); - if (result == false) return result; + ++hec; + } while ((hec != hec_begin) && result); + if (! result) return result; } return result; @@ -540,8 +537,8 @@ protected: found = true; continue; } - hec++; - } while (hec != hec_begin && !found); + ++hec; + } while ((hec != hec_begin) && !found); assert(found); Halfedge_handle found_hh = hec;