From d9944b59eaa30b269fb846621935a7b867c48cf9 Mon Sep 17 00:00:00 2001 From: Michal Meyerovitch Date: Sun, 26 Feb 2006 08:01:44 +0000 Subject: [PATCH] Added additional flag in a halfedge, to indicate whether its target and face have equal surface (i.e., are continuous) on the envelope. This enables the removal of comparison between lists of surfaces, thus the removal of "operator < for xy-monotone surface" from the traits concept (when not using any cache). --- Envelope_3/include/CGAL/Envelope_pm_dcel.h | 215 ++++----------------- 1 file changed, 40 insertions(+), 175 deletions(-) diff --git a/Envelope_3/include/CGAL/Envelope_pm_dcel.h b/Envelope_3/include/CGAL/Envelope_pm_dcel.h index 0e5d49bdfb7..599365d0de5 100644 --- a/Envelope_3/include/CGAL/Envelope_pm_dcel.h +++ b/Envelope_3/include/CGAL/Envelope_pm_dcel.h @@ -11,9 +11,9 @@ // 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$ -// $Id$ -// +// $Source: /CVSROOT/CGAL/Packages/Envelope_3/include/CGAL/Envelope_pm_dcel.h,v $ +// $Revision$ $Date$ +// $Name: $ // // Author(s) : Michal Meyerovitch @@ -136,7 +136,6 @@ public: return (m_data.end()); } - /*! * Set a data object to the face. * \param data The data object to set. @@ -210,20 +209,6 @@ public: { if (!get_is_set()) return false; -// // insert all input data into a map, then try to find there all our data -// Unique_hash_map input_data; -// InputIterator input = begin; -// int input_size = 0; -// for(; input != end; ++input, ++input_size) -// input_data[*input] = true; -// if (input_size != number_of_data_objects()) -// return false; -// Data_const_iterator my_data = begin_data(); -// for(; my_data != end_data(); ++my_data) -// if (!input_data.is_defined(*my_data)) -// return false; -// -// return true; // insert the input data objects into a set std::set input_data(begin, end); @@ -253,9 +238,6 @@ protected: /*! Place holder for the source of the overlay data */ Object m_aux_source[2]; -// /*! Indicates that the overlay data (surfaces) have been set already */ -// bool m_aux_is_set[2]; - public: template void set_aux_source(unsigned int id, HandleType h) @@ -277,117 +259,20 @@ public: return m_aux_source[id]; } -// /*! -// * Get the number of aux data objects associated with the face. -// */ -// int number_of_aux_data_objects(unsigned int id) const -// { -// CGAL_precondition(id < 2); -// if (!m_aux_is_set[id]) return 0; -// return ((Self*)(m_aux_source[id]))->number_of_data_objects(); -// } -// -// /*! \bried obtains idth map data */ -// const Data & get_aux_data(unsigned int id) const -// { -// CGAL_precondition(id < 2); -// CGAL_precondition (m_aux_is_set[id]); -// return ((Self*)(m_aux_source[id]))->get_data(); -// } -// -// /*! \bried Get the auxiliary data iterators (const version). */ -// Data_const_iterator begin_aux_data(unsigned int id) const -// { -// CGAL_precondition(id < 2); -// return ((Self*)(m_aux_source[id]))->begin_data(); -// } -// -// Data_const_iterator end_aux_data(unsigned int id) const -// { -// CGAL_precondition(id < 2); -// return ((Self*)(m_aux_source[id]))->end_data(); -// } -// -// /*! \bried Get the auxiliary data iterators (non-const version). */ -// Data_iterator begin_aux_data(unsigned int id) -// { -// CGAL_precondition(id < 2); -// return ((Self*)(m_aux_source[id]))->begin_data(); -// } -// -// Data_iterator end_aux_data(unsigned int id) -// { -// CGAL_precondition(id < 2); -// return ((Self*)(m_aux_source[id]))->end_data(); -// } - /*! \brief returns true iff the point has been set already */ bool get_aux_is_set(unsigned int id) const { CGAL_precondition(id < 2); return (!m_aux_source[id].is_empty()); -// return m_aux_is_set[id]; } - -// /*! check if aux data is set to be empty */ -// bool aux_has_no_data(unsigned int id) const -// { -// CGAL_precondition(id < 2); -// return (m_aux_is_set[id] && ((Self*)(m_aux_source[id]))->has_no_data()); -// } -// -// /*! -// * Check if the set of data objects in the input range is equal to our -// * aux set of data objects -// */ -// template -// bool is_equal_aux_data(unsigned int id, const InputIterator & begin, -// const InputIterator & end) const -// { -// CGAL_precondition(id < 2); -// if (!get_aux_is_set(id)) -// return false; -// // insert the input data objects into a set -// std::set input_data(begin, end); -// std::set my_data(begin_aux_data(id), end_aux_data(id)); -// if (input_data.size() != my_data.size()) -// return false; -// return (my_data == input_data); -// } -// -// /*! -// * Check if the set of data objects has an equal data element as -// * aux set of data objects -// */ -// template -// bool has_equal_aux_data(unsigned int id, const InputIterator & begin, -// const InputIterator & end) const -// { -// CGAL_precondition(id < 2); -// if (!get_aux_is_set(id)) -// return false; -// // insert the input data objects into a set -// std::set input_data(begin, end); -// std::set my_data(begin_aux_data(id), end_aux_data(id)); -// std::list intersection; -// std::set_intersection(my_data.begin(), my_data.end(), -// input_data.begin(), input_data.end(), -// std::back_inserter(intersection)); -// return (intersection.size() > 0); -// } -// - }; - - /*! Extend the planar-map vertex */ template class Envelope_pm_vertex : public CGAL::Arr_vertex_base, public Dcel_data { private: -// void* m_copy_from_halfedge; // indicate if the edge was added in the decomposition process // and is not part of the arrangement bool m_is_fake; @@ -410,7 +295,6 @@ public: , m_is_intersection(false) , m_is_equal_data_in_face(false) , m_has_equal_data_in_face(false) -// , m_copy_from_halfedge(NULL) { m_is_equal_aux_data_in_face[0] = m_is_equal_aux_data_in_face[1] = false; m_has_equal_aux_data_in_face[0] = m_has_equal_aux_data_in_face[1] = false; @@ -488,15 +372,19 @@ private: bool m_is_fake; // indications for the Envelope algorithm + // relation between halfedge and incident face bool m_is_equal_data_in_face; bool m_has_equal_data_in_face; bool m_is_equal_aux_data_in_face[2]; bool m_has_equal_aux_data_in_face[2]; - + // relation between halfedge and target vertex bool m_is_equal_data_in_target; bool m_has_equal_data_in_target; bool m_is_equal_aux_data_in_target[2]; bool m_has_equal_aux_data_in_target[2]; + // relation between target vertex and incident face + bool m_has_equal_data_in_target_and_face; + bool m_has_equal_aux_data_in_target_and_face[2]; public: Envelope_pm_halfedge() : Dcel_data() @@ -505,11 +393,18 @@ public: , m_has_equal_data_in_face(false) , m_is_equal_data_in_target(false) , m_has_equal_data_in_target(false) + , m_has_equal_data_in_target_and_face(false) { - m_is_equal_aux_data_in_face[0] = m_is_equal_aux_data_in_face[1] = false; - m_has_equal_aux_data_in_face[0] = m_has_equal_aux_data_in_face[1] = false; - m_is_equal_aux_data_in_target[0] = m_is_equal_aux_data_in_target[1] = false; - m_has_equal_aux_data_in_target[0] = m_has_equal_aux_data_in_target[1] = false; + m_is_equal_aux_data_in_face[0] = + m_is_equal_aux_data_in_face[1] = false; + m_has_equal_aux_data_in_face[0] = + m_has_equal_aux_data_in_face[1] = false; + m_is_equal_aux_data_in_target[0] = + m_is_equal_aux_data_in_target[1] = false; + m_has_equal_aux_data_in_target[0] = + m_has_equal_aux_data_in_target[1] = false; + m_has_equal_aux_data_in_target_and_face[0] = + m_has_equal_aux_data_in_target_and_face[1] = false; } void set_is_fake(bool b) @@ -600,6 +495,26 @@ public: CGAL_assertion(id < 2); return m_has_equal_aux_data_in_target[id]; } + // access to flags that contain relation between target and face + void set_has_equal_data_in_target_and_face(bool b) + { + m_has_equal_data_in_target_and_face = b; + } + bool get_has_equal_data_in_target_and_face() const + { + return m_has_equal_data_in_target_and_face; + } + + void set_has_equal_aux_data_in_target_and_face(unsigned int id, bool b) + { + CGAL_assertion(id < 2); + m_has_equal_aux_data_in_target_and_face[id] = b; + } + bool get_has_equal_aux_data_in_target_and_face(unsigned int id) const + { + CGAL_assertion(id < 2); + return m_has_equal_aux_data_in_target_and_face[id]; + } }; @@ -648,54 +563,4 @@ public: CGAL_END_NAMESPACE -class Curve_data -{ -private: - /*! The id of the source planar map in the overlay */ - unsigned int m_pm_id; - - /*! The halfedge the curve is mapped to in the source planar map */ - void * m_halfedge; - - /*! Is the input curve oriented the same as the input halfedge */ - bool m_is_same_direction_in; - - // a temporary id - int m_id; - -public: - /*! Constructor */ - Curve_data(unsigned int pm_id = (unsigned int) -1, - void * halfedge = NULL, - bool is_same_direction_in = true, - int id = 0) : - m_pm_id(pm_id), - m_halfedge(halfedge), - m_is_same_direction_in(is_same_direction_in), - m_id(id) - {} - - /*! obtains the halfedge the curve is mapped to in the source planar map */ - void * get_halfedge() const { return m_halfedge; } - - /*! obtains the flag that indicates whether the input curve is in the - * same direction as the returned halfedge - */ - bool get_is_same_direction_in() const { return m_is_same_direction_in; } - - /*! obtains the id of the source planar-map */ - unsigned int get_pm_id() const { return m_pm_id; } - - // return the temporary id - int get_id() const { return m_id; } - - /*! Equality operator. */ - bool operator== (const Curve_data& cd) const - { - return true; - } - -}; - - -#endif // CGAL_ENVELOPE_PM_DCEL_H +#endif