📄 envelope_overlay_functor.h
字号:
// Copyright (c) 2005 Tel-Aviv University (Israel).// All rights reserved.//// This file is part of CGAL (www.cgal.org); you may redistribute it under// the terms of the Q Public License version 1.0.// See the file LICENSE.QPL distributed with CGAL.//// Licensees holding a valid commercial license may use this file in// accordance with the commercial license agreement provided with the software.//// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.//// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.3-branch/Envelope_3/include/CGAL/Envelope_3/Envelope_overlay_functor.h $// $Id: Envelope_overlay_functor.h 37895 2007-04-03 18:32:55Z efif $//// Author(s) : Michal Meyerovitch <gorgymic@post.tau.ac.il>// Baruch Zukerman <baruchzu@post.tau.ac.il>#ifndef CGAL_ENVELOPE_OVERLAY_FUNCTOR_H#define CGAL_ENVELOPE_OVERLAY_FUNCTOR_H#include <iostream>CGAL_BEGIN_NAMESPACEtemplate < class MinimizationDiagram_2>class Envelope_overlay_functor{public: typedef MinimizationDiagram_2 Minimization_diagram_2; typedef typename Minimization_diagram_2::Face_const_handle Face_const_handle1; typedef typename Minimization_diagram_2::Face_const_handle Face_const_handle2; typedef typename Minimization_diagram_2::Vertex_const_handle Vertex_const_handle1; typedef typename Minimization_diagram_2::Vertex_const_handle Vertex_const_handle2; typedef typename Minimization_diagram_2::Halfedge_const_handle Halfedge_const_handle1; typedef typename Minimization_diagram_2::Halfedge_const_handle Halfedge_const_handle2; typedef typename Minimization_diagram_2::Face_handle Face_handle; typedef typename Minimization_diagram_2::Vertex_handle Vertex_handle; typedef typename Minimization_diagram_2::Halfedge_handle Halfedge_handle; typedef typename Minimization_diagram_2::Face_handle Res_face_handle; typedef typename Minimization_diagram_2::Halfedge_handle Res_halfedge_handle; typedef typename Minimization_diagram_2::Vertex_handle Res_vertex_handle;protected: typedef typename Minimization_diagram_2::Dcel::Dcel_data_iterator Envelope_data_iterator; typedef std::pair<Vertex_handle, Face_handle> Vertex_face_pair; struct Less_vertex_face_pair { bool operator() (const Vertex_face_pair& vf1, const Vertex_face_pair& vf2) const { Vertex_handle v1 = vf1.first, v2 = vf2.first; Face_handle f1 = vf1.second, f2= vf2.second; return (&*v1 < &*v2 || (&*v1 == &*v2 && &*f1 < &*f2)); } }; typedef std::map<Vertex_face_pair, Halfedge_handle, Less_vertex_face_pair> Boundary_cache;public: Envelope_overlay_functor(Minimization_diagram_2& md1, Minimization_diagram_2& md2, Minimization_diagram_2& result) : m_1(md1), m_2(md2), m_result(result) { } ~Envelope_overlay_functor() { traversed_vertices.clear(); } void create_face (Face_const_handle1 f1, Face_const_handle2 f2, Res_face_handle res_f) { res_f->set_aux_source(0, m_1.non_const_handle(f1)); res_f->set_aux_source(1, m_2.non_const_handle(f2)); } void create_vertex(Halfedge_const_handle1 h1, Halfedge_const_handle2 h2, Res_vertex_handle res_v) { res_v->set_aux_source(0, m_1.non_const_handle(h1)); res_v->set_aux_source(1, m_2.non_const_handle(h2)); //res_v->set_is_intersection(true); // res_v cannot be isolated } void create_vertex(Vertex_const_handle1 v1, Vertex_const_handle2 v2, Res_vertex_handle res_v) { res_v->set_aux_source(0, m_1.non_const_handle(v1)); res_v->set_aux_source(1, m_2.non_const_handle(v2)); //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()); } } void create_vertex(Vertex_const_handle1 v1, Halfedge_const_handle2 h2, Res_vertex_handle res_v) { res_v->set_aux_source(0, m_1.non_const_handle(v1)); res_v->set_aux_source(1, m_2.non_const_handle(h2)); //res_v->set_is_intersection(true); // res_v cannot be isolated } void create_vertex(Halfedge_const_handle1 h1, Vertex_const_handle2 v2, Res_vertex_handle res_v) { res_v->set_aux_source(0, m_1.non_const_handle(h1)); res_v->set_aux_source(1, m_2.non_const_handle(v2)); //res_v->set_is_intersection(true); // res_v cannot be isolated } void create_vertex(Face_const_handle1 f1, Vertex_const_handle2 v2, Res_vertex_handle res_v) { res_v->set_aux_source(0, m_1.non_const_handle(f1)); res_v->set_aux_source(1, m_2.non_const_handle(v2)); //res_v->set_is_intersection(false); if (v2->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, 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()); } } void create_vertex(Vertex_const_handle1 v1, Face_const_handle2 f2, Res_vertex_handle res_v) { res_v->set_aux_source(0, m_1.non_const_handle(v1)); res_v->set_aux_source(1, m_2.non_const_handle(f2)); //res_v->set_is_intersection(false); 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(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()); } } void create_edge(Halfedge_const_handle1 h1, Halfedge_const_handle2 h2, Res_halfedge_handle res_h) { // update source res_h->set_aux_source(0, m_1.non_const_handle(h1)); res_h->set_aux_source(1, m_2.non_const_handle(h2)); res_h->twin()->set_aux_source(0, m_1.non_const_handle(h1->twin())); 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->twin()->set_is_equal_aux_data_in_face(0, h1->twin()->get_is_equal_data_in_face()); 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, h1->twin()->get_has_equal_data_in_face()); res_h->twin()->set_has_equal_aux_data_in_face(1, h2->twin()->get_has_equal_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); // update aux_data(1) update_halfedge_flags_on_edge(res_h, m_2.non_const_handle(h2), 1); // update is_equal/has_equal data in source // update aux_data(0) update_halfedge_flags_on_edge(res_h->twin(), m_1.non_const_handle(h1->twin()), 0); // update aux_data(1) update_halfedge_flags_on_edge(res_h->twin(), m_2.non_const_handle(h2->twin()), 1); } void create_edge(Halfedge_const_handle1 h1, Face_const_handle2 f2, Res_halfedge_handle res_h) { res_h->set_aux_source(0, m_1.non_const_handle(h1)); res_h->set_aux_source(1, m_2.non_const_handle(f2)); res_h->twin()->set_aux_source(0, m_1.non_const_handle(h1->twin())); 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(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->twin()->set_is_equal_aux_data_in_face(0, h1->twin()->get_is_equal_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()); // 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); // update source update_halfedge_flags_on_edge(res_h->twin(), m_1.non_const_handle(h1->twin()), 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -