mirror of https://github.com/CGAL/cgal
Fixed the types used in all arrangement observers
This commit is contained in:
parent
c6a21e9f98
commit
6b90164b55
|
|
@ -1,75 +1,69 @@
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
/*!
|
/*! \ingroup PkgArrangementOnSurface2Ref
|
||||||
\ingroup PkgArrangementOnSurface2Ref
|
*
|
||||||
|
* `Arr_face_index_map` maintains a mapping of face handles of an attached
|
||||||
|
* arrangement object to indices (of type `unsigned int`). This class template
|
||||||
|
* is a model of the concept `ReadablePropertyMap`. A mapping between face
|
||||||
|
* handles and indices enables convenient usage of property-map classes supplied
|
||||||
|
* by `boost`. For example, the property-map class templates
|
||||||
|
* `boost::vector_property_map`, which is based on `std::vector`, and
|
||||||
|
* `boost::iterator_property_map`, which can be used to implement a property map
|
||||||
|
* based on a native \CC array, require the user to supply a mapping such as
|
||||||
|
* `Arr_face_index_map`.
|
||||||
|
*
|
||||||
|
* As new faces might be inserted into the attached arrangement, and
|
||||||
|
* existing faces might be removed, the notification mechanism is used
|
||||||
|
* to dynamically maintain the mapping of face handles to indices.
|
||||||
|
*
|
||||||
|
* \cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap}
|
||||||
|
*
|
||||||
|
* \sa `Arr_vertex_index_map<Arrangement>`
|
||||||
|
*/
|
||||||
|
|
||||||
`Arr_face_index_map` maintains a mapping of face handles of an
|
template <typename Arrangement_>
|
||||||
attached arrangement object to indices (of type `unsigned int`).
|
class Arr_face_index_map: public Arrangement_::Observer {
|
||||||
This class template is a model of the concept
|
public:
|
||||||
`ReadablePropertyMap`. A mapping between face handles and indices
|
|
||||||
enables convenient usage of property-map classes supplied by `boost`.
|
|
||||||
For example, the property-map class templates
|
|
||||||
`boost::vector_property_map`, which is based on `std::vector`,
|
|
||||||
and `boost::iterator_property_map`, which can be used to implement
|
|
||||||
a property map based on a native \CC array, require the
|
|
||||||
user to supply a mapping such as `Arr_face_index_map`.
|
|
||||||
|
|
||||||
As new faces might be inserted into the attached arrangement, and
|
/// \name Types
|
||||||
existing faces might be removed, the notification mechanism is used
|
/// @{
|
||||||
to dynamically maintain the mapping of face handles to indices.
|
|
||||||
|
|
||||||
|
/*! the type of the attached arrangement.
|
||||||
|
*/
|
||||||
|
typedef Arrangement_ Arrangement_2;
|
||||||
|
typedef typename Arrangement_2::Base_aos Base_aos;
|
||||||
|
|
||||||
\cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap}
|
typedef boost::readable_property_map_tag category;
|
||||||
|
|
||||||
\sa `Arr_vertex_index_map<Arrangement>`
|
typedef unsigned int value_type;
|
||||||
*/
|
|
||||||
|
|
||||||
template< typename Arrangement >
|
typedef unsigned int reference;
|
||||||
class Arr_face_index_map: public Arrangement::Observer {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// \name Types
|
typedef Face_handle key_type;
|
||||||
/// @{
|
|
||||||
|
|
||||||
/*!
|
/*! The face handle type.
|
||||||
the type of the attached arrangement.
|
*/
|
||||||
*/
|
typedef typename Base_aos::Face_handle Face_handle;
|
||||||
typedef Arrangement Arrangement_2;
|
|
||||||
|
|
||||||
typedef boost::readable_property_map_tag category;
|
/*! The type of mapping of faces to indices.
|
||||||
|
*/
|
||||||
|
typedef Unique_hash_map<Face_handle, value_type> Index_map;
|
||||||
|
|
||||||
typedef unsigned int value_type;
|
/// @}
|
||||||
|
|
||||||
typedef unsigned int reference;
|
/// \name Creation
|
||||||
|
/// @{
|
||||||
|
|
||||||
typedef Face_handle key_type;
|
/*! constructs a map that is unattached to any arrangement instance.
|
||||||
|
*/
|
||||||
|
Arr_face_index_map();
|
||||||
|
|
||||||
/*!
|
/*! constructs a map and attaches it to the given arrangement `arr`.
|
||||||
The face handle type.
|
*/
|
||||||
*/
|
Arr_face_index_map(Base_aos& arr);
|
||||||
typedef typename Arrangement_2::Face_handle Face_handle;
|
|
||||||
|
|
||||||
/*!
|
/// @}
|
||||||
The type of mapping of faces to indices.
|
|
||||||
*/
|
|
||||||
typedef Unique_hash_map<Face_handle, value_type> Index_map;
|
|
||||||
|
|
||||||
/// @}
|
}; /* end Arr_accessor */
|
||||||
|
|
||||||
/// \name Creation
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
/*!
|
|
||||||
constructs a map that is unattached to any arrangement instance.
|
|
||||||
*/
|
|
||||||
Arr_face_index_map();
|
|
||||||
|
|
||||||
/*!
|
|
||||||
constructs a map and attaches it to the given arrangement `arr`.
|
|
||||||
*/
|
|
||||||
Arr_face_index_map(Arrangement_2& arr);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
}; /* end Arr_accessor */
|
|
||||||
} /* end namespace CGAL */
|
} /* end namespace CGAL */
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
/*!
|
/*! \ingroup PkgArrangementOnSurface2PointLocation
|
||||||
* \ingroup PkgArrangementOnSurface2PointLocation
|
|
||||||
*
|
*
|
||||||
* \anchor arr_reftri_pl
|
* \anchor arr_reftri_pl
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,75 +1,69 @@
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
/*!
|
/*! \ingroup PkgArrangementOnSurface2Ref
|
||||||
\ingroup PkgArrangementOnSurface2Ref
|
*
|
||||||
|
* `Arr_vertex_index_map` maintains a mapping of vertex handles of an attached
|
||||||
|
* arrangement object to indices (of type `unsigned int`). This class template
|
||||||
|
* is a model of the concept `ReadablePropertyMap`. A mapping between vertex
|
||||||
|
* handles and indices enables convenient usage of property-map classes supplied
|
||||||
|
* by `boost`. For example, the property-map class templates
|
||||||
|
* `boost::vector_property_map`, which is based on `std::vector`, and
|
||||||
|
* `boost::iterator_property_map`, which can be used to implement a property map
|
||||||
|
* based on a native \CC array, require the user to supply a mapping such as
|
||||||
|
* `Arr_vertex_index_map`.
|
||||||
|
*
|
||||||
|
* As new vertices might be inserted into the attached arrangement, and
|
||||||
|
* existing vertices might be removed, the notification mechanism is used
|
||||||
|
* to dynamically maintain the mapping of vertex handles to indices.
|
||||||
|
*
|
||||||
|
* \cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap}
|
||||||
|
*
|
||||||
|
* \sa `Arr_face_index_map<Arrangement>`
|
||||||
|
*/
|
||||||
|
|
||||||
`Arr_vertex_index_map` maintains a mapping of vertex handles of an
|
template< typename Arrangement_>
|
||||||
attached arrangement object to indices (of type `unsigned int`).
|
class Arr_vertex_index_map: public Arrangement_::Observer {
|
||||||
This class template is a model of the concept
|
public:
|
||||||
`ReadablePropertyMap`. A mapping between vertex handles and indices
|
|
||||||
enables convenient usage of property-map classes supplied by `boost`.
|
|
||||||
For example, the property-map class templates
|
|
||||||
`boost::vector_property_map`, which is based on `std::vector`,
|
|
||||||
and `boost::iterator_property_map`, which can be used to implement
|
|
||||||
a property map based on a native \CC array, require the
|
|
||||||
user to supply a mapping such as `Arr_vertex_index_map`.
|
|
||||||
|
|
||||||
As new vertices might be inserted into the attached arrangement, and
|
/// \name Types
|
||||||
existing vertices might be removed, the notification mechanism is used
|
/// @{
|
||||||
to dynamically maintain the mapping of vertex handles to indices.
|
|
||||||
|
|
||||||
|
/*! the type of the attached arrangement.
|
||||||
|
*/
|
||||||
|
typedef Arrangement_ Arrangement_2;
|
||||||
|
typedef typename Arrangement_2::Base_aos Base_aos;
|
||||||
|
|
||||||
\cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap}
|
typedef boost::readable_property_map_tag category;
|
||||||
|
|
||||||
\sa `Arr_face_index_map<Arrangement>`
|
typedef unsigned int value_type;
|
||||||
*/
|
|
||||||
|
|
||||||
template< typename Arrangement >
|
typedef unsigned int reference;
|
||||||
class Arr_vertex_index_map: public Arrangement::Observer {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// \name Types
|
typedef Vertex_handle key_type;
|
||||||
/// @{
|
|
||||||
|
|
||||||
/*!
|
/*! The vertex handle type.
|
||||||
the type of the attached arrangement.
|
*/
|
||||||
*/
|
typedef typename Base_aos::Vertex_handle Vertex_handle;
|
||||||
typedef Arrangement Arrangement_2;
|
|
||||||
|
|
||||||
typedef boost::readable_property_map_tag category;
|
/*! The type of mapping of vertices to indices.
|
||||||
|
*/
|
||||||
|
typedef Unique_hash_map<Vertex_handle, value_type> Index_map;
|
||||||
|
|
||||||
typedef unsigned int value_type;
|
/// @}
|
||||||
|
|
||||||
typedef unsigned int reference;
|
/// \name Creation
|
||||||
|
/// @{
|
||||||
|
|
||||||
typedef Vertex_handle key_type;
|
/*! constructs a map that is unattached to any arrangement instance.
|
||||||
|
*/
|
||||||
|
Arr_vertex_index_map();
|
||||||
|
|
||||||
/*!
|
/*! constructs a map and attaches it to the given arrangement `arr`.
|
||||||
The vertex handle type.
|
*/
|
||||||
*/
|
Arr_vertex_index_map(Base_aos& arr);
|
||||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
|
||||||
|
|
||||||
/*!
|
/// @}
|
||||||
The type of mapping of vertices to indices.
|
|
||||||
*/
|
|
||||||
typedef Unique_hash_map<Vertex_handle, value_type> Index_map;
|
|
||||||
|
|
||||||
/// @}
|
}; /* end Arr_accessor */
|
||||||
|
|
||||||
/// \name Creation
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
/*!
|
|
||||||
constructs a map that is unattached to any arrangement instance.
|
|
||||||
*/
|
|
||||||
Arr_vertex_index_map();
|
|
||||||
|
|
||||||
/*!
|
|
||||||
constructs a map and attaches it to the given arrangement `arr`.
|
|
||||||
*/
|
|
||||||
Arr_vertex_index_map(Arrangement_2& arr);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
}; /* end Arr_accessor */
|
|
||||||
} /* end namespace CGAL */
|
} /* end namespace CGAL */
|
||||||
|
|
|
||||||
|
|
@ -33,139 +33,110 @@ namespace CGAL {
|
||||||
* arrangement faces to the indices 0, ..., (n -1), where n is the number
|
* arrangement faces to the indices 0, ..., (n -1), where n is the number
|
||||||
* of faces in the arrangement.
|
* of faces in the arrangement.
|
||||||
*/
|
*/
|
||||||
template <class Arrangement_>
|
template <typename Arrangement_>
|
||||||
class Arr_face_index_map : public Arrangement_::Observer {
|
class Arr_face_index_map : public Arrangement_::Observer {
|
||||||
public:
|
public:
|
||||||
|
using Arrangement_2 = Arrangement_;
|
||||||
|
using Base_aos = typename Arrangement_2::Base_aos;
|
||||||
|
|
||||||
typedef Arrangement_ Arrangement_2;
|
using Halfedge_handle = typename Base_aos::Halfedge_handle;
|
||||||
typedef typename Arrangement_2::Face_handle Face_handle;
|
using Face_handle = typename Base_aos::Face_handle;
|
||||||
|
|
||||||
// Boost property type definitions:
|
// Boost property type definitions:
|
||||||
typedef boost::readable_property_map_tag category;
|
using category = boost::readable_property_map_tag;
|
||||||
typedef unsigned int value_type;
|
using value_type = unsigned int;
|
||||||
typedef value_type reference;
|
using reference = value_type;
|
||||||
typedef Face_handle key_type;
|
using key_type = Face_handle;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
using Self = Arr_face_index_map<Arrangement_2>;
|
||||||
|
using Base = typename Arrangement_2::Observer;
|
||||||
|
|
||||||
typedef Arr_face_index_map<Arrangement_2> Self;
|
using Index_map = Unique_hash_map<Face_handle, unsigned int>;
|
||||||
typedef typename Arrangement_2::Observer Base;
|
|
||||||
|
|
||||||
typedef Unique_hash_map<Face_handle, unsigned int> Index_map;
|
|
||||||
|
|
||||||
// Data members:
|
// Data members:
|
||||||
unsigned int n_faces; // The current number of faces.
|
unsigned int n_faces; // The current number of faces.
|
||||||
Index_map index_map; // Mapping faces to indices.
|
Index_map index_map; // Mapping faces to indices.
|
||||||
std::vector<Face_handle> rev_map; // Mapping indices to faces.
|
std::vector<Face_handle> rev_map; // Mapping indices to faces.
|
||||||
|
|
||||||
enum {MIN_REV_MAP_SIZE = 32};
|
enum {MIN_REV_MAP_SIZE = 32};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*! Default constructor. */
|
/*! Default constructor. */
|
||||||
Arr_face_index_map () :
|
Arr_face_index_map() :
|
||||||
Base (),
|
Base(),
|
||||||
n_faces (0),
|
n_faces(0),
|
||||||
rev_map (MIN_REV_MAP_SIZE)
|
rev_map(MIN_REV_MAP_SIZE)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*! Constructor with an associated arrangement. */
|
/*! Constructor with an associated arrangement. */
|
||||||
Arr_face_index_map (const Arrangement_2& arr) :
|
Arr_face_index_map(const Base_aos& arr) :
|
||||||
Base(const_cast<Arrangement_2&>(arr))
|
Base(const_cast<Base_aos&>(arr))
|
||||||
{
|
{ _init(); }
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Copy constructor. */
|
/*! Copy constructor. */
|
||||||
Arr_face_index_map (const Self& other) :
|
Arr_face_index_map(const Self& other) :
|
||||||
Base(const_cast<typename Base::Arrangement_2&>(*(other.arrangement())))
|
Base(const_cast<Base_aos&>(*(other.arrangement())))
|
||||||
{
|
{ _init(); }
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Assignment operator. */
|
/*! Assignment operator. */
|
||||||
Self& operator= (const Self& other)
|
Self& operator= (const Self& other) {
|
||||||
{
|
if (this == &other) return (*this);
|
||||||
if (this == &other)
|
|
||||||
return (*this);
|
|
||||||
|
|
||||||
this->detach();
|
this->detach();
|
||||||
this->attach(const_cast<typename Base::Arrangement_2&>(*(other.arrangement())));
|
this->attach(const_cast<Base_aos&>(*(other.arrangement())));
|
||||||
|
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Get the index of a given face.
|
||||||
* Get the index of a given face.
|
|
||||||
* \param f A handle to the face.
|
* \param f A handle to the face.
|
||||||
* \pre f is a valid face in the arrangement.
|
* \pre f is a valid face in the arrangement.
|
||||||
*/
|
*/
|
||||||
unsigned int operator[] (Face_handle f) const
|
unsigned int operator[](Face_handle f) const { return (index_map[f]); }
|
||||||
{
|
|
||||||
return (index_map[f]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Get the face given its index.
|
||||||
* Get the face given its index.
|
|
||||||
* \param i The index of the face.
|
* \param i The index of the face.
|
||||||
* \pre i is less than the number of faces in the arrangement.
|
* \pre i is less than the number of faces in the arrangement.
|
||||||
*/
|
*/
|
||||||
Face_handle face (const int i) const
|
Face_handle face(const int i) const {
|
||||||
{
|
|
||||||
CGAL_precondition((unsigned int) i < n_faces);
|
CGAL_precondition((unsigned int) i < n_faces);
|
||||||
|
|
||||||
return (rev_map[i]);
|
return (rev_map[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \name Notification functions, to keep the mapping up-to-date.
|
/// \name Notification functions, to keep the mapping up-to-date.
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after the arrangement has been assigned with another
|
||||||
* Update the mapping after the arrangement has been assigned with another
|
|
||||||
* arrangement.
|
* arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void after_assign ()
|
virtual void after_assign() override { _init(); }
|
||||||
{
|
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after the arrangement is cleared.
|
||||||
* Update the mapping after the arrangement is cleared.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_clear ()
|
virtual void after_clear() override { _init(); }
|
||||||
{
|
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after attaching to a new arrangement.
|
||||||
* Update the mapping after attaching to a new arrangement.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_attach ()
|
virtual void after_attach() override { _init(); }
|
||||||
{
|
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after detaching the arrangement.
|
||||||
* Update the mapping after detaching the arrangement.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_detach ()
|
virtual void after_detach() override {
|
||||||
{
|
|
||||||
n_faces = 0;
|
n_faces = 0;
|
||||||
index_map.clear();
|
index_map.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after the creation of a new face is split from another
|
||||||
* Update the mapping after the creation of a new face is split from another
|
|
||||||
* face.
|
* face.
|
||||||
* \param f A handle to the existing face.
|
* \param f A handle to the existing face.
|
||||||
* \param new_f A handle to the newly created face.
|
* \param new_f A handle to the newly created face.
|
||||||
*/
|
*/
|
||||||
virtual void after_split_face (Face_handle /* f */,
|
virtual void after_split_face(Face_handle /* f */,
|
||||||
Face_handle new_f,
|
Face_handle new_f,
|
||||||
bool /* is_hole */)
|
bool /* is_hole */) override {
|
||||||
{
|
|
||||||
// Update the number of vertices.
|
// Update the number of vertices.
|
||||||
n_faces++;
|
++n_faces;
|
||||||
|
|
||||||
// If necessary, allocate memory for the reverse mapping.
|
// If necessary, allocate memory for the reverse mapping.
|
||||||
if (rev_map.size() < n_faces)
|
if (rev_map.size() < n_faces)
|
||||||
|
|
@ -174,97 +145,77 @@ public:
|
||||||
// Update the mapping of the newly created face.
|
// Update the mapping of the newly created face.
|
||||||
index_map[new_f] = n_faces - 1;
|
index_map[new_f] = n_faces - 1;
|
||||||
rev_map[n_faces - 1] = new_f;
|
rev_map[n_faces - 1] = new_f;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping before the merge of two faces.
|
||||||
* Update the mapping before the merge of two faces.
|
|
||||||
* \param f1 A handle to the face that is going to remain.
|
* \param f1 A handle to the face that is going to remain.
|
||||||
* \param f2 A handle to the face that is about to be removed.
|
* \param f2 A handle to the face that is about to be removed.
|
||||||
*/
|
*/
|
||||||
virtual void before_merge_face (Face_handle /* f1 */,
|
virtual void before_merge_face(Face_handle /* f1 */,
|
||||||
Face_handle f2,
|
Face_handle f2,
|
||||||
typename
|
Halfedge_handle /* e */) override {
|
||||||
Arrangement_2::Halfedge_handle /* e */)
|
|
||||||
{
|
|
||||||
// Update the number of faces.
|
// Update the number of faces.
|
||||||
n_faces--;
|
--n_faces;
|
||||||
|
|
||||||
// Reduce memory consumption in case the number of faces has
|
// Reduce memory consumption in case the number of faces has
|
||||||
// drastically decreased.
|
// drastically decreased.
|
||||||
if (2*n_faces+1 < rev_map.size() &&
|
if (2*n_faces+1 < rev_map.size() &&
|
||||||
rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
|
rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
|
||||||
{
|
{
|
||||||
rev_map.resize (rev_map.size() / 2);
|
rev_map.resize(rev_map.size() / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the current face index, and assign this index to the face
|
// Get the current face index, and assign this index to the face
|
||||||
// currently indexed (n - 1).
|
// currently indexed (n - 1).
|
||||||
unsigned int index = index_map[f2];
|
unsigned int index = index_map[f2];
|
||||||
|
|
||||||
if (index == n_faces)
|
if (index == n_faces) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Face_handle last_f = rev_map[n_faces];
|
Face_handle last_f = rev_map[n_faces];
|
||||||
index_map[last_f] = index;
|
index_map[last_f] = index;
|
||||||
rev_map[index] = last_f;
|
rev_map[index] = last_f;
|
||||||
|
|
||||||
// Clear the reverse mapping for the last face.
|
// Clear the reverse mapping for the last face.
|
||||||
rev_map[n_faces] = Face_handle();
|
rev_map[n_faces] = Face_handle();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/*! Initialize the map for the given arrangement. */
|
/*! Initialize the map for the given arrangement. */
|
||||||
void _init ()
|
void _init() {
|
||||||
{
|
|
||||||
// Get the number of faces and allocate the reverse map accordingly.
|
// Get the number of faces and allocate the reverse map accordingly.
|
||||||
n_faces = static_cast<unsigned int>(this->arrangement()->number_of_faces());
|
n_faces = static_cast<unsigned int>(this->arrangement()->number_of_faces());
|
||||||
|
|
||||||
if (n_faces < MIN_REV_MAP_SIZE)
|
if (n_faces < MIN_REV_MAP_SIZE) rev_map.resize (MIN_REV_MAP_SIZE);
|
||||||
rev_map.resize (MIN_REV_MAP_SIZE);
|
else rev_map.resize (n_faces);
|
||||||
else
|
|
||||||
rev_map.resize (n_faces);
|
|
||||||
|
|
||||||
// Clear the current mapping.
|
// Clear the current mapping.
|
||||||
index_map.clear();
|
index_map.clear();
|
||||||
|
|
||||||
// Create the initial mapping.
|
// Create the initial mapping.
|
||||||
typename Arrangement_2::Face_iterator fit;
|
Face_handle fh;
|
||||||
Face_handle fh;
|
unsigned int index = 0;
|
||||||
unsigned int index = 0;
|
|
||||||
|
|
||||||
for (fit = this->arrangement()->faces_begin();
|
for (auto fit = this->arrangement()->faces_begin();
|
||||||
fit != this->arrangement()->faces_end(); ++fit, ++index)
|
fit != this->arrangement()->faces_end(); ++fit, ++index) {
|
||||||
{
|
|
||||||
// Map the current face to the current index.
|
// Map the current face to the current index.
|
||||||
fh = fit;
|
fh = fit;
|
||||||
index_map[fh] = index;
|
index_map[fh] = index;
|
||||||
rev_map[index] = fh;
|
rev_map[index] = fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*! Get the index property-map function. Provided so that boost is able to
|
||||||
* Get the index property-map function. Provided so that boost is able to
|
|
||||||
* access the Arr_face_index_map above.
|
* access the Arr_face_index_map above.
|
||||||
* \param index_map The index map.
|
* \param index_map The index map.
|
||||||
* \param f A face handle.
|
* \param f A face handle.
|
||||||
* \return The face index.
|
* \return The face index.
|
||||||
*/
|
*/
|
||||||
template<class Arrangement>
|
template <typename Arrangement>
|
||||||
unsigned int get (const CGAL::Arr_face_index_map<Arrangement>& index_map,
|
unsigned int get(const CGAL::Arr_face_index_map<Arrangement>& index_map,
|
||||||
typename Arrangement::Face_handle f)
|
typename Arrangement::Face_handle f)
|
||||||
{
|
{ return (index_map[f]); }
|
||||||
return (index_map[f]);
|
|
||||||
}
|
|
||||||
|
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,40 +48,38 @@ public:
|
||||||
using Arrangement_2 = Arrangement_;
|
using Arrangement_2 = Arrangement_;
|
||||||
using Base_aos = typename Arrangement_2::Base_aos;
|
using Base_aos = typename Arrangement_2::Base_aos;
|
||||||
|
|
||||||
typedef Nearest_neighbor_ Nearest_neighbor;
|
using Nearest_neighbor = Nearest_neighbor_;
|
||||||
|
|
||||||
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
|
using Geometry_traits_2 = typename Base_aos::Geometry_traits_2;
|
||||||
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
using Vertex_const_handle = typename Base_aos::Vertex_const_handle;
|
||||||
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
using Halfedge_const_handle = typename Base_aos::Halfedge_const_handle;
|
||||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
using Face_const_handle = typename Base_aos::Face_const_handle;
|
||||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
using Vertex_handle = typename Base_aos::Vertex_handle;
|
||||||
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
|
using Halfedge_handle = typename Base_aos::Halfedge_handle;
|
||||||
typedef typename Arrangement_2::Face_handle Face_handle;
|
using Face_handle = typename Base_aos::Face_handle;
|
||||||
typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator;
|
using Vertex_const_iterator = typename Base_aos::Vertex_const_iterator;
|
||||||
typedef typename Arrangement_2::Ccb_halfedge_circulator
|
using Ccb_halfedge_circulator = typename Base_aos::Ccb_halfedge_circulator;
|
||||||
Ccb_halfedge_circulator;
|
|
||||||
|
|
||||||
typedef typename Arrangement_2::Point_2 Point_2;
|
using Point_2 = typename Base_aos::Point_2;
|
||||||
typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2;
|
using X_monotone_curve_2 = typename Base_aos::X_monotone_curve_2;
|
||||||
|
|
||||||
typedef typename Nearest_neighbor::NN_Point_2 NN_Point_2;
|
using NN_Point_2 = typename Nearest_neighbor::NN_Point_2;
|
||||||
typedef std::list<NN_Point_2> NN_Points_set;
|
using NN_Points_set = std::list<NN_Point_2>;
|
||||||
|
|
||||||
typedef std::vector<Point_2> Points_set;
|
using Points_set = std::vector<Point_2>;
|
||||||
|
|
||||||
typedef Arr_point_location_result<Arrangement_2> PL_result;
|
using PL_result = Arr_point_location_result<Base_aos>;
|
||||||
typedef typename PL_result::Type PL_result_type;
|
using PL_result_type = typename PL_result::Type;
|
||||||
|
|
||||||
typedef std::pair<Point_2, PL_result_type> PL_pair;
|
using PL_pair = std::pair<Point_2, PL_result_type>;
|
||||||
typedef std::vector<PL_pair> Pairs_set;
|
using Pairs_set = std::vector<PL_pair>;
|
||||||
typedef typename std::vector<PL_pair>::iterator Pairs_iterator;
|
using Pairs_iterator = typename std::vector<PL_pair>::iterator;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef Arr_landmarks_generator_base<Arrangement_2, Nearest_neighbor>
|
using Self = Arr_landmarks_generator_base<Arrangement_2, Nearest_neighbor>;
|
||||||
Self;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef Arr_traits_basic_adaptor_2<Geometry_traits_2> Traits_adaptor_2;
|
using Traits_adaptor_2 = Arr_traits_basic_adaptor_2<Geometry_traits_2>;
|
||||||
|
|
||||||
// Data members:
|
// Data members:
|
||||||
const Traits_adaptor_2* m_traits; // The associated traits object.
|
const Traits_adaptor_2* m_traits; // The associated traits object.
|
||||||
|
|
@ -110,8 +108,8 @@ public:
|
||||||
/*! Constructor from an arrangement.
|
/*! Constructor from an arrangement.
|
||||||
* \param arr (in) The arrangement.
|
* \param arr (in) The arrangement.
|
||||||
*/
|
*/
|
||||||
Arr_landmarks_generator_base(const Arrangement_2& arr) :
|
Arr_landmarks_generator_base(const Base_aos& arr) :
|
||||||
Arrangement_2::Observer(const_cast<Arrangement_2&>(arr)),
|
Base_aos::Observer(const_cast<Base_aos&>(arr)),
|
||||||
m_traits(static_cast<const Traits_adaptor_2*>(arr.geometry_traits())),
|
m_traits(static_cast<const Traits_adaptor_2*>(arr.geometry_traits())),
|
||||||
m_ignore_notifications(false),
|
m_ignore_notifications(false),
|
||||||
m_ignore_remove_edge(false),
|
m_ignore_remove_edge(false),
|
||||||
|
|
@ -125,8 +123,7 @@ public:
|
||||||
/*! Create the landmarks set (choosing the landmarks) ,
|
/*! Create the landmarks set (choosing the landmarks) ,
|
||||||
* and saving them in the nearest-neighbor search structure.
|
* and saving them in the nearest-neighbor search structure.
|
||||||
*/
|
*/
|
||||||
virtual void build_landmark_set()
|
virtual void build_landmark_set() {
|
||||||
{
|
|
||||||
// Create the landmark points.
|
// Create the landmark points.
|
||||||
NN_Points_set nn_points;
|
NN_Points_set nn_points;
|
||||||
_create_nn_points_set(nn_points);
|
_create_nn_points_set(nn_points);
|
||||||
|
|
@ -141,8 +138,7 @@ public:
|
||||||
|
|
||||||
/*! clear the set of landmarks.
|
/*! clear the set of landmarks.
|
||||||
*/
|
*/
|
||||||
virtual void clear_landmark_set()
|
virtual void clear_landmark_set() {
|
||||||
{
|
|
||||||
nn.clear();
|
nn.clear();
|
||||||
num_small_not_updated_changes = 0;
|
num_small_not_updated_changes = 0;
|
||||||
updated = false;
|
updated = false;
|
||||||
|
|
@ -154,8 +150,7 @@ public:
|
||||||
* arrangement (a vertex, halfedge, or face handle).
|
* arrangement (a vertex, halfedge, or face handle).
|
||||||
* \return The nearest landmark point.
|
* \return The nearest landmark point.
|
||||||
*/
|
*/
|
||||||
virtual Point_2 closest_landmark(const Point_2& p, PL_result_type& obj)
|
virtual Point_2 closest_landmark(const Point_2& p, PL_result_type& obj) {
|
||||||
{
|
|
||||||
CGAL_assertion(updated);
|
CGAL_assertion(updated);
|
||||||
return (nn.find_nearest_neighbor(p, obj));
|
return (nn.find_nearest_neighbor(p, obj));
|
||||||
}
|
}
|
||||||
|
|
@ -163,13 +158,13 @@ public:
|
||||||
/// \name Overloaded observer functions on global changes.
|
/// \name Overloaded observer functions on global changes.
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/*! Notification before the arrangement is assigned with the content of another
|
/*! Notification before the arrangement is assigned with the content of
|
||||||
* arrangement.
|
* another arrangement.
|
||||||
* \param arr The other arrangement. Notice that the arrangement type is the type used to
|
* \param arr The other arrangement. Notice that the arrangement type is the
|
||||||
* instantiate the observer, which is conveniently defined as
|
* type used to instantiate the observer, which is conveniently
|
||||||
* `Arrangement_2::Base_aos`.
|
* defined as `Arrangement_2::Base_aos`.
|
||||||
*/
|
*/
|
||||||
virtual void before_assign(const Base_aos& arr) {
|
virtual void before_assign(const Base_aos& arr) override {
|
||||||
this->clear_landmark_set();
|
this->clear_landmark_set();
|
||||||
m_traits = static_cast<const Traits_adaptor_2*>(arr.geometry_traits());
|
m_traits = static_cast<const Traits_adaptor_2*>(arr.geometry_traits());
|
||||||
m_ignore_notifications = true;
|
m_ignore_notifications = true;
|
||||||
|
|
@ -178,8 +173,7 @@ public:
|
||||||
/*! Notification after the arrangement has been assigned with another
|
/*! Notification after the arrangement has been assigned with another
|
||||||
* arrangement.
|
* arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void after_assign()
|
virtual void after_assign() override {
|
||||||
{
|
|
||||||
this->build_landmark_set();
|
this->build_landmark_set();
|
||||||
m_ignore_notifications = false;
|
m_ignore_notifications = false;
|
||||||
}
|
}
|
||||||
|
|
@ -187,8 +181,7 @@ public:
|
||||||
/*! Notification before the observer is attached to an arrangement.
|
/*! Notification before the observer is attached to an arrangement.
|
||||||
* \param arr The arrangement we are about to attach the observer to.
|
* \param arr The arrangement we are about to attach the observer to.
|
||||||
*/
|
*/
|
||||||
virtual void before_attach(const Base_aos& arr)
|
virtual void before_attach(const Base_aos& arr) override {
|
||||||
{
|
|
||||||
this->clear_landmark_set();
|
this->clear_landmark_set();
|
||||||
m_traits = static_cast<const Traits_adaptor_2*>(arr.geometry_traits());
|
m_traits = static_cast<const Traits_adaptor_2*>(arr.geometry_traits());
|
||||||
m_ignore_notifications = true;
|
m_ignore_notifications = true;
|
||||||
|
|
@ -196,38 +189,33 @@ public:
|
||||||
|
|
||||||
/*! Notification after the observer has been attached to an arrangement.
|
/*! Notification after the observer has been attached to an arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void after_attach()
|
virtual void after_attach() override {
|
||||||
{
|
|
||||||
this->build_landmark_set();
|
this->build_landmark_set();
|
||||||
m_ignore_notifications = false;
|
m_ignore_notifications = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification before the observer is detached from the arrangement.
|
/*! Notification before the observer is detached from the arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void before_detach()
|
virtual void before_detach() override { this->clear_landmark_set(); }
|
||||||
{ this->clear_landmark_set(); }
|
|
||||||
|
|
||||||
/*! Notification after the arrangement is cleared.
|
/*! Notification after the arrangement is cleared.
|
||||||
* \param u A handle to the unbounded face.
|
* \param u A handle to the unbounded face.
|
||||||
*/
|
*/
|
||||||
virtual void after_clear()
|
virtual void after_clear() override {
|
||||||
{
|
|
||||||
this->clear_landmark_set();
|
this->clear_landmark_set();
|
||||||
this->build_landmark_set();
|
this->build_landmark_set();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification before a global operation modifies the arrangement.
|
/*! Notification before a global operation modifies the arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void before_global_change()
|
virtual void before_global_change() override {
|
||||||
{
|
|
||||||
this->clear_landmark_set();
|
this->clear_landmark_set();
|
||||||
m_ignore_notifications = true;
|
m_ignore_notifications = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after a global operation is completed.
|
/*! Notification after a global operation is completed.
|
||||||
*/
|
*/
|
||||||
virtual void after_global_change()
|
virtual void after_global_change() override {
|
||||||
{
|
|
||||||
this->build_landmark_set();
|
this->build_landmark_set();
|
||||||
m_ignore_notifications = false;
|
m_ignore_notifications = false;
|
||||||
}
|
}
|
||||||
|
|
@ -239,12 +227,11 @@ public:
|
||||||
/*! Notification before the removal of an edge.
|
/*! Notification before the removal of an edge.
|
||||||
* \param e (in) A handle to one of the twin halfedges to be removed.
|
* \param e (in) A handle to one of the twin halfedges to be removed.
|
||||||
*/
|
*/
|
||||||
virtual void before_remove_edge(Halfedge_handle /* e */)
|
virtual void before_remove_edge(Halfedge_handle /* e */) override
|
||||||
{ m_ignore_remove_edge = true; }
|
{ m_ignore_remove_edge = true; }
|
||||||
|
|
||||||
/*! Notification after the creation of a new vertex. */
|
/*! Notification after the creation of a new vertex. */
|
||||||
virtual void after_create_vertex(Vertex_handle)
|
virtual void after_create_vertex(Vertex_handle) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -252,8 +239,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after the creation of a new edge. */
|
/*! Notification after the creation of a new edge. */
|
||||||
virtual void after_create_edge(Halfedge_handle)
|
virtual void after_create_edge(Halfedge_handle) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -261,8 +247,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after an edge was split. */
|
/*! Notification after an edge was split. */
|
||||||
virtual void after_split_edge(Halfedge_handle, Halfedge_handle)
|
virtual void after_split_edge(Halfedge_handle, Halfedge_handle) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -270,8 +255,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after a face was split. */
|
/*! Notification after a face was split. */
|
||||||
virtual void after_split_face(Face_handle, Face_handle, bool)
|
virtual void after_split_face(Face_handle, Face_handle, bool) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -281,8 +265,7 @@ public:
|
||||||
/*! Notification after an outer CCB was split.*/
|
/*! Notification after an outer CCB was split.*/
|
||||||
virtual void after_split_outer_ccb(Face_handle,
|
virtual void after_split_outer_ccb(Face_handle,
|
||||||
Ccb_halfedge_circulator,
|
Ccb_halfedge_circulator,
|
||||||
Ccb_halfedge_circulator)
|
Ccb_halfedge_circulator) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -292,8 +275,7 @@ public:
|
||||||
/*! Notification after an inner CCB was split. */
|
/*! Notification after an inner CCB was split. */
|
||||||
virtual void after_split_inner_ccb(Face_handle,
|
virtual void after_split_inner_ccb(Face_handle,
|
||||||
Ccb_halfedge_circulator,
|
Ccb_halfedge_circulator,
|
||||||
Ccb_halfedge_circulator)
|
Ccb_halfedge_circulator) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -301,8 +283,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after an outer CCB was added to a face. */
|
/*! Notification after an outer CCB was added to a face. */
|
||||||
virtual void after_add_outer_ccb(Ccb_halfedge_circulator)
|
virtual void after_add_outer_ccb(Ccb_halfedge_circulator) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -310,8 +291,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after an inner CCB was created inside a face. */
|
/*! Notification after an inner CCB was created inside a face. */
|
||||||
virtual void after_add_inner_ccb(Ccb_halfedge_circulator)
|
virtual void after_add_inner_ccb(Ccb_halfedge_circulator) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -319,8 +299,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after an isolated vertex was created inside a face. */
|
/*! Notification after an isolated vertex was created inside a face. */
|
||||||
virtual void after_add_isolated_vertex(Vertex_handle)
|
virtual void after_add_isolated_vertex(Vertex_handle) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -328,8 +307,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after an edge was merged. */
|
/*! Notification after an edge was merged. */
|
||||||
virtual void after_merge_edge(Halfedge_handle)
|
virtual void after_merge_edge(Halfedge_handle) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -337,8 +315,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after a face was merged. */
|
/*! Notification after a face was merged. */
|
||||||
virtual void after_merge_face(Face_handle)
|
virtual void after_merge_face(Face_handle) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -347,7 +324,7 @@ public:
|
||||||
|
|
||||||
/*! Notification after an outer CCB was merged. */
|
/*! Notification after an outer CCB was merged. */
|
||||||
virtual void after_merge_outer_ccb(Face_handle, Ccb_halfedge_circulator)
|
virtual void after_merge_outer_ccb(Face_handle, Ccb_halfedge_circulator)
|
||||||
{
|
override {
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -356,7 +333,7 @@ public:
|
||||||
|
|
||||||
/*! Notification after an inner CCB was merged. */
|
/*! Notification after an inner CCB was merged. */
|
||||||
virtual void after_merge_inner_ccb(Face_handle, Ccb_halfedge_circulator)
|
virtual void after_merge_inner_ccb(Face_handle, Ccb_halfedge_circulator)
|
||||||
{
|
override {
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -364,8 +341,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after an outer CCB is moved from one face to another. */
|
/*! Notification after an outer CCB is moved from one face to another. */
|
||||||
virtual void after_move_outer_ccb(Ccb_halfedge_circulator )
|
virtual void after_move_outer_ccb(Ccb_halfedge_circulator) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -373,8 +349,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after an inner CCB is moved from one face to another. */
|
/*! Notification after an inner CCB is moved from one face to another. */
|
||||||
virtual void after_move_inner_ccb(Ccb_halfedge_circulator )
|
virtual void after_move_inner_ccb(Ccb_halfedge_circulator) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -382,8 +357,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after an isolated vertex is moved. */
|
/*! Notification after an isolated vertex is moved. */
|
||||||
virtual void after_move_isolated_vertex(Vertex_handle )
|
virtual void after_move_isolated_vertex(Vertex_handle) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -391,8 +365,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notificaion after the removal of a vertex. */
|
/*! Notificaion after the removal of a vertex. */
|
||||||
virtual void after_remove_vertex()
|
virtual void after_remove_vertex() override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -400,8 +373,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after the removal of an edge. */
|
/*! Notification after the removal of an edge. */
|
||||||
virtual void after_remove_edge()
|
virtual void after_remove_edge() override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -410,8 +382,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notificaion after the removal of an outer CCB. */
|
/*! Notificaion after the removal of an outer CCB. */
|
||||||
virtual void after_remove_outer_ccb(Face_handle)
|
virtual void after_remove_outer_ccb(Face_handle) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -419,8 +390,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notificaion after the removal of an inner CCB. */
|
/*! Notificaion after the removal of an inner CCB. */
|
||||||
virtual void after_remove_inner_ccb(Face_handle)
|
virtual void after_remove_inner_ccb(Face_handle) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
||||||
clear_landmark_set();
|
clear_landmark_set();
|
||||||
build_landmark_set();
|
build_landmark_set();
|
||||||
|
|
@ -435,8 +405,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
virtual void _create_points_set(Points_set&) = 0;
|
virtual void _create_points_set(Points_set&) = 0;
|
||||||
|
|
||||||
virtual void _create_nn_points_set(NN_Points_set& nn_points)
|
virtual void _create_nn_points_set(NN_Points_set& nn_points) {
|
||||||
{
|
|
||||||
Points_set points;
|
Points_set points;
|
||||||
Pairs_set pairs;
|
Pairs_set pairs;
|
||||||
|
|
||||||
|
|
@ -454,8 +423,7 @@ protected:
|
||||||
|
|
||||||
// Insert all landmarks (paired with their current location in the
|
// Insert all landmarks (paired with their current location in the
|
||||||
// arrangement) into the nearest-neighbor search structure.
|
// arrangement) into the nearest-neighbor search structure.
|
||||||
Pairs_iterator itr;
|
for (auto itr = pairs.begin(); itr != pairs.end(); ++itr) {
|
||||||
for (itr = pairs.begin(); itr != pairs.end(); ++itr) {
|
|
||||||
NN_Point_2 np(itr->first, itr->second);
|
NN_Point_2 np(itr->first, itr->second);
|
||||||
nn_points.push_back(np);
|
nn_points.push_back(np);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Author(s) : Idit Haran <haranidi@post.tau.ac.il>
|
// Author(s): Idit Haran <haranidi@post.tau.ac.il>
|
||||||
// (based on old version by Oren Nechushtan and Iddo Hanniel)
|
// (based on old version by Oren Nechushtan and Iddo Hanniel)
|
||||||
|
|
||||||
#ifndef CGAL_ARR_TRAPEZOID_RIC_POINT_LOCATION_H
|
#ifndef CGAL_ARR_TRAPEZOID_RIC_POINT_LOCATION_H
|
||||||
#define CGAL_ARR_TRAPEZOID_RIC_POINT_LOCATION_H
|
#define CGAL_ARR_TRAPEZOID_RIC_POINT_LOCATION_H
|
||||||
|
|
@ -42,90 +42,88 @@ public:
|
||||||
using Base_aos = typename Arrangement_on_surface_2::Base_aos;
|
using Base_aos = typename Arrangement_on_surface_2::Base_aos;
|
||||||
|
|
||||||
//type of geometry traits
|
//type of geometry traits
|
||||||
typedef typename Arrangement_on_surface_2::Geometry_traits_2
|
using Geometry_traits_2 = typename Base_aos::Geometry_traits_2;
|
||||||
Geometry_traits_2;
|
|
||||||
//type of traits adaptor
|
//type of traits adaptor
|
||||||
typedef typename Arrangement_on_surface_2::Traits_adaptor_2
|
using Traits_adaptor_2 = typename Base_aos::Traits_adaptor_2;
|
||||||
Traits_adaptor_2;
|
|
||||||
//type of vertex handle
|
//type of vertex handle
|
||||||
typedef typename Arrangement_on_surface_2::Vertex_handle
|
using Vertex_handle = typename Base_aos::Vertex_handle;
|
||||||
Vertex_handle;
|
|
||||||
//type of vertex const handle
|
//type of vertex const handle
|
||||||
typedef typename Arrangement_on_surface_2::Vertex_const_handle
|
using Vertex_const_handle = typename Base_aos::Vertex_const_handle;
|
||||||
Vertex_const_handle;
|
|
||||||
//type of halfedge handle
|
//type of halfedge handle
|
||||||
typedef typename Arrangement_on_surface_2::Halfedge_handle
|
using Halfedge_handle = typename Base_aos::Halfedge_handle;
|
||||||
Halfedge_handle;
|
|
||||||
//type of halfedge const handle
|
//type of halfedge const handle
|
||||||
typedef typename Arrangement_on_surface_2::Halfedge_const_handle
|
using Halfedge_const_handle = typename Base_aos::Halfedge_const_handle;
|
||||||
Halfedge_const_handle;
|
|
||||||
//type of face const handle
|
//type of face const handle
|
||||||
typedef typename Arrangement_on_surface_2::Face_const_handle
|
using Face_const_handle = typename Base_aos::Face_const_handle;
|
||||||
Face_const_handle;
|
|
||||||
//type of edge const iterator
|
//type of edge const iterator
|
||||||
typedef typename Arrangement_on_surface_2::Edge_const_iterator
|
using Edge_const_iterator = typename Base_aos::Edge_const_iterator;
|
||||||
Edge_const_iterator;
|
|
||||||
//type of isolated vertex const iterator
|
//type of isolated vertex const iterator
|
||||||
typedef typename Arrangement_on_surface_2::Isolated_vertex_const_iterator
|
using Isolated_vertex_const_iterator =
|
||||||
Isolated_vertex_const_iterator;
|
typename Base_aos::Isolated_vertex_const_iterator;
|
||||||
|
|
||||||
//type of point
|
//type of point
|
||||||
typedef typename Geometry_traits_2::Point_2 Point_2;
|
using Point_2 = typename Geometry_traits_2::Point_2;
|
||||||
|
|
||||||
//type of x-monotone curve
|
//type of x-monotone curve
|
||||||
typedef typename Geometry_traits_2::X_monotone_curve_2
|
using X_monotone_curve_2 = typename Geometry_traits_2::X_monotone_curve_2;
|
||||||
X_monotone_curve_2;
|
|
||||||
|
|
||||||
//type of trapezoidal decomposition traits class
|
//type of trapezoidal decomposition traits class
|
||||||
typedef CGAL::Td_traits<Traits_adaptor_2, Arrangement_on_surface_2>
|
using Td_traits = CGAL::Td_traits<Traits_adaptor_2, Base_aos>;
|
||||||
Td_traits;
|
|
||||||
//type of trapezoidal decomposition class
|
//type of trapezoidal decomposition class
|
||||||
typedef Trapezoidal_decomposition_2<Td_traits>
|
using Trapezoidal_decomposition = Trapezoidal_decomposition_2<Td_traits>;
|
||||||
Trapezoidal_decomposition;
|
|
||||||
|
|
||||||
//!types of Td_map_item-s
|
//!types of Td_map_item-s
|
||||||
typedef typename Trapezoidal_decomposition::Td_map_item
|
using Td_map_item = typename Trapezoidal_decomposition::Td_map_item;
|
||||||
Td_map_item;
|
using Td_active_vertex = typename Trapezoidal_decomposition::Td_active_vertex;
|
||||||
typedef typename Trapezoidal_decomposition::Td_active_vertex
|
using Td_active_fictitious_vertex =
|
||||||
Td_active_vertex;
|
typename Trapezoidal_decomposition::Td_active_fictitious_vertex;
|
||||||
typedef typename Trapezoidal_decomposition::Td_active_fictitious_vertex
|
using Td_active_edge = typename Trapezoidal_decomposition::Td_active_edge;
|
||||||
Td_active_fictitious_vertex;
|
using Td_active_trapezoid =
|
||||||
typedef typename Trapezoidal_decomposition::Td_active_edge
|
typename Trapezoidal_decomposition::Td_active_trapezoid;
|
||||||
Td_active_edge;
|
|
||||||
typedef typename Trapezoidal_decomposition::Td_active_trapezoid
|
|
||||||
Td_active_trapezoid;
|
|
||||||
//!type of side tags
|
//!type of side tags
|
||||||
typedef typename Traits_adaptor_2::Left_side_category Left_side_category;
|
using Left_side_category = typename Traits_adaptor_2::Left_side_category;
|
||||||
typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category;
|
using Bottom_side_category = typename Traits_adaptor_2::Bottom_side_category;
|
||||||
typedef typename Traits_adaptor_2::Top_side_category Top_side_category;
|
using Top_side_category = typename Traits_adaptor_2::Top_side_category;
|
||||||
typedef typename Traits_adaptor_2::Right_side_category Right_side_category;
|
using Right_side_category = typename Traits_adaptor_2::Right_side_category;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef Arr_point_location_result<Arrangement_on_surface_2> Result;
|
using Result = Arr_point_location_result<Base_aos>;
|
||||||
typedef typename Result::Type Result_type;
|
using Result_type = typename Result::Type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Support cpp11::result_of
|
// Support cpp11::result_of
|
||||||
typedef Result_type result_type;
|
using result_type = Result_type;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//type of trapezoidal decomposition class
|
//type of trapezoidal decomposition class
|
||||||
typedef Trapezoidal_decomposition TD;
|
using TD = Trapezoidal_decomposition;
|
||||||
|
|
||||||
typedef typename Arr_all_sides_oblivious_category<Left_side_category,
|
using All_sides_oblivious_category=
|
||||||
Bottom_side_category,
|
typename Arr_all_sides_oblivious_category<Left_side_category,
|
||||||
Top_side_category,
|
Bottom_side_category,
|
||||||
Right_side_category>::result
|
Top_side_category,
|
||||||
All_sides_oblivious_category;
|
Right_side_category>::result;
|
||||||
|
|
||||||
// Data members:
|
// Data members:
|
||||||
const Traits_adaptor_2* m_traits; // Its associated traits object.
|
const Traits_adaptor_2* m_traits; // Its associated traits object.
|
||||||
TD td; // instance of trapezoidal decomposition
|
TD td; // instance of trapezoidal decomposition
|
||||||
bool m_with_guarantees;
|
bool m_with_guarantees;
|
||||||
//for the notification functions
|
//for the notification functions
|
||||||
X_monotone_curve_2 m_cv_before_split;
|
X_monotone_curve_2 m_cv_before_split;
|
||||||
Halfedge_handle m_he_after_merge;
|
Halfedge_handle m_he_after_merge;
|
||||||
//X_monotone_curve_2 m_cv_before_merge1;
|
//X_monotone_curve_2 m_cv_before_merge1;
|
||||||
//X_monotone_curve_2 m_cv_before_merge2;
|
//X_monotone_curve_2 m_cv_before_merge2;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Result_type make_result(T t) const { return Result::make_result(t); }
|
Result_type make_result(T t) const { return Result::make_result(t); }
|
||||||
|
|
@ -133,26 +131,25 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*! Default constructor. */
|
/*! Default constructor. */
|
||||||
Arr_trapezoid_ric_point_location(bool with_guarantees = true,
|
Arr_trapezoid_ric_point_location
|
||||||
double depth_thrs = CGAL_TD_DEFAULT_DEPTH_THRESHOLD,
|
(bool with_guarantees = true,
|
||||||
double size_thrs = CGAL_TD_DEFAULT_SIZE_THRESHOLD) :
|
double depth_thrs = CGAL_TD_DEFAULT_DEPTH_THRESHOLD,
|
||||||
m_traits(nullptr), m_with_guarantees(with_guarantees)
|
double size_thrs = CGAL_TD_DEFAULT_SIZE_THRESHOLD) :
|
||||||
{
|
m_traits(nullptr), m_with_guarantees(with_guarantees) {
|
||||||
td.set_with_guarantees(with_guarantees);
|
td.set_with_guarantees(with_guarantees);
|
||||||
td.depth_threshold(depth_thrs);
|
td.depth_threshold(depth_thrs);
|
||||||
td.size_threshold(size_thrs);
|
td.size_threshold(size_thrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Constructor given an arrangement. */
|
/*! Constructor given an arrangement. */
|
||||||
Arr_trapezoid_ric_point_location (const Arrangement_on_surface_2& arr,
|
Arr_trapezoid_ric_point_location
|
||||||
bool with_guarantees = true,
|
(const Base_aos& arr,
|
||||||
double depth_thrs = CGAL_TD_DEFAULT_DEPTH_THRESHOLD,
|
bool with_guarantees = true,
|
||||||
double size_thrs = CGAL_TD_DEFAULT_SIZE_THRESHOLD) :
|
double depth_thrs = CGAL_TD_DEFAULT_DEPTH_THRESHOLD,
|
||||||
Arrangement_on_surface_2::
|
double size_thrs = CGAL_TD_DEFAULT_SIZE_THRESHOLD) :
|
||||||
Observer(const_cast<Arrangement_on_surface_2&>(arr)),
|
Base_aos::Observer(const_cast<Base_aos&>(arr)),
|
||||||
m_with_guarantees(with_guarantees)
|
m_with_guarantees(with_guarantees) {
|
||||||
{
|
m_traits = static_cast<const Traits_adaptor_2*>(arr.geometry_traits());
|
||||||
m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
|
|
||||||
td.set_with_guarantees(with_guarantees);
|
td.set_with_guarantees(with_guarantees);
|
||||||
td.init_arrangement_and_traits(&arr);
|
td.init_arrangement_and_traits(&arr);
|
||||||
td.depth_threshold(depth_thrs);
|
td.depth_threshold(depth_thrs);
|
||||||
|
|
@ -161,17 +158,15 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Destructor. */
|
/*! Destructor. */
|
||||||
~Arr_trapezoid_ric_point_location () { }
|
~Arr_trapezoid_ric_point_location() { }
|
||||||
|
|
||||||
/*! defines whether the underlying search structure guarantees logarithmic
|
/*! defines whether the underlying search structure guarantees logarithmic
|
||||||
* query time and linear size */
|
* query time and linear size */
|
||||||
void with_guarantees (bool with_guarantees)
|
void with_guarantees(bool with_guarantees) {
|
||||||
{
|
|
||||||
//if with_guarantees was changed from false to true - reconstruct
|
//if with_guarantees was changed from false to true - reconstruct
|
||||||
// the search structure with guarantees
|
// the search structure with guarantees
|
||||||
td.set_with_guarantees(with_guarantees);
|
td.set_with_guarantees(with_guarantees);
|
||||||
if (with_guarantees && !m_with_guarantees)
|
if (with_guarantees && !m_with_guarantees) {
|
||||||
{
|
|
||||||
td.clear();
|
td.clear();
|
||||||
_construct_td();
|
_construct_td();
|
||||||
}
|
}
|
||||||
|
|
@ -182,30 +177,20 @@ public:
|
||||||
* (the longest path in the DAG)
|
* (the longest path in the DAG)
|
||||||
*/
|
*/
|
||||||
unsigned long depth() //longest_dag_path()
|
unsigned long depth() //longest_dag_path()
|
||||||
{
|
{ return td.largest_leaf_depth() + 1; }
|
||||||
return td.largest_leaf_depth() + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! returns the longest query path in the underlying search structure */
|
/*! returns the longest query path in the underlying search structure */
|
||||||
unsigned long longest_query_path_length()
|
unsigned long longest_query_path_length()
|
||||||
{
|
{ return td.longest_query_path_length(); }
|
||||||
return td.longest_query_path_length();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CGAL_TD_DEBUG
|
#ifdef CGAL_TD_DEBUG
|
||||||
//void locate_and_print (std::ostream& out, const Point_2& p) const
|
//void locate_and_print (std::ostream& out, const Point_2& p) const
|
||||||
//{
|
//{ td.locate_and_print(out, p); }
|
||||||
// td.locate_and_print(out, p);
|
|
||||||
//}
|
|
||||||
|
|
||||||
void print_dag(std::ostream& out) const
|
void print_dag(std::ostream& out) const { td.print_dag(out); }
|
||||||
{
|
|
||||||
td.print_dag(out);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*! Locate the arrangement feature containing the given point.
|
||||||
* Locate the arrangement feature containing the given point.
|
|
||||||
* \param p The query point.
|
* \param p The query point.
|
||||||
* \return An object representing the arrangement feature containing the
|
* \return An object representing the arrangement feature containing the
|
||||||
* query point. This object is either a Face_const_handle or a
|
* query point. This object is either a Face_const_handle or a
|
||||||
|
|
@ -213,8 +198,7 @@ public:
|
||||||
*/
|
*/
|
||||||
result_type locate(const Point_2& p) const;
|
result_type locate(const Point_2& p) const;
|
||||||
|
|
||||||
/*!
|
/*! Locate the arrangement feature which a upward vertical ray emanating from
|
||||||
* Locate the arrangement feature which a upward vertical ray emanating from
|
|
||||||
* the given point hits.
|
* the given point hits.
|
||||||
* \param p The query point.
|
* \param p The query point.
|
||||||
* \return An object representing the arrangement feature the ray hits.
|
* \return An object representing the arrangement feature the ray hits.
|
||||||
|
|
@ -224,8 +208,7 @@ public:
|
||||||
result_type ray_shoot_up(const Point_2& p) const
|
result_type ray_shoot_up(const Point_2& p) const
|
||||||
{ return (_vertical_ray_shoot(p, true)); }
|
{ return (_vertical_ray_shoot(p, true)); }
|
||||||
|
|
||||||
/*!
|
/*! Locate the arrangement feature which a downward vertical ray emanating
|
||||||
* Locate the arrangement feature which a downward vertical ray emanating
|
|
||||||
* from the given point hits.
|
* from the given point hits.
|
||||||
* \param p The query point.
|
* \param p The query point.
|
||||||
* \return An object representing the arrangement feature the ray hits.
|
* \return An object representing the arrangement feature the ray hits.
|
||||||
|
|
@ -239,32 +222,23 @@ public:
|
||||||
// base observer.
|
// base observer.
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/*! Notification before the arrangement is assigned with the content of another
|
/*! Notification before the arrangement is assigned with the content of
|
||||||
* arrangement.
|
* another arrangement.
|
||||||
* \param arr The other arrangement. Notice that the arrangement type is the type used to
|
* \param arr The other arrangement. Notice that the arrangement type is the
|
||||||
* instantiate the observer, which is conveniently defined as
|
* type used to instantiate the observer, which is conveniently
|
||||||
* `Arrangement_2::Base_aos`.
|
* defined as `Arrangement_2::Base_aos`.
|
||||||
*/
|
*/
|
||||||
virtual void before_assign(const Base_aos& arr) {
|
virtual void before_assign(const Base_aos& arr) override {
|
||||||
td.clear();
|
td.clear();
|
||||||
m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
|
m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
|
||||||
td.init_arrangement_and_traits(&arr, false);
|
td.init_arrangement_and_traits(&arr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void after_assign ()
|
virtual void after_assign() override { _construct_td(); }
|
||||||
{
|
|
||||||
_construct_td();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void before_clear ()
|
virtual void before_clear() override { td.clear(); }
|
||||||
{
|
|
||||||
td.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void after_clear ()
|
virtual void after_clear() override { _construct_td(); }
|
||||||
{
|
|
||||||
_construct_td();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Notification before the observer is attached to an arrangement.
|
/*! Notification before the observer is attached to an arrangement.
|
||||||
* \param arr The arrangement that is about to attach the observer. Notice
|
* \param arr The arrangement that is about to attach the observer. Notice
|
||||||
|
|
@ -272,49 +246,38 @@ public:
|
||||||
* observer, which is conveniently defined as
|
* observer, which is conveniently defined as
|
||||||
* `Arrangement_2::Base_aos`.
|
* `Arrangement_2::Base_aos`.
|
||||||
*/
|
*/
|
||||||
virtual void before_attach(const Base_aos& arr) {
|
virtual void before_attach(const Base_aos& arr) override {
|
||||||
td.clear();
|
td.clear();
|
||||||
m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
|
m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
|
||||||
td.init_arrangement_and_traits(&arr);
|
td.init_arrangement_and_traits(&arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void after_attach ()
|
virtual void after_attach() override { _construct_td(); }
|
||||||
{
|
|
||||||
_construct_td();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void before_detach ()
|
virtual void before_detach() override { td.clear(); }
|
||||||
{
|
|
||||||
td.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void after_create_edge (Halfedge_handle e)
|
virtual void after_create_edge(Halfedge_handle e) override { td.insert(e); }
|
||||||
{
|
|
||||||
td.insert(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO IDIT OREN: what can be done in order to avoid the need
|
//TODO IDIT OREN: what can be done in order to avoid the need
|
||||||
//to save the original curve is to find the common endpoint of the
|
//to save the original curve is to find the common endpoint of the
|
||||||
//two new halfedges, locate it in the trapezoid in order to find the
|
//two new halfedges, locate it in the trapezoid in order to find the
|
||||||
//curve it lies on, which is the curve that was split, and then remove
|
//curve it lies on, which is the curve that was split, and then remove
|
||||||
//this curve.
|
//this curve.
|
||||||
virtual void before_split_edge (Halfedge_handle e,
|
virtual void before_split_edge(Halfedge_handle e,
|
||||||
Vertex_handle /* v */,
|
Vertex_handle /* v */,
|
||||||
const X_monotone_curve_2& /* cv1 */ ,
|
const X_monotone_curve_2& /* cv1 */,
|
||||||
const X_monotone_curve_2& /* cv2 */ )
|
const X_monotone_curve_2& /* cv2 */) override {
|
||||||
{
|
|
||||||
|
|
||||||
////MICHAL: commented due to inefficient depth update, remove and insert instead
|
////MICHAL: commented due to inefficient depth update, remove and insert
|
||||||
////save the curve for the "after" function.
|
////instead save the curve for the "after" function.
|
||||||
//m_cv_before_split = e->curve();
|
//m_cv_before_split = e->curve();
|
||||||
//td.before_split_edge(m_cv_before_split, cv1, cv2);
|
//td.before_split_edge(m_cv_before_split, cv1, cv2);
|
||||||
|
|
||||||
td.remove(e);
|
td.remove(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void after_split_edge (Halfedge_handle e1,
|
virtual void after_split_edge(Halfedge_handle e1, Halfedge_handle e2)
|
||||||
Halfedge_handle e2)
|
override {
|
||||||
{
|
|
||||||
//MICHAL: commented due to inefficient depth update, remove and insert instead
|
//MICHAL: commented due to inefficient depth update, remove and insert instead
|
||||||
//td.split_edge(m_cv_before_split,e1,e2);
|
//td.split_edge(m_cv_before_split,e1,e2);
|
||||||
|
|
||||||
|
|
@ -322,29 +285,20 @@ public:
|
||||||
td.insert(e2);
|
td.insert(e2);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void before_merge_edge (Halfedge_handle e1,
|
virtual void before_merge_edge(Halfedge_handle e1, Halfedge_handle e2,
|
||||||
Halfedge_handle e2,
|
const X_monotone_curve_2& cv) override {
|
||||||
const X_monotone_curve_2& cv)
|
|
||||||
{
|
|
||||||
//save the halfedge handle for the "after" function.
|
//save the halfedge handle for the "after" function.
|
||||||
m_he_after_merge = e1;
|
m_he_after_merge = e1;
|
||||||
td.merge_edge (e1, e2, cv);
|
td.merge_edge (e1, e2, cv);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void after_merge_edge (Halfedge_handle e)
|
virtual void after_merge_edge(Halfedge_handle e) override
|
||||||
{
|
{ td.after_merge_edge(e, m_he_after_merge); }
|
||||||
td.after_merge_edge(e, m_he_after_merge);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void before_remove_edge (Halfedge_handle e)
|
virtual void before_remove_edge(Halfedge_handle e) override { td.remove(e); }
|
||||||
{
|
|
||||||
//called before combinatoric deletion
|
|
||||||
td.remove(e);
|
|
||||||
}
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//#ifdef CGAL_TD_DEBUG
|
//#ifdef CGAL_TD_DEBUG
|
||||||
// void debug()
|
// void debug()
|
||||||
// {
|
// {
|
||||||
|
|
@ -353,27 +307,22 @@ public:
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/*! Construct the trapezoidal decomposition. */
|
/*! Construct the trapezoidal decomposition. */
|
||||||
void _construct_td ()
|
void _construct_td() {
|
||||||
{
|
|
||||||
td.clear();
|
td.clear();
|
||||||
|
|
||||||
std::vector<Halfedge_const_handle> he_container;
|
std::vector<Halfedge_const_handle> he_container;
|
||||||
Edge_const_iterator eit;
|
|
||||||
Halfedge_const_handle he_cst;
|
|
||||||
auto* arr = this->arrangement();
|
auto* arr = this->arrangement();
|
||||||
//collect the arrangement halfedges
|
//collect the arrangement halfedges
|
||||||
for (eit = arr->edges_begin(); eit != arr->edges_end(); ++eit)
|
for (auto eit = arr->edges_begin(); eit != arr->edges_end(); ++eit) {
|
||||||
{
|
Halfedge_const_handle he_cst = eit;
|
||||||
he_cst = eit;
|
|
||||||
he_container.push_back(he_cst);
|
he_container.push_back(he_cst);
|
||||||
}
|
}
|
||||||
//container insertion
|
//container insertion
|
||||||
td.insert(he_container.begin(), he_container.end());
|
td.insert(he_container.begin(), he_container.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! gets the unbounded face that contains the point when the trapezoid is
|
/*! Obtain the unbounded face that contains the point when the trapezoid is
|
||||||
* unbounded
|
* unbounded
|
||||||
* \param tr The unbounded trapezoid whose face we should get
|
* \param tr The unbounded trapezoid whose face we should get
|
||||||
* \param p The query point.
|
* \param p The query point.
|
||||||
|
|
@ -381,24 +330,23 @@ protected:
|
||||||
* \return A Face_const_handle representing the arrangement unbounded face in
|
* \return A Face_const_handle representing the arrangement unbounded face in
|
||||||
* which the point p lies
|
* which the point p lies
|
||||||
*/
|
*/
|
||||||
Face_const_handle _get_unbounded_face (const Td_map_item& tr,
|
Face_const_handle _get_unbounded_face(const Td_map_item& tr,
|
||||||
const Point_2& p,
|
const Point_2& p,
|
||||||
Arr_all_sides_oblivious_tag) const;
|
Arr_all_sides_oblivious_tag) const;
|
||||||
|
|
||||||
/*! gets the unbounded face that contains the point when the trapezoid is
|
/*! Obtain the unbounded face that contains the point when the trapezoid is
|
||||||
* unbounded
|
* unbounded
|
||||||
* \param tr The unbounded trapezoid whose face we should get
|
* \param tr The unbounded trapezoid whose face we should get
|
||||||
* \param p The query point.
|
* \param p The query point.
|
||||||
* \param Arr_not_all_sides_oblivious_tag
|
* \param Arr_not_all_sides_oblivious_tag
|
||||||
* \return A Face_const_handle representing the arrangement unbounded face in which
|
* \return A Face_const_handle representing the arrangement unbounded face in
|
||||||
* the point p lies
|
* which the point p lies
|
||||||
*/
|
*/
|
||||||
Face_const_handle _get_unbounded_face (const Td_map_item& tr,
|
Face_const_handle _get_unbounded_face(const Td_map_item& tr,
|
||||||
const Point_2& p,
|
const Point_2& p,
|
||||||
Arr_not_all_sides_oblivious_tag) const;
|
Arr_not_all_sides_oblivious_tag) const;
|
||||||
|
|
||||||
/*!
|
/*! Locate the arrangement feature which a vertical ray emanating from the
|
||||||
* Locate the arrangement feature which a vertical ray emanating from the
|
|
||||||
* given point hits, considering isolated vertices.
|
* given point hits, considering isolated vertices.
|
||||||
* \param p The query point.
|
* \param p The query point.
|
||||||
* \param shoot_up Indicates whether the ray is directed upward or downward.
|
* \param shoot_up Indicates whether the ray is directed upward or downward.
|
||||||
|
|
@ -413,11 +361,10 @@ protected:
|
||||||
* we check the isolated vertices inside the face to check whether there
|
* we check the isolated vertices inside the face to check whether there
|
||||||
* is an isolated vertex right above/below the query point.
|
* is an isolated vertex right above/below the query point.
|
||||||
*/
|
*/
|
||||||
result_type
|
result_type _check_isolated_for_vertical_ray_shoot
|
||||||
_check_isolated_for_vertical_ray_shoot
|
(Halfedge_const_handle halfedge_found,
|
||||||
(Halfedge_const_handle halfedge_found,
|
const Point_2& p, bool shoot_up,
|
||||||
const Point_2& p, bool shoot_up,
|
const Td_map_item& tr) const;
|
||||||
const Td_map_item& tr) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -40,70 +40,68 @@ namespace CGAL {
|
||||||
template <typename Arrangement_>
|
template <typename Arrangement_>
|
||||||
class Arr_triangulation_point_location : public Arrangement_::Observer {
|
class Arr_triangulation_point_location : public Arrangement_::Observer {
|
||||||
public:
|
public:
|
||||||
typedef Arrangement_ Arrangement_2;
|
using Arrangement_2 = Arrangement_;
|
||||||
|
using Base_aos = typename Arrangement_2::Base_aos;
|
||||||
|
|
||||||
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
|
using Geometry_traits_2 = typename Base_aos::Geometry_traits_2;
|
||||||
typedef typename Geometry_traits_2::Kernel Kernel;
|
using Kernel = typename Geometry_traits_2::Kernel;
|
||||||
|
|
||||||
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
using Vertex_const_handle = typename Base_aos::Vertex_const_handle;
|
||||||
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
using Halfedge_const_handle = typename Base_aos::Halfedge_const_handle;
|
||||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
using Face_const_handle = typename Base_aos::Face_const_handle;
|
||||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
using Vertex_handle = typename Base_aos::Vertex_handle;
|
||||||
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
|
using Halfedge_handle = typename Base_aos::Halfedge_handle;
|
||||||
typedef typename Arrangement_2::Face_handle Face_handle;
|
using Face_handle = typename Base_aos::Face_handle;
|
||||||
|
|
||||||
typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator;
|
using Vertex_const_iterator = typename Base_aos::Vertex_const_iterator;
|
||||||
typedef typename Arrangement_2::Edge_const_iterator Edge_const_iterator;
|
using Edge_const_iterator = typename Base_aos::Edge_const_iterator;
|
||||||
typedef typename Arrangement_2::Face_const_iterator Face_const_iterator;
|
using Face_const_iterator = typename Base_aos::Face_const_iterator;
|
||||||
typedef typename Arrangement_2::Halfedge_const_iterator
|
using Halfedge_const_iterator = typename Base_aos::Halfedge_const_iterator;
|
||||||
Halfedge_const_iterator;
|
using Halfedge_around_vertex_const_circulator =
|
||||||
typedef typename Arrangement_2::Halfedge_around_vertex_const_circulator
|
typename Base_aos::Halfedge_around_vertex_const_circulator;
|
||||||
Halfedge_around_vertex_const_circulator;
|
using Ccb_halfedge_const_circulator =
|
||||||
typedef typename Arrangement_2::Ccb_halfedge_const_circulator
|
typename Base_aos::Ccb_halfedge_const_circulator;
|
||||||
Ccb_halfedge_const_circulator;
|
using Ccb_halfedge_circulator = typename Base_aos::Ccb_halfedge_circulator;
|
||||||
typedef typename Arrangement_2::Ccb_halfedge_circulator
|
using Isolated_vertex_const_iterator =
|
||||||
Ccb_halfedge_circulator;
|
typename Base_aos::Isolated_vertex_const_iterator;
|
||||||
typedef typename Arrangement_2::Isolated_vertex_const_iterator
|
|
||||||
Isolated_vertex_const_iterator;
|
|
||||||
|
|
||||||
typedef typename Geometry_traits_2::Point_2 Point_2;
|
using Point_2 = typename Geometry_traits_2::Point_2;
|
||||||
typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
using X_monotone_curve_2 = typename Geometry_traits_2::X_monotone_curve_2;
|
||||||
|
|
||||||
typedef std::list<Halfedge_const_handle> Edge_list;
|
using Edge_list = std::list<Halfedge_const_handle>;
|
||||||
typedef typename Edge_list::iterator Std_edge_iterator;
|
using Std_edge_iterator = typename Edge_list::iterator;
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
// Triangulation Types
|
// Triangulation Types
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
typedef Triangulation_vertex_base_with_info_2<Vertex_const_handle, Kernel>
|
using Vbb = Triangulation_vertex_base_with_info_2<Vertex_const_handle, Kernel>;
|
||||||
Vbb;
|
using Vb = Triangulation_hierarchy_vertex_base_2<Vbb>;
|
||||||
typedef Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
|
|
||||||
//typedef Triangulation_face_base_with_info_2<CGAL::IO::Color,Kernel> Fbt;
|
//typedef Triangulation_face_base_with_info_2<CGAL::IO::Color,Kernel> Fbt;
|
||||||
typedef Constrained_triangulation_face_base_2<Kernel> Fb;
|
using Fb = Constrained_triangulation_face_base_2<Kernel>;
|
||||||
typedef Triangulation_data_structure_2<Vb,Fb> TDS;
|
using TDS = Triangulation_data_structure_2<Vb,Fb>;
|
||||||
typedef Exact_predicates_tag Itag;
|
using Itag = Exact_predicates_tag;
|
||||||
//typedef Constrained_Delaunay_triangulation_2<Kernel, TDS, Itag> CDT;
|
//typedef Constrained_Delaunay_triangulation_2<Kernel, TDS, Itag> CDT;
|
||||||
typedef Constrained_Delaunay_triangulation_2<Kernel, TDS, Itag> CDT_t;
|
using CDT_t = Constrained_Delaunay_triangulation_2<Kernel, TDS, Itag>;
|
||||||
typedef Triangulation_hierarchy_2<CDT_t> CDTH;
|
using CDTH = Triangulation_hierarchy_2<CDT_t>;
|
||||||
typedef Constrained_triangulation_plus_2<CDTH> CDT;
|
using CDT = Constrained_triangulation_plus_2<CDTH>;
|
||||||
|
|
||||||
typedef typename CDT::Point CDT_Point;
|
using CDT_Point = typename CDT::Point;
|
||||||
typedef typename CDT::Edge CDT_Edge;
|
using CDT_Edge = typename CDT::Edge;
|
||||||
typedef typename CDT::Face_handle CDT_Face_handle;
|
using CDT_Face_handle = typename CDT::Face_handle;
|
||||||
typedef typename CDT::Vertex_handle CDT_Vertex_handle;
|
using CDT_Vertex_handle = typename CDT::Vertex_handle;
|
||||||
typedef typename CDT::Finite_faces_iterator CDT_Finite_faces_iterator;
|
using CDT_Finite_faces_iterator = typename CDT::Finite_faces_iterator;
|
||||||
typedef typename CDT::Finite_vertices_iterator CDT_Finite_vertices_iterator;
|
using CDT_Finite_vertices_iterator = typename CDT::Finite_vertices_iterator;
|
||||||
typedef typename CDT::Finite_edges_iterator CDT_Finite_edges_iterator;
|
using CDT_Finite_edges_iterator = typename CDT::Finite_edges_iterator;
|
||||||
typedef typename CDT::Locate_type CDT_Locate_type;
|
using CDT_Locate_type = typename CDT::Locate_type;
|
||||||
|
|
||||||
typedef Arr_point_location_result<Arrangement_2> Result;
|
using Result = Arr_point_location_result<Base_aos>;
|
||||||
typedef typename Result::Type Result_type;
|
using Result_type = typename Result::Type;
|
||||||
|
|
||||||
// Support cpp11::result_of
|
// Support cpp11::result_of
|
||||||
typedef Result_type result_type;
|
using result_type = Result_type;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef Arr_traits_basic_adaptor_2<Geometry_traits_2> Traits_adaptor_2;
|
using Traits_adaptor_2 = Arr_traits_basic_adaptor_2<Geometry_traits_2>;
|
||||||
|
|
||||||
// Data members:
|
// Data members:
|
||||||
const Traits_adaptor_2* m_traits; // Its associated traits object.
|
const Traits_adaptor_2* m_traits; // Its associated traits object.
|
||||||
|
|
@ -126,8 +124,8 @@ public:
|
||||||
/*! Constructor from an arrangement.
|
/*! Constructor from an arrangement.
|
||||||
* \param arr (in) The arrangement.
|
* \param arr (in) The arrangement.
|
||||||
*/
|
*/
|
||||||
Arr_triangulation_point_location(const Arrangement_2& arr) :
|
Arr_triangulation_point_location(const Base_aos& arr) :
|
||||||
Arrangement_2::Observer(const_cast<Arrangement_2&>(arr)),
|
Base_aos::Observer(const_cast<Base_aos&>(arr)),
|
||||||
m_traits(static_cast<const Traits_adaptor_2*>(arr.geometry_traits())),
|
m_traits(static_cast<const Traits_adaptor_2*>(arr.geometry_traits())),
|
||||||
m_ignore_notifications(false),
|
m_ignore_notifications(false),
|
||||||
m_ignore_remove_edge(false)
|
m_ignore_remove_edge(false)
|
||||||
|
|
@ -147,12 +145,12 @@ public:
|
||||||
/*! Attach an arrangement.
|
/*! Attach an arrangement.
|
||||||
* \param arr (in) The arrangement.
|
* \param arr (in) The arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void before_attach(const Arrangement_2& arr)
|
virtual void before_attach(const Base_aos& arr) override
|
||||||
{ m_traits = static_cast<const Traits_adaptor_2*>(arr.geometry_traits()); }
|
{ m_traits = static_cast<const Traits_adaptor_2*>(arr.geometry_traits()); }
|
||||||
|
|
||||||
virtual void after_attach() { build_triangulation(); }
|
virtual void after_attach() override { build_triangulation(); }
|
||||||
|
|
||||||
virtual void before_detach() { clear_triangulation(); }
|
virtual void before_detach() override { clear_triangulation(); }
|
||||||
|
|
||||||
/// \name Overloaded observer functions on global changes.
|
/// \name Overloaded observer functions on global changes.
|
||||||
//@{
|
//@{
|
||||||
|
|
@ -160,32 +158,28 @@ public:
|
||||||
/*! Notification after the arrangement has been assigned with another
|
/*! Notification after the arrangement has been assigned with another
|
||||||
* arrangement.
|
* arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void after_assign()
|
virtual void after_assign() override {
|
||||||
{
|
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after the arrangement is cleared.
|
/*! Notification after the arrangement is cleared.
|
||||||
*/
|
*/
|
||||||
virtual void after_clear()
|
virtual void after_clear() override {
|
||||||
{
|
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification before a global operation modifies the arrangement.
|
/*! Notification before a global operation modifies the arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void before_global_change()
|
virtual void before_global_change() override {
|
||||||
{
|
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
m_ignore_notifications = true;
|
m_ignore_notifications = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Notification after a global operation is completed.
|
/*! Notification after a global operation is completed.
|
||||||
*/
|
*/
|
||||||
virtual void after_global_change()
|
virtual void after_global_change() override {
|
||||||
{
|
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
m_ignore_notifications = false;
|
m_ignore_notifications = false;
|
||||||
}
|
}
|
||||||
|
|
@ -197,14 +191,13 @@ public:
|
||||||
/*! Notification before the removal of an edge.
|
/*! Notification before the removal of an edge.
|
||||||
* \param e (in) A handle to one of the twin halfedges to be removed.
|
* \param e (in) A handle to one of the twin halfedges to be removed.
|
||||||
*/
|
*/
|
||||||
virtual void before_remove_edge(Halfedge_handle /* e */)
|
virtual void before_remove_edge(Halfedge_handle /* e */) override
|
||||||
{ m_ignore_remove_edge = true; }
|
{ m_ignore_remove_edge = true; }
|
||||||
|
|
||||||
/*! Notification after the creation of a new vertex.
|
/*! Notification after the creation of a new vertex.
|
||||||
* \param v (in) A handle to the created vertex.
|
* \param v (in) A handle to the created vertex.
|
||||||
*/
|
*/
|
||||||
virtual void after_create_vertex(Vertex_handle /* v */)
|
virtual void after_create_vertex(Vertex_handle /* v */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -214,8 +207,7 @@ public:
|
||||||
/*! Notification after the creation of a new edge.
|
/*! Notification after the creation of a new edge.
|
||||||
* \param e (in) A handle to one of the twin halfedges that were created.
|
* \param e (in) A handle to one of the twin halfedges that were created.
|
||||||
*/
|
*/
|
||||||
virtual void after_create_edge(Halfedge_handle /* e */)
|
virtual void after_create_edge(Halfedge_handle /* e */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -227,8 +219,7 @@ public:
|
||||||
* \param e2 (in) A handle to one of the twin halfedges forming the second edge.
|
* \param e2 (in) A handle to one of the twin halfedges forming the second edge.
|
||||||
*/
|
*/
|
||||||
virtual void after_split_edge(Halfedge_handle /* e1 */,
|
virtual void after_split_edge(Halfedge_handle /* e1 */,
|
||||||
Halfedge_handle /* e2 */)
|
Halfedge_handle /* e2 */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -242,8 +233,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void after_split_face(Face_handle /* f */,
|
virtual void after_split_face(Face_handle /* f */,
|
||||||
Face_handle /* new_f */,
|
Face_handle /* new_f */,
|
||||||
bool /* is_hole */)
|
bool /* is_hole */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -253,8 +243,7 @@ public:
|
||||||
/*! Notification after an outer CCB was created inside a face.
|
/*! Notification after an outer CCB was created inside a face.
|
||||||
* \param h (in) A circulator representing the boundary of the new outer CCB.
|
* \param h (in) A circulator representing the boundary of the new outer CCB.
|
||||||
*/
|
*/
|
||||||
virtual void after_add_outer_ccb(Ccb_halfedge_circulator /* h */)
|
virtual void after_add_outer_ccb(Ccb_halfedge_circulator /* h */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -264,8 +253,7 @@ public:
|
||||||
/*! Notification after an edge was merged.
|
/*! Notification after an edge was merged.
|
||||||
* \param e (in) A handle to one of the twin halfedges forming the merged edge.
|
* \param e (in) A handle to one of the twin halfedges forming the merged edge.
|
||||||
*/
|
*/
|
||||||
virtual void after_merge_edge(Halfedge_handle /* e */)
|
virtual void after_merge_edge(Halfedge_handle /* e */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -275,8 +263,7 @@ public:
|
||||||
/*! Notification after a face was merged.
|
/*! Notification after a face was merged.
|
||||||
* \param f (in) A handle to the merged face.
|
* \param f (in) A handle to the merged face.
|
||||||
*/
|
*/
|
||||||
virtual void after_merge_face(Face_handle /* f */)
|
virtual void after_merge_face(Face_handle /* f */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -286,8 +273,7 @@ public:
|
||||||
/*! Notification after an outer CCB is moved from one face to another.
|
/*! Notification after an outer CCB is moved from one face to another.
|
||||||
* \param h (in) A circulator representing the boundary of the component.
|
* \param h (in) A circulator representing the boundary of the component.
|
||||||
*/
|
*/
|
||||||
virtual void after_move_outer_ccb(Ccb_halfedge_circulator /* h */)
|
virtual void after_move_outer_ccb(Ccb_halfedge_circulator /* h */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -297,8 +283,7 @@ public:
|
||||||
/*! Notificaion before the removal of a vertex.
|
/*! Notificaion before the removal of a vertex.
|
||||||
* \param v (in) A handle to the vertex to be deleted.
|
* \param v (in) A handle to the vertex to be deleted.
|
||||||
*/
|
*/
|
||||||
virtual void after_remove_vertex()
|
virtual void after_remove_vertex() override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -308,8 +293,7 @@ public:
|
||||||
/*! Notification before the removal of an edge.
|
/*! Notification before the removal of an edge.
|
||||||
* \param e (in) A handle to one of the twin halfedges to be deleted.
|
* \param e (in) A handle to one of the twin halfedges to be deleted.
|
||||||
*/
|
*/
|
||||||
virtual void after_remove_edge()
|
virtual void after_remove_edge() override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -320,8 +304,7 @@ public:
|
||||||
/*! Notification before the removal of an outer CCB.
|
/*! Notification before the removal of an outer CCB.
|
||||||
* \param f (in) The face that used to own the outer CCB.
|
* \param f (in) The face that used to own the outer CCB.
|
||||||
*/
|
*/
|
||||||
virtual void after_remove_outer_ccb(Face_handle /* f */)
|
virtual void after_remove_outer_ccb(Face_handle /* f */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -331,8 +314,7 @@ public:
|
||||||
/*! Notification after an inner CCB was created inside a face.
|
/*! Notification after an inner CCB was created inside a face.
|
||||||
* \param h (in) A circulator representing the boundary of the new inner CCB.
|
* \param h (in) A circulator representing the boundary of the new inner CCB.
|
||||||
*/
|
*/
|
||||||
virtual void after_add_inner_ccb(Ccb_halfedge_circulator /* h */)
|
virtual void after_add_inner_ccb(Ccb_halfedge_circulator /* h */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -342,8 +324,7 @@ public:
|
||||||
/*! Notification after an inner CCB is moved from one face to another.
|
/*! Notification after an inner CCB is moved from one face to another.
|
||||||
* \param h (in) A circulator representing the boundary of the component.
|
* \param h (in) A circulator representing the boundary of the component.
|
||||||
*/
|
*/
|
||||||
virtual void after_move_inner_ccb(Ccb_halfedge_circulator /* h */)
|
virtual void after_move_inner_ccb(Ccb_halfedge_circulator /* h */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications) {
|
if (! m_ignore_notifications) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
@ -353,8 +334,7 @@ public:
|
||||||
/*! Notificaion after the removal of an inner CCB.
|
/*! Notificaion after the removal of an inner CCB.
|
||||||
* \param f (in) The face that used to contain the inner CCB.
|
* \param f (in) The face that used to contain the inner CCB.
|
||||||
*/
|
*/
|
||||||
virtual void after_remove_inner_ccb(Face_handle /* f */)
|
virtual void after_remove_inner_ccb(Face_handle /* f */) override {
|
||||||
{
|
|
||||||
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
if (! m_ignore_notifications && ! m_ignore_remove_edge) {
|
||||||
clear_triangulation();
|
clear_triangulation();
|
||||||
build_triangulation();
|
build_triangulation();
|
||||||
|
|
|
||||||
|
|
@ -34,135 +34,120 @@ namespace CGAL {
|
||||||
* arrangement vertices to the indices 0, ..., (n -1), where n is the number
|
* arrangement vertices to the indices 0, ..., (n -1), where n is the number
|
||||||
* of vertices in the arrangement.
|
* of vertices in the arrangement.
|
||||||
*/
|
*/
|
||||||
template <class Arrangement_>
|
template <typename Arrangement_>
|
||||||
class Arr_vertex_index_map : public Arrangement_::Observer {
|
class Arr_vertex_index_map : public Arrangement_::Observer {
|
||||||
public:
|
public:
|
||||||
|
using Arrangement_2 = Arrangement_;
|
||||||
|
using Base_aos = typename Arrangement_2::Base_aos;
|
||||||
|
|
||||||
typedef Arrangement_ Arrangement_2;
|
using Vertex_handle = typename Base_aos::Vertex_handle;
|
||||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
|
||||||
|
|
||||||
// Boost property type definitions:
|
// Boost property type definitions:
|
||||||
typedef boost::readable_property_map_tag category;
|
using category = boost::readable_property_map_tag;
|
||||||
typedef unsigned int value_type;
|
using value_type = unsigned int;
|
||||||
typedef value_type reference;
|
using reference = value_type;
|
||||||
typedef Vertex_handle key_type;
|
using key_type = Vertex_handle;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
using Self = Arr_vertex_index_map<Arrangement_2>;
|
||||||
|
using Base = typename Arrangement_2::Observer;
|
||||||
|
|
||||||
typedef Arr_vertex_index_map<Arrangement_2> Self;
|
using Index_map = Unique_hash_map<Vertex_handle, unsigned int>;
|
||||||
typedef typename Arrangement_2::Observer Base;
|
|
||||||
|
|
||||||
typedef Unique_hash_map<Vertex_handle, unsigned int> Index_map;
|
|
||||||
|
|
||||||
// Data members:
|
// Data members:
|
||||||
unsigned int n_vertices; // The current number of vertices.
|
unsigned int n_vertices; // The current number of vertices.
|
||||||
Index_map index_map; // Mapping vertices to indices.
|
Index_map index_map; // Mapping vertices to indices.
|
||||||
std::vector<Vertex_handle> rev_map; // Mapping indices to vertices.
|
std::vector<Vertex_handle> rev_map; // Mapping indices to vertices.
|
||||||
|
|
||||||
enum {MIN_REV_MAP_SIZE = 32};
|
enum {MIN_REV_MAP_SIZE = 32};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*! Default constructor. */
|
/*! Default constructor. */
|
||||||
Arr_vertex_index_map () :
|
Arr_vertex_index_map() :
|
||||||
Base(),
|
Base(),
|
||||||
n_vertices (0),
|
n_vertices(0),
|
||||||
rev_map (MIN_REV_MAP_SIZE)
|
rev_map(MIN_REV_MAP_SIZE)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*! Constructor with an associated arrangement. */
|
/*! Constructor with an associated arrangement. */
|
||||||
Arr_vertex_index_map (const Arrangement_2& arr) :
|
Arr_vertex_index_map(const Base_aos& arr) :
|
||||||
Base(const_cast<Arrangement_2&>(arr))
|
Base(const_cast<Base_aos&>(arr))
|
||||||
{
|
{ _init(); }
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Copy constructor. */
|
/*! Copy constructor. */
|
||||||
Arr_vertex_index_map (const Self& other) :
|
Arr_vertex_index_map(const Self& other) :
|
||||||
Base(const_cast<typename Base::Arrangement_2&> (*(other.arrangement())))
|
Base(const_cast<Base_aos&>(*(other.arrangement())))
|
||||||
{
|
{ _init(); }
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Assignment operator. */
|
/*! Assignment operator. */
|
||||||
Self& operator= (const Self& other)
|
Self& operator= (const Self& other) {
|
||||||
{
|
if (this == &other) return (*this);
|
||||||
if (this == &other)
|
|
||||||
return (*this);
|
|
||||||
|
|
||||||
this->detach();
|
this->detach();
|
||||||
this->attach (const_cast<typename Base::Arrangement_2&> (*(other.arrangement())));
|
this->attach(const_cast<Base_aos&>(*(other.arrangement())));
|
||||||
|
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Get the index of a given vertex.
|
||||||
* Get the index of a given vertex.
|
|
||||||
* \param v A handle to the vertex.
|
* \param v A handle to the vertex.
|
||||||
* \pre v is a valid vertex in the arrangement.
|
* \pre v is a valid vertex in the arrangement.
|
||||||
*/
|
*/
|
||||||
unsigned int operator[] (Vertex_handle v) const
|
unsigned int operator[](Vertex_handle v) const { return index_map[v]; }
|
||||||
{
|
|
||||||
return index_map[v];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Get the vertex given its index.
|
||||||
* Get the vertex given its index.
|
|
||||||
* \param i The index of the vertex.
|
* \param i The index of the vertex.
|
||||||
* \pre i is less than the number of vertices in the graph.
|
* \pre i is less than the number of vertices in the graph.
|
||||||
*/
|
*/
|
||||||
Vertex_handle vertex (const int i) const
|
Vertex_handle vertex(const int i) const {
|
||||||
{
|
CGAL_precondition(i < n_vertices);
|
||||||
CGAL_precondition (i < n_vertices);
|
|
||||||
|
|
||||||
return rev_map[i];
|
return rev_map[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \name Notification functions, to keep the mapping up-to-date.
|
/// \name Notification functions, to keep the mapping up-to-date.
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after the arrangement has been assigned with another
|
||||||
* Update the mapping after the arrangement has been assigned with another
|
|
||||||
* arrangement.
|
* arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void after_assign ()
|
virtual void after_assign() override { _init(); }
|
||||||
{
|
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after the arrangement is cleared.
|
||||||
* Update the mapping after the arrangement is cleared.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_clear ()
|
virtual void after_clear() override { _init(); }
|
||||||
{
|
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after attaching to a new arrangement.
|
||||||
* Update the mapping after attaching to a new arrangement.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_attach ()
|
virtual void after_attach() override { _init(); }
|
||||||
{
|
|
||||||
_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after detaching the arrangement.
|
||||||
* Update the mapping after detaching the arrangement.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_detach ()
|
virtual void after_detach() override {
|
||||||
{
|
|
||||||
n_vertices = 0;
|
n_vertices = 0;
|
||||||
index_map.clear();
|
index_map.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping after the creation of a new vertex.
|
||||||
* Update the mapping after the creation of a new vertex.
|
|
||||||
* \param v A handle to the created vertex.
|
* \param v A handle to the created vertex.
|
||||||
*/
|
*/
|
||||||
virtual void after_create_vertex (Vertex_handle v)
|
virtual void after_create_vertex(Vertex_handle v) override {
|
||||||
{
|
|
||||||
// Update the number of vertices.
|
// Update the number of vertices.
|
||||||
n_vertices++;
|
++n_vertices;
|
||||||
|
|
||||||
|
// If necessary, allocate memory for the reverse mapping.
|
||||||
|
if (rev_map.size() < n_vertices) rev_map.resize(2 * n_vertices);
|
||||||
|
|
||||||
|
// Update the mapping of the newly created vertex.
|
||||||
|
index_map[v] = n_vertices - 1;
|
||||||
|
rev_map[n_vertices - 1] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! Update the mapping after the creation of a new boundary vertex.
|
||||||
|
* \param v A handle to the created vertex.
|
||||||
|
*/
|
||||||
|
virtual void after_create_boundary_vertex(Vertex_handle v) override {
|
||||||
|
// Update the number of vertices.
|
||||||
|
++n_vertices;
|
||||||
|
|
||||||
// If necessary, allocate memory for the reverse mapping.
|
// If necessary, allocate memory for the reverse mapping.
|
||||||
if (rev_map.size() < n_vertices)
|
if (rev_map.size() < n_vertices)
|
||||||
|
|
@ -173,49 +158,28 @@ public:
|
||||||
rev_map[n_vertices - 1] = v;
|
rev_map[n_vertices - 1] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Update the mapping before the removal of a vertex.
|
||||||
* Update the mapping after the creation of a new boundary vertex.
|
|
||||||
* \param v A handle to the created vertex.
|
|
||||||
*/
|
|
||||||
virtual void after_create_boundary_vertex (Vertex_handle v)
|
|
||||||
{
|
|
||||||
// Update the number of vertices.
|
|
||||||
n_vertices++;
|
|
||||||
|
|
||||||
// If necessary, allocate memory for the reverse mapping.
|
|
||||||
if (rev_map.size() < n_vertices)
|
|
||||||
rev_map.resize (2 * n_vertices);
|
|
||||||
|
|
||||||
// Update the mapping of the newly created vertex.
|
|
||||||
index_map[v] = n_vertices - 1;
|
|
||||||
rev_map[n_vertices - 1] = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Update the mapping before the removal of a vertex.
|
|
||||||
* \param v A handle to the vertex to be removed.
|
* \param v A handle to the vertex to be removed.
|
||||||
*/
|
*/
|
||||||
virtual void before_remove_vertex (Vertex_handle v)
|
virtual void before_remove_vertex(Vertex_handle v) override {
|
||||||
{
|
|
||||||
// Update the number of vertices.
|
// Update the number of vertices.
|
||||||
n_vertices--;
|
--n_vertices;
|
||||||
|
|
||||||
// Reduce memory consumption in case the number of vertices has
|
// Reduce memory consumption in case the number of vertices has
|
||||||
// drastically decreased.
|
// drastically decreased.
|
||||||
if (2*n_vertices+1 < rev_map.size() &&
|
if (2*n_vertices+1 < rev_map.size() &&
|
||||||
rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
|
rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
|
||||||
{
|
{
|
||||||
rev_map.resize (rev_map.size() / 2);
|
rev_map.resize(rev_map.size() / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the current vertex index, and assign this index to the vertex
|
// Get the current vertex index, and assign this index to the vertex
|
||||||
// currently indexed (n - 1).
|
// currently indexed (n - 1).
|
||||||
unsigned int index = index_map[v];
|
unsigned int index = index_map[v];
|
||||||
|
|
||||||
if (index == n_vertices)
|
if (index == n_vertices) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Vertex_handle last_v = rev_map[n_vertices];
|
Vertex_handle last_v = rev_map[n_vertices];
|
||||||
index_map[last_v] = index;
|
index_map[last_v] = index;
|
||||||
rev_map[index] = last_v;
|
rev_map[index] = last_v;
|
||||||
|
|
||||||
|
|
@ -225,51 +189,42 @@ public:
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/*! Initialize the map for the given arrangement. */
|
/*! Initialize the map for the given arrangement. */
|
||||||
void _init ()
|
void _init() {
|
||||||
{
|
|
||||||
// Get the number of vertices and allocate the reverse map accordingly.
|
// Get the number of vertices and allocate the reverse map accordingly.
|
||||||
n_vertices = static_cast<unsigned int>(this->arrangement()->number_of_vertices());
|
n_vertices =
|
||||||
|
static_cast<unsigned int>(this->arrangement()->number_of_vertices());
|
||||||
|
|
||||||
if (n_vertices < MIN_REV_MAP_SIZE)
|
if (n_vertices < MIN_REV_MAP_SIZE) rev_map.resize (MIN_REV_MAP_SIZE);
|
||||||
rev_map.resize (MIN_REV_MAP_SIZE);
|
else rev_map.resize (n_vertices);
|
||||||
else
|
|
||||||
rev_map.resize (n_vertices);
|
|
||||||
|
|
||||||
// Clear the current mapping.
|
// Clear the current mapping.
|
||||||
index_map.clear();
|
index_map.clear();
|
||||||
|
|
||||||
// Create the initial mapping.
|
// Create the initial mapping.
|
||||||
typename Arrangement_2::Vertex_iterator vit;
|
Vertex_handle vh;
|
||||||
Vertex_handle vh;
|
unsigned int index = 0;
|
||||||
unsigned int index = 0;
|
|
||||||
|
|
||||||
for (vit = this->arrangement()->vertices_begin();
|
for (auto vit = this->arrangement()->vertices_begin();
|
||||||
vit != this->arrangement()->vertices_end(); ++vit, ++index)
|
vit != this->arrangement()->vertices_end(); ++vit, ++index) {
|
||||||
{
|
|
||||||
// Map the current vertex to the current index.
|
// Map the current vertex to the current index.
|
||||||
vh = vit;
|
vh = vit;
|
||||||
index_map[vh] = index;
|
index_map[vh] = index;
|
||||||
rev_map[index] = vh;
|
rev_map[index] = vh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*! Get the index property-map function. Provided so that boost is able to
|
||||||
* Get the index property-map function. Provided so that boost is able to
|
|
||||||
* access the Arr_vertex_index_map above.
|
* access the Arr_vertex_index_map above.
|
||||||
* \param index_map The index map.
|
* \param index_map The index map.
|
||||||
* \param v A vertex handle.
|
* \param v A vertex handle.
|
||||||
* \return The vertex index.
|
* \return The vertex index.
|
||||||
*/
|
*/
|
||||||
template<class Arrangement>
|
template <typename Arrangement>
|
||||||
unsigned int get (const CGAL::Arr_vertex_index_map<Arrangement>& index_map,
|
unsigned int get(const CGAL::Arr_vertex_index_map<Arrangement>& index_map,
|
||||||
typename Arrangement::Vertex_handle v)
|
typename Arrangement::Vertex_handle v)
|
||||||
{
|
{ return index_map[v]; }
|
||||||
return index_map[v];
|
|
||||||
}
|
|
||||||
|
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -274,109 +274,85 @@ protected:
|
||||||
*/
|
*/
|
||||||
class Curve_halfedges_observer : public Base_arr_2::Observer {
|
class Curve_halfedges_observer : public Base_arr_2::Observer {
|
||||||
public:
|
public:
|
||||||
|
using Base_aos = typename Base_arr_2::Base_aos;
|
||||||
|
|
||||||
typedef typename Base_arr_2::Halfedge_handle Halfedge_handle;
|
using Vertex_handle = typename Base_aos::Vertex_handle;
|
||||||
typedef typename Base_arr_2::Vertex_handle Vertex_handle;
|
using Halfedge_handle = typename Base_aos::Halfedge_handle;
|
||||||
typedef typename Base_arr_2::X_monotone_curve_2 X_monotone_curve_2;
|
using X_monotone_curve_2 = typename Base_aos::X_monotone_curve_2;
|
||||||
|
|
||||||
/*!
|
/*! Notification after the creation of a new edge.
|
||||||
* Notification after the creation of a new edge.
|
|
||||||
* \param e A handle to one of the twin halfedges that were created.
|
* \param e A handle to one of the twin halfedges that were created.
|
||||||
*/
|
*/
|
||||||
virtual void after_create_edge (Halfedge_handle e)
|
virtual void after_create_edge(Halfedge_handle e) override
|
||||||
{
|
{ _register_edge(e); }
|
||||||
_register_edge(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Notification before the modification of an existing edge.
|
* Notification before the modification of an existing edge.
|
||||||
* \param e A handle to one of the twin halfedges to be updated.
|
* \param e A handle to one of the twin halfedges to be updated.
|
||||||
* \param c The x-monotone curve to be associated with the edge.
|
* \param c The x-monotone curve to be associated with the edge.
|
||||||
*/
|
*/
|
||||||
virtual void before_modify_edge (Halfedge_handle e,
|
virtual void before_modify_edge(Halfedge_handle e,
|
||||||
const X_monotone_curve_2& /* c */)
|
const X_monotone_curve_2& /* c */) override
|
||||||
{
|
{ _unregister_edge(e); }
|
||||||
_unregister_edge(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an edge was modified.
|
||||||
* Notification after an edge was modified.
|
|
||||||
* \param e A handle to one of the twin halfedges that were updated.
|
* \param e A handle to one of the twin halfedges that were updated.
|
||||||
*/
|
*/
|
||||||
virtual void after_modify_edge (Halfedge_handle e)
|
virtual void after_modify_edge(Halfedge_handle e) override
|
||||||
{
|
{ _register_edge(e); }
|
||||||
_register_edge(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the splitting of an edge into two.
|
||||||
* Notification before the splitting of an edge into two.
|
|
||||||
* \param e A handle to one of the existing halfedges.
|
* \param e A handle to one of the existing halfedges.
|
||||||
* \param c1 The x-monotone curve to be associated with the first edge.
|
* \param c1 The x-monotone curve to be associated with the first edge.
|
||||||
* \param c2 The x-monotone curve to be associated with the second edge.
|
* \param c2 The x-monotone curve to be associated with the second edge.
|
||||||
*/
|
*/
|
||||||
virtual void before_split_edge (Halfedge_handle e,
|
virtual void before_split_edge(Halfedge_handle e,
|
||||||
Vertex_handle /* v */,
|
Vertex_handle /* v */,
|
||||||
const X_monotone_curve_2& /* c1 */,
|
const X_monotone_curve_2& /* c1 */,
|
||||||
const X_monotone_curve_2& /* c2 */)
|
const X_monotone_curve_2& /* c2 */) override
|
||||||
{
|
{ _unregister_edge(e); }
|
||||||
_unregister_edge(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an edge was split.
|
||||||
* Notification after an edge was split.
|
|
||||||
* \param e1 A handle to one of the twin halfedges forming the first edge.
|
* \param e1 A handle to one of the twin halfedges forming the first edge.
|
||||||
* \param e2 A handle to one of the twin halfedges forming the second edge.
|
* \param e2 A handle to one of the twin halfedges forming the second edge.
|
||||||
*/
|
*/
|
||||||
virtual void after_split_edge (Halfedge_handle e1, Halfedge_handle e2)
|
virtual void after_split_edge(Halfedge_handle e1, Halfedge_handle e2)
|
||||||
{
|
override {
|
||||||
_register_edge(e1);
|
_register_edge(e1);
|
||||||
_register_edge(e2);
|
_register_edge(e2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Notification before the merging of two edges.
|
||||||
* Notification before the merging of two edges.
|
|
||||||
* \param e1 A handle to one of the halfedges forming the first edge.
|
* \param e1 A handle to one of the halfedges forming the first edge.
|
||||||
* \param e2 A handle to one of the halfedges forming the second edge.
|
* \param e2 A handle to one of the halfedges forming the second edge.
|
||||||
* \param c The x-monotone curve to be associated with the merged edge.
|
* \param c The x-monotone curve to be associated with the merged edge.
|
||||||
*/
|
*/
|
||||||
virtual void before_merge_edge (Halfedge_handle e1, Halfedge_handle e2,
|
virtual void before_merge_edge(Halfedge_handle e1, Halfedge_handle e2,
|
||||||
const X_monotone_curve_2& /* c */)
|
const X_monotone_curve_2& /* c */) override {
|
||||||
{
|
|
||||||
_unregister_edge(e1);
|
_unregister_edge(e1);
|
||||||
_unregister_edge(e2);
|
_unregister_edge(e2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Notification after an edge was merged.
|
||||||
* Notification after an edge was merged.
|
|
||||||
* \param e A handle to one of the twin halfedges forming the merged edge.
|
* \param e A handle to one of the twin halfedges forming the merged edge.
|
||||||
*/
|
*/
|
||||||
virtual void after_merge_edge (Halfedge_handle e)
|
virtual void after_merge_edge(Halfedge_handle e) override
|
||||||
{
|
{ _register_edge(e); }
|
||||||
_register_edge(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the removal of an edge.
|
||||||
* Notification before the removal of an edge.
|
|
||||||
* \param e A handle to one of the twin halfedges to be deleted.
|
* \param e A handle to one of the twin halfedges to be deleted.
|
||||||
*/
|
*/
|
||||||
virtual void before_remove_edge (Halfedge_handle e)
|
virtual void before_remove_edge(Halfedge_handle e) override
|
||||||
{
|
{ _unregister_edge(e); }
|
||||||
_unregister_edge(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/*!
|
/*! Register the given halfedge in the set(s) associated with its curve.
|
||||||
* Register the given halfedge in the set(s) associated with its curve.
|
|
||||||
*/
|
*/
|
||||||
void _register_edge (Halfedge_handle e)
|
void _register_edge(Halfedge_handle e) {
|
||||||
{
|
for (auto di = e->curve().data().begin(); di != e->curve().data().end();
|
||||||
Curve_halfedges *curve_halfedges;
|
++di) {
|
||||||
Data_iterator di;
|
Curve_halfedges* curve_halfedges = static_cast<Curve_halfedges*>(*di);
|
||||||
|
|
||||||
for (di = e->curve().data().begin(); di != e->curve().data().end(); ++di)
|
|
||||||
{
|
|
||||||
curve_halfedges = static_cast<Curve_halfedges*>(*di);
|
|
||||||
curve_halfedges->_insert(e);
|
curve_halfedges->_insert(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,14 +360,10 @@ protected:
|
||||||
/*!
|
/*!
|
||||||
* Unregister the given halfedge from the set(s) associated with its curve.
|
* Unregister the given halfedge from the set(s) associated with its curve.
|
||||||
*/
|
*/
|
||||||
void _unregister_edge (Halfedge_handle e)
|
void _unregister_edge(Halfedge_handle e) {
|
||||||
{
|
for (auto di = e->curve().data().begin(); di != e->curve().data().end();
|
||||||
Curve_halfedges *curve_halfedges;
|
++di) {
|
||||||
Data_iterator di;
|
Curve_halfedges* curve_halfedges = static_cast<Curve_halfedges*>(*di);
|
||||||
|
|
||||||
for (di = e->curve().data().begin(); di != e->curve().data().end(); ++di)
|
|
||||||
{
|
|
||||||
curve_halfedges = static_cast<Curve_halfedges*>(*di);
|
|
||||||
curve_halfedges->_erase(e);
|
curve_halfedges->_erase(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,684 +33,509 @@ typedef Traits_2::Point_2 Point_2;
|
||||||
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
||||||
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
||||||
|
|
||||||
void skip_comments(std::ifstream & is, char * line)
|
void skip_comments(std::ifstream & is, char* line) {
|
||||||
{
|
|
||||||
while (!is.eof()) {
|
while (!is.eof()) {
|
||||||
is.getline(line, 128);
|
is.getline(line, 128);
|
||||||
if (line[0] != '#') break;
|
if (line[0] != '#') break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_results(std::string str)
|
void compare_results(std::string str) {
|
||||||
{
|
skip_comments(global_input_file, one_line);
|
||||||
skip_comments(global_input_file, one_line);
|
std::istringstream str_stream(one_line);
|
||||||
std::istringstream str_stream(one_line);
|
str_stream.getline(buff, 128, ' ');
|
||||||
str_stream.getline(buff, 128, ' ');
|
if (std::string(buff) != str) {
|
||||||
if (std::string(buff)!=str)
|
std::cout << "Expected " << std::string(buff) << " obtained "
|
||||||
{
|
<< str << std::endl;
|
||||||
std::cout << "Expected " << std::string(buff) << " obtained "
|
ok = -1;
|
||||||
<< str << std::endl;
|
}
|
||||||
ok=-1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// An arrangement observer, used to receive notifications of face splits and
|
// An arrangement observer, used to receive notifications of face splits and
|
||||||
// face mergers.
|
// face mergers.
|
||||||
class Test_observer : public Arrangement_2::Observer {
|
class Test_observer : public Arrangement_2::Observer {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Base_aos = typename Arrangement_2::Base_aos;
|
using Observer = Arrangement_2::Observer;
|
||||||
|
using Base_aos = Arrangement_2::Base_aos;
|
||||||
|
|
||||||
Test_observer(Arrangement_2& arr) : Arrangement_2::Observer(arr) {}
|
using Vertex_handle = Base_aos::Vertex_handle;
|
||||||
|
using Halfedge_handle = Base_aos::Halfedge_handle;
|
||||||
|
using Face_handle = Base_aos::Face_handle;
|
||||||
|
using Ccb_halfedge_circulator = Base_aos::Ccb_halfedge_circulator;
|
||||||
|
using Point_2 = Base_aos::Point_2;
|
||||||
|
using X_monotone_curve_2 = Base_aos::X_monotone_curve_2;
|
||||||
|
|
||||||
|
Test_observer(Base_aos& arr) : Observer(arr) {}
|
||||||
|
|
||||||
/// \name Notification functions on global arrangement operations.
|
/// \name Notification functions on global arrangement operations.
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/*! Notification before the arrangement is assigned with the content of another
|
/*! Notification before the arrangement is assigned with the content of
|
||||||
* arrangement.
|
* another arrangement.
|
||||||
* \param arr The other arrangement. Notice that the arrangement type is the type used to
|
* \param arr The other arrangement. Notice that the arrangement type is the
|
||||||
* instantiate the observer, which is conveniently defined as
|
* type used to instantiate the observer, which is conveniently
|
||||||
* `Arrangement_2::Base_aos`.
|
* defined as `Arrangement_2::Base_aos`.
|
||||||
*/
|
*/
|
||||||
virtual void before_assign (const Base_aos& /* arr */)
|
virtual void before_assign(const Base_aos& /* arr */) override
|
||||||
{ compare_results("before_assign"); }
|
{ compare_results("before_assign"); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Notification after the arrangement has been assigned with another
|
* Notification after the arrangement has been assigned with another
|
||||||
* arrangement.
|
* arrangement.
|
||||||
*/
|
*/
|
||||||
virtual void after_assign ()
|
virtual void after_assign() override { compare_results("after_assign"); }
|
||||||
{
|
|
||||||
compare_results("after_assign");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Notification before the arrangement is cleared. */
|
/*! Notification before the arrangement is cleared. */
|
||||||
virtual void before_clear ()
|
virtual void before_clear() override { compare_results("before_clear"); }
|
||||||
{
|
|
||||||
compare_results("before_clear");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Notification after the arrangement is cleared.
|
* Notification after the arrangement is cleared.
|
||||||
*/
|
*/
|
||||||
virtual void after_clear ()
|
virtual void after_clear() override { compare_results("after_clear"); }
|
||||||
{
|
|
||||||
compare_results("after_clear");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Notification before a global operation modifies the arrangement. */
|
/*! Notification before a global operation modifies the arrangement. */
|
||||||
virtual void before_global_change ()
|
virtual void before_global_change() override
|
||||||
{
|
{ compare_results("before_global_change"); }
|
||||||
compare_results("before_global_change");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Notification after a global operation is completed. */
|
/*! Notification after a global operation is completed. */
|
||||||
virtual void after_global_change ()
|
virtual void after_global_change() override
|
||||||
{
|
{ compare_results("after_global_change"); }
|
||||||
compare_results("after_global_change");
|
|
||||||
}
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// \name Notification functions on observer attachment or detachment.
|
/// \name Notification functions on observer attachment or detachment.
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/*!
|
/*! Notification before the observer is attached to an arrangement.
|
||||||
* Notification before the observer is attached to an arrangement.
|
|
||||||
* \param arr The arrangement we are about to attach the observer to.
|
* \param arr The arrangement we are about to attach the observer to.
|
||||||
*/
|
*/
|
||||||
virtual void before_attach (const Base_aos& /* arr */)
|
virtual void before_attach(const Base_aos& /* arr */) override
|
||||||
{
|
{ compare_results("before_attach"); }
|
||||||
compare_results("before_attach");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after the observer has been attached to an arrangement.
|
||||||
* Notification after the observer has been attached to an arrangement.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_attach ()
|
virtual void after_attach() override { compare_results("after_attach"); }
|
||||||
{
|
|
||||||
compare_results("after_attach");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the observer is detached from the arrangement.
|
||||||
* Notification before the observer is detached from the arrangement.
|
|
||||||
*/
|
*/
|
||||||
virtual void before_detach ()
|
virtual void before_detach() override { compare_results("before_detach"); }
|
||||||
{
|
|
||||||
compare_results("before_detach");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after the observer has been detached to the arrangement.
|
||||||
* Notification after the observer has been detached to the arrangement.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_detach ()
|
virtual void after_detach() override { compare_results("after_detach"); }
|
||||||
|
|
||||||
{
|
|
||||||
compare_results("after_detach");
|
|
||||||
}
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// \name Notification functions on local changes in the arrangement.
|
/// \name Notification functions on local changes in the arrangement.
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/*!
|
/*! Notification before the creation of a new vertex.
|
||||||
* Notification before the creation of a new vertex.
|
|
||||||
* \param p The point to be associated with the vertex.
|
* \param p The point to be associated with the vertex.
|
||||||
* This point cannot lies on the surface boundaries.
|
* This point cannot lies on the surface boundaries.
|
||||||
*/
|
*/
|
||||||
virtual void before_create_vertex (const Point_2& /* p */)
|
virtual void before_create_vertex(const Point_2& /* p */) override
|
||||||
{
|
{ compare_results("before_create_vertex"); }
|
||||||
compare_results("before_create_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after the creation of a new vertex.
|
||||||
* Notification after the creation of a new vertex.
|
|
||||||
* \param v A handle to the created vertex.
|
* \param v A handle to the created vertex.
|
||||||
*/
|
*/
|
||||||
virtual void after_create_vertex (Vertex_handle /* v */)
|
virtual void after_create_vertex(Vertex_handle /* v */) override
|
||||||
{
|
{ compare_results("after_create_vertex"); }
|
||||||
compare_results("after_create_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the creation of a new boundary vertex.
|
||||||
* Notification before the creation of a new boundary vertex.
|
|
||||||
* \param cv The curve incident to the surface boundary.
|
* \param cv The curve incident to the surface boundary.
|
||||||
* \param ind The relevant curve-end.
|
* \param ind The relevant curve-end.
|
||||||
* \param bound_x The boundary condition of the vertex in x.
|
* \param bound_x The boundary condition of the vertex in x.
|
||||||
* \param bound_y The boundary condition of the vertex in y.
|
* \param bound_y The boundary condition of the vertex in y.
|
||||||
*/
|
*/
|
||||||
virtual void before_create_boundary_vertex (const X_monotone_curve_2& /*cv*/,
|
virtual void
|
||||||
CGAL::Arr_curve_end /* ind */,
|
before_create_boundary_vertex(const X_monotone_curve_2& /*cv*/,
|
||||||
CGAL::Arr_parameter_space /* bound_x */,
|
CGAL::Arr_curve_end /* ind */,
|
||||||
CGAL::Arr_parameter_space /* bound_y */)
|
CGAL::Arr_parameter_space /* bound_x */,
|
||||||
{
|
CGAL::Arr_parameter_space /* bound_y */)
|
||||||
compare_results("before_create_boundary_vertex");
|
override
|
||||||
}
|
{ compare_results("before_create_boundary_vertex"); }
|
||||||
|
|
||||||
/*!
|
/*! Notification after the creation of a new vertex at infinity.
|
||||||
* Notification after the creation of a new vertex at infinity.
|
|
||||||
* \param v A handle to the created vertex.
|
* \param v A handle to the created vertex.
|
||||||
*/
|
*/
|
||||||
virtual void after_create_boundary_vertex (Vertex_handle /* v */)
|
virtual void after_create_boundary_vertex(Vertex_handle /* v */) override
|
||||||
{
|
{ compare_results("after_create_boundary_vertex"); }
|
||||||
compare_results("after_create_boundary_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the creation of a new edge.
|
||||||
* Notification before the creation of a new edge.
|
|
||||||
* \param c The x-monotone curve to be associated with the edge.
|
* \param c The x-monotone curve to be associated with the edge.
|
||||||
* \param v1 A handle to the first end-vertex of the edge.
|
* \param v1 A handle to the first end-vertex of the edge.
|
||||||
* \param v2 A handle to the second end-vertex of the edge.
|
* \param v2 A handle to the second end-vertex of the edge.
|
||||||
*/
|
*/
|
||||||
virtual void before_create_edge (const X_monotone_curve_2& /* c */,
|
virtual void before_create_edge(const X_monotone_curve_2& /* c */,
|
||||||
Vertex_handle /* v1 */,
|
Vertex_handle /* v1 */,
|
||||||
Vertex_handle /* v2 */)
|
Vertex_handle /* v2 */) override
|
||||||
{
|
{ compare_results("before_create_edge"); }
|
||||||
compare_results("before_create_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after the creation of a new edge.
|
||||||
* Notification after the creation of a new edge.
|
|
||||||
* \param e A handle to one of the twin halfedges that were created.
|
* \param e A handle to one of the twin halfedges that were created.
|
||||||
*/
|
*/
|
||||||
virtual void after_create_edge (Halfedge_handle /* e */)
|
virtual void after_create_edge(Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("after_create_edge"); }
|
||||||
compare_results("after_create_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the modification of an existing vertex.
|
||||||
* Notification before the modification of an existing vertex.
|
|
||||||
* \param v A handle to the vertex to be updated.
|
* \param v A handle to the vertex to be updated.
|
||||||
* \param p The point to be associated with the vertex.
|
* \param p The point to be associated with the vertex.
|
||||||
*/
|
*/
|
||||||
virtual void before_modify_vertex (Vertex_handle /* v */,
|
virtual void before_modify_vertex(Vertex_handle /* v */,
|
||||||
const Point_2& /* p */)
|
const Point_2& /* p */) override
|
||||||
{
|
{ compare_results("before_modify_vertex"); }
|
||||||
compare_results("before_modify_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after a vertex was modified.
|
||||||
* Notification after a vertex was modified.
|
|
||||||
* \param v A handle to the updated vertex.
|
* \param v A handle to the updated vertex.
|
||||||
*/
|
*/
|
||||||
virtual void after_modify_vertex (Vertex_handle /* v */)
|
virtual void after_modify_vertex(Vertex_handle /* v */) override
|
||||||
{
|
{ compare_results("after_modify_vertex"); }
|
||||||
compare_results("after_modify_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the modification of an existing edge.
|
||||||
* Notification before the modification of an existing edge.
|
|
||||||
* \param e A handle to one of the twin halfedges to be updated.
|
* \param e A handle to one of the twin halfedges to be updated.
|
||||||
* \param c The x-monotone curve to be associated with the edge.
|
* \param c The x-monotone curve to be associated with the edge.
|
||||||
*/
|
*/
|
||||||
virtual void before_modify_edge (Halfedge_handle /* e */,
|
virtual void before_modify_edge(Halfedge_handle /* e */,
|
||||||
const X_monotone_curve_2& /* c */)
|
const X_monotone_curve_2& /* c */) override
|
||||||
{
|
{ compare_results("before_modify_edge"); }
|
||||||
compare_results("before_modify_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an edge was modified.
|
||||||
* Notification after an edge was modified.
|
|
||||||
* \param e A handle to one of the twin halfedges that were updated.
|
* \param e A handle to one of the twin halfedges that were updated.
|
||||||
*/
|
*/
|
||||||
virtual void after_modify_edge (Halfedge_handle /* e */)
|
virtual void after_modify_edge(Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("after_modify_edge"); }
|
||||||
compare_results("after_modify_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the splitting of an edge into two.
|
||||||
* Notification before the splitting of an edge into two.
|
|
||||||
* \param e A handle to one of the existing halfedges.
|
* \param e A handle to one of the existing halfedges.
|
||||||
* \param v A vertex representing the split point.
|
* \param v A vertex representing the split point.
|
||||||
* \param c1 The x-monotone curve to be associated with the first edge.
|
* \param c1 The x-monotone curve to be associated with the first edge.
|
||||||
* \param c2 The x-monotone curve to be associated with the second edge.
|
* \param c2 The x-monotone curve to be associated with the second edge.
|
||||||
*/
|
*/
|
||||||
virtual void before_split_edge (Halfedge_handle /* e */,
|
virtual void before_split_edge(Halfedge_handle /* e */,
|
||||||
Vertex_handle /* v */,
|
Vertex_handle /* v */,
|
||||||
const X_monotone_curve_2& /* c1 */,
|
const X_monotone_curve_2& /* c1 */,
|
||||||
const X_monotone_curve_2& /* c2 */)
|
const X_monotone_curve_2& /* c2 */) override
|
||||||
{
|
{ compare_results("before_split_edge"); }
|
||||||
compare_results("before_split_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an edge was split.
|
||||||
* Notification after an edge was split.
|
|
||||||
* \param e1 A handle to one of the twin halfedges forming the first edge.
|
* \param e1 A handle to one of the twin halfedges forming the first edge.
|
||||||
* \param e2 A handle to one of the twin halfedges forming the second edge.
|
* \param e2 A handle to one of the twin halfedges forming the second edge.
|
||||||
*/
|
*/
|
||||||
virtual void after_split_edge (Halfedge_handle /* e1 */,
|
virtual void after_split_edge(Halfedge_handle /* e1 */,
|
||||||
Halfedge_handle /* e2 */)
|
Halfedge_handle /* e2 */) override
|
||||||
{
|
{ compare_results("after_split_edge"); }
|
||||||
compare_results("after_split_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the splitting of a fictitious edge into two.
|
||||||
* Notification before the splitting of a fictitious edge into two.
|
|
||||||
* \param e A handle to one of the existing halfedges.
|
* \param e A handle to one of the existing halfedges.
|
||||||
* \param v A vertex representing the unbounded split point.
|
* \param v A vertex representing the unbounded split point.
|
||||||
*/
|
*/
|
||||||
virtual void before_split_fictitious_edge (Halfedge_handle /* e */,
|
virtual void before_split_fictitious_edge(Halfedge_handle /* e */,
|
||||||
Vertex_handle /* v */)
|
Vertex_handle /* v */) override
|
||||||
{
|
{ compare_results("before_split_fictitious_edge"); }
|
||||||
compare_results("before_split_fictitious_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after a fictitious edge was split.
|
||||||
* Notification after a fictitious edge was split.
|
|
||||||
* \param e1 A handle to one of the twin halfedges forming the first edge.
|
* \param e1 A handle to one of the twin halfedges forming the first edge.
|
||||||
* \param e2 A handle to one of the twin halfedges forming the second edge.
|
* \param e2 A handle to one of the twin halfedges forming the second edge.
|
||||||
*/
|
*/
|
||||||
virtual void after_split_fictitious_edge (Halfedge_handle /* e1 */,
|
virtual void after_split_fictitious_edge(Halfedge_handle /* e1 */,
|
||||||
Halfedge_handle /* e2 */)
|
Halfedge_handle /* e2 */) override
|
||||||
{
|
{ compare_results("after_split_fictitious_edge"); }
|
||||||
compare_results("after_split_fictitious_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the splitting of a face into two.
|
||||||
* Notification before the splitting of a face into two.
|
|
||||||
* \param f A handle to the existing face.
|
* \param f A handle to the existing face.
|
||||||
* \param e The new edge whose insertion causes the face to split.
|
* \param e The new edge whose insertion causes the face to split.
|
||||||
*/
|
*/
|
||||||
virtual void before_split_face (Face_handle /* f */,
|
virtual void before_split_face(Face_handle /* f */,
|
||||||
Halfedge_handle /* e */)
|
Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("before_split_face"); }
|
||||||
compare_results("before_split_face");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after a face was split.
|
||||||
* Notification after a face was split.
|
|
||||||
* \param f A handle to the face we have just split.
|
* \param f A handle to the face we have just split.
|
||||||
* \param new_f A handle to the new face that has been created.
|
* \param new_f A handle to the new face that has been created.
|
||||||
* \param is_hole Whether the new face forms a hole inside f.
|
* \param is_hole Whether the new face forms a hole inside f.
|
||||||
*/
|
*/
|
||||||
virtual void after_split_face (Face_handle /* f */,
|
virtual void after_split_face (Face_handle /* f */,
|
||||||
Face_handle /* new_f */,
|
Face_handle /* new_f */,
|
||||||
bool /* is_hole */)
|
bool /* is_hole */) override
|
||||||
{
|
{ compare_results("after_split_face"); }
|
||||||
compare_results("after_split_face");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the splitting of an outer CCB into two.
|
||||||
* Notification before the splitting of an outer CCB into two.
|
|
||||||
* \param f A handle to the face that owns the outer CCB.
|
* \param f A handle to the face that owns the outer CCB.
|
||||||
* \param h A circulator representing the component boundary.
|
* \param h A circulator representing the component boundary.
|
||||||
* \param e The new edge whose removal causes the outer CCB to split.
|
* \param e The new edge whose removal causes the outer CCB to split.
|
||||||
*/
|
*/
|
||||||
virtual void before_split_outer_ccb (Face_handle /* f */,
|
virtual void before_split_outer_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h */,
|
Ccb_halfedge_circulator /* h */,
|
||||||
Halfedge_handle /* e */)
|
Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("before_split_outer_ccb"); }
|
||||||
compare_results("before_split_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an outer CCB was split.
|
||||||
* Notification after an outer CCB was split.
|
|
||||||
* \param f A handle to the face that owns the outer CCBs.
|
* \param f A handle to the face that owns the outer CCBs.
|
||||||
* \param h1 A circulator representing the boundary of the first component.
|
* \param h1 A circulator representing the boundary of the first component.
|
||||||
* \param h2 A circulator representing the boundary of the second component.
|
* \param h2 A circulator representing the boundary of the second component.
|
||||||
*/
|
*/
|
||||||
virtual void after_split_outer_ccb (Face_handle /* f */,
|
virtual void after_split_outer_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h1 */,
|
Ccb_halfedge_circulator /* h1 */,
|
||||||
Ccb_halfedge_circulator /* h2 */)
|
Ccb_halfedge_circulator /* h2 */) override
|
||||||
{
|
{ compare_results("after_split_outer_ccb"); }
|
||||||
compare_results("after_split_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the splitting of an inner CCB into two.
|
||||||
* Notification before the splitting of an inner CCB into two.
|
|
||||||
* \param f A handle to the face containing the inner CCB.
|
* \param f A handle to the face containing the inner CCB.
|
||||||
* \param h A circulator representing the component boundary.
|
* \param h A circulator representing the component boundary.
|
||||||
* \param e The new edge whose removal causes the inner CCB to split.
|
* \param e The new edge whose removal causes the inner CCB to split.
|
||||||
*/
|
*/
|
||||||
virtual void before_split_inner_ccb (Face_handle /* f */,
|
virtual void before_split_inner_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h */,
|
Ccb_halfedge_circulator /* h */,
|
||||||
Halfedge_handle /* e */)
|
Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("before_split_inner_ccb"); }
|
||||||
compare_results("before_split_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an inner CCB was split.
|
||||||
* Notification after an inner CCB was split.
|
|
||||||
* \param f A handle to the face containing the inner CCBs.
|
* \param f A handle to the face containing the inner CCBs.
|
||||||
* \param h1 A circulator representing the boundary of the first component.
|
* \param h1 A circulator representing the boundary of the first component.
|
||||||
* \param h2 A circulator representing the boundary of the second component.
|
* \param h2 A circulator representing the boundary of the second component.
|
||||||
*/
|
*/
|
||||||
virtual void after_split_inner_ccb (Face_handle /* f */,
|
virtual void after_split_inner_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h1 */,
|
Ccb_halfedge_circulator /* h1 */,
|
||||||
Ccb_halfedge_circulator /* h2 */)
|
Ccb_halfedge_circulator /* h2 */) override
|
||||||
{
|
{ compare_results("after_split_inner_ccb"); }
|
||||||
compare_results("after_split_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the creation of a new outer CCB of a face.
|
||||||
* Notification before the creation of a new outer CCB of a face.
|
|
||||||
* \param f A handle to the face that owns the outer CCB.
|
* \param f A handle to the face that owns the outer CCB.
|
||||||
* \param e A halfedge along the new outer CCB.
|
* \param e A halfedge along the new outer CCB.
|
||||||
*/
|
*/
|
||||||
virtual void before_add_outer_ccb (Face_handle /* f */,
|
virtual void before_add_outer_ccb(Face_handle /* f */,
|
||||||
Halfedge_handle /* e */)
|
Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("before_add_outer_ccb"); }
|
||||||
compare_results("before_add_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an outer CCB was added to a face.
|
||||||
* Notification after an outer CCB was added to a face.
|
|
||||||
* \param h A circulator representing the boundary of the new outer CCB.
|
* \param h A circulator representing the boundary of the new outer CCB.
|
||||||
*/
|
*/
|
||||||
virtual void after_add_outer_ccb (Ccb_halfedge_circulator /* h */)
|
virtual void after_add_outer_ccb(Ccb_halfedge_circulator /* h */) override
|
||||||
{
|
{ compare_results("after_add_outer_ccb"); }
|
||||||
compare_results("after_add_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the creation of a new inner CCB inside a face.
|
||||||
* Notification before the creation of a new inner CCB inside a face.
|
|
||||||
* \param f A handle to the face containing the inner CCB.
|
* \param f A handle to the face containing the inner CCB.
|
||||||
* \param e The new halfedge that forms the new inner CCB.
|
* \param e The new halfedge that forms the new inner CCB.
|
||||||
*/
|
*/
|
||||||
virtual void before_add_inner_ccb (Face_handle /* f */,
|
virtual void before_add_inner_ccb(Face_handle /* f */,
|
||||||
Halfedge_handle /* e */)
|
Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("before_add_inner_ccb"); }
|
||||||
compare_results("before_add_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an inner CCB was created inside a face.
|
||||||
* Notification after an inner CCB was created inside a face.
|
|
||||||
* \param h A circulator representing the boundary of the new inner CCB.
|
* \param h A circulator representing the boundary of the new inner CCB.
|
||||||
*/
|
*/
|
||||||
virtual void after_add_inner_ccb (Ccb_halfedge_circulator /* h */)
|
virtual void after_add_inner_ccb(Ccb_halfedge_circulator /* h */) override
|
||||||
{
|
{ compare_results("after_add_inner_ccb"); }
|
||||||
compare_results("after_add_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the creation of a new isolated vertex inside a face.
|
||||||
* Notification before the creation of a new isolated vertex inside a face.
|
|
||||||
* \param f A handle to the face containing the isolated vertex.
|
* \param f A handle to the face containing the isolated vertex.
|
||||||
* \param v The isolated vertex.
|
* \param v The isolated vertex.
|
||||||
*/
|
*/
|
||||||
virtual void before_add_isolated_vertex (Face_handle /* f */,
|
virtual void before_add_isolated_vertex(Face_handle /* f */,
|
||||||
Vertex_handle /* v */)
|
Vertex_handle /* v */) override
|
||||||
{
|
{ compare_results("before_add_isolated_vertex"); }
|
||||||
compare_results("before_add_isolated_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an isolated vertex was created inside a face.
|
||||||
* Notification after an isolated vertex was created inside a face.
|
|
||||||
* \param v The isolated vertex.
|
* \param v The isolated vertex.
|
||||||
*/
|
*/
|
||||||
virtual void after_add_isolated_vertex (Vertex_handle /* v */)
|
virtual void after_add_isolated_vertex(Vertex_handle /* v */) override
|
||||||
{
|
{ compare_results("after_add_isolated_vertex"); }
|
||||||
compare_results("after_add_isolated_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the merging of two edges.
|
||||||
* Notification before the merging of two edges.
|
|
||||||
* \param e1 A handle to one of the halfedges forming the first edge.
|
* \param e1 A handle to one of the halfedges forming the first edge.
|
||||||
* \param e2 A handle to one of the halfedges forming the second edge.
|
* \param e2 A handle to one of the halfedges forming the second edge.
|
||||||
* \param c The x-monotone curve to be associated with the merged edge.
|
* \param c The x-monotone curve to be associated with the merged edge.
|
||||||
*/
|
*/
|
||||||
virtual void before_merge_edge (Halfedge_handle /* e1 */,
|
virtual void before_merge_edge(Halfedge_handle /* e1 */,
|
||||||
Halfedge_handle /* e2 */,
|
Halfedge_handle /* e2 */,
|
||||||
const X_monotone_curve_2& /* c */)
|
const X_monotone_curve_2& /* c */) override
|
||||||
{
|
{ compare_results("before_merge_edge"); }
|
||||||
compare_results("before_merge_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an edge was merged.
|
||||||
* Notification after an edge was merged.
|
|
||||||
* \param e A handle to one of the twin halfedges forming the merged edge.
|
* \param e A handle to one of the twin halfedges forming the merged edge.
|
||||||
*/
|
*/
|
||||||
virtual void after_merge_edge (Halfedge_handle /* e */)
|
virtual void after_merge_edge(Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("after_merge_edge"); }
|
||||||
compare_results("after_merge_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Notification before the merging of two fictitious edges.
|
* Notification before the merging of two fictitious edges.
|
||||||
* \param e1 A handle to one of the halfedges forming the first edge.
|
* \param e1 A handle to one of the halfedges forming the first edge.
|
||||||
* \param e2 A handle to one of the halfedges forming the second edge.
|
* \param e2 A handle to one of the halfedges forming the second edge.
|
||||||
*/
|
*/
|
||||||
virtual void before_merge_fictitious_edge (Halfedge_handle /* e1 */,
|
virtual void before_merge_fictitious_edge(Halfedge_handle /* e1 */,
|
||||||
Halfedge_handle /* e2 */)
|
Halfedge_handle /* e2 */) override
|
||||||
{
|
{ compare_results("before_merge_fictitious_edge"); }
|
||||||
compare_results("before_merge_fictitious_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after a fictitious edge was merged.
|
||||||
* Notification after a fictitious edge was merged.
|
|
||||||
* \param e A handle to one of the twin halfedges forming the merged edge.
|
* \param e A handle to one of the twin halfedges forming the merged edge.
|
||||||
*/
|
*/
|
||||||
virtual void after_merge_fictitious_edge (Halfedge_handle /* e */)
|
virtual void after_merge_fictitious_edge (Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("after_merge_fictitious_edge"); }
|
||||||
compare_results("after_merge_fictitious_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the merging of two faces.
|
||||||
* Notification before the merging of two faces.
|
|
||||||
* \param f1 A handle to the first face.
|
* \param f1 A handle to the first face.
|
||||||
* \param f2 A handle to the second face.
|
* \param f2 A handle to the second face.
|
||||||
* \param e The edge whose removal causes the faces to merge.
|
* \param e The edge whose removal causes the faces to merge.
|
||||||
*/
|
*/
|
||||||
virtual void before_merge_face (Face_handle /* f1 */,
|
virtual void before_merge_face(Face_handle /* f1 */,
|
||||||
Face_handle /* f2 */,
|
Face_handle /* f2 */,
|
||||||
Halfedge_handle /* e */)
|
Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("before_merge_face"); }
|
||||||
compare_results("before_merge_face");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after a face was merged.
|
||||||
* Notification after a face was merged.
|
|
||||||
* \param f A handle to the merged face.
|
* \param f A handle to the merged face.
|
||||||
*/
|
*/
|
||||||
virtual void after_merge_face (Face_handle /* f */)
|
virtual void after_merge_face(Face_handle /* f */) override
|
||||||
{
|
{ compare_results("after_merge_face"); }
|
||||||
compare_results("after_merge_face");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the merging of two outer CCBs.
|
||||||
* Notification before the merging of two outer CCBs.
|
|
||||||
* \param f A handle to the face that owns the outer CCBs.
|
* \param f A handle to the face that owns the outer CCBs.
|
||||||
* \param h1 A circulator representing the boundary of the first component.
|
* \param h1 A circulator representing the boundary of the first component.
|
||||||
* \param h2 A circulator representing the boundary of the second component.
|
* \param h2 A circulator representing the boundary of the second component.
|
||||||
* \param e The edge whose insertion or removal causes the CCBs to merge.
|
* \param e The edge whose insertion or removal causes the CCBs to merge.
|
||||||
*/
|
*/
|
||||||
virtual void before_merge_outer_ccb (Face_handle /* f */,
|
virtual void before_merge_outer_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h1 */,
|
Ccb_halfedge_circulator /* h1 */,
|
||||||
Ccb_halfedge_circulator /* h2 */,
|
Ccb_halfedge_circulator /* h2 */,
|
||||||
Halfedge_handle /* e */)
|
Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("before_merge_outer_ccb"); }
|
||||||
compare_results("before_merge_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an outer CCB was merged.
|
||||||
* Notification after an outer CCB was merged.
|
|
||||||
* \param f A handle to the face that owns the outer CCBs.
|
* \param f A handle to the face that owns the outer CCBs.
|
||||||
* \param h A circulator representing the boundary of the merged component.
|
* \param h A circulator representing the boundary of the merged component.
|
||||||
*/
|
*/
|
||||||
virtual void after_merge_outer_ccb (Face_handle /* f */,
|
virtual void after_merge_outer_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h */)
|
Ccb_halfedge_circulator /* h */)
|
||||||
{
|
{ compare_results("after_merge_outer_ccb"); }
|
||||||
compare_results("after_merge_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the merging of two inner CCBs (holes).
|
||||||
* Notification before the merging of two inner CCBs (holes).
|
|
||||||
* \param f A handle to the face that contains the inner CCBs.
|
* \param f A handle to the face that contains the inner CCBs.
|
||||||
* \param h1 A circulator representing the boundary of the first component.
|
* \param h1 A circulator representing the boundary of the first component.
|
||||||
* \param h2 A circulator representing the boundary of the second component.
|
* \param h2 A circulator representing the boundary of the second component.
|
||||||
* \param e The edge whose insertion causes the inner CCBs to merge.
|
* \param e The edge whose insertion causes the inner CCBs to merge.
|
||||||
*/
|
*/
|
||||||
virtual void before_merge_inner_ccb (Face_handle /* f */,
|
virtual void before_merge_inner_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h1 */,
|
Ccb_halfedge_circulator /* h1 */,
|
||||||
Ccb_halfedge_circulator /* h2 */,
|
Ccb_halfedge_circulator /* h2 */,
|
||||||
Halfedge_handle /* e */)
|
Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("before_merge_inner_ccb"); }
|
||||||
compare_results("before_merge_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an inner CCB was merged.
|
||||||
* Notification after an inner CCB was merged.
|
|
||||||
* \param f A handle to the face that contains the inner CCBs.
|
* \param f A handle to the face that contains the inner CCBs.
|
||||||
* \param h A circulator representing the boundary of the merged component.
|
* \param h A circulator representing the boundary of the merged component.
|
||||||
*/
|
*/
|
||||||
virtual void after_merge_inner_ccb (Face_handle /* f */,
|
virtual void after_merge_inner_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h */)
|
Ccb_halfedge_circulator /* h */) override
|
||||||
{
|
{ compare_results("after_merge_inner_ccb"); }
|
||||||
compare_results("after_merge_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before an outer CCB is moved from one face to another.
|
||||||
* Notification before an outer CCB is moved from one face to another.
|
|
||||||
* \param from_f A handle to the face that currently owns the outer CCB.
|
* \param from_f A handle to the face that currently owns the outer CCB.
|
||||||
* \param to_f A handle to the face that should own the outer CCB.
|
* \param to_f A handle to the face that should own the outer CCB.
|
||||||
* \param h A circulator representing the boundary of the component.
|
* \param h A circulator representing the boundary of the component.
|
||||||
*/
|
*/
|
||||||
virtual void before_move_outer_ccb (Face_handle /* from_f */,
|
virtual void before_move_outer_ccb(Face_handle /* from_f */,
|
||||||
Face_handle /* to_f */,
|
Face_handle /* to_f */,
|
||||||
Ccb_halfedge_circulator /* h */)
|
Ccb_halfedge_circulator /* h */) override
|
||||||
{
|
{ compare_results("before_move_outer_ccb"); }
|
||||||
compare_results("before_move_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an outer CCB is moved from one face to another.
|
||||||
* Notification after an outer CCB is moved from one face to another.
|
|
||||||
* \param h A circulator representing the boundary of the component.
|
* \param h A circulator representing the boundary of the component.
|
||||||
*/
|
*/
|
||||||
virtual void after_move_outer_ccb (Ccb_halfedge_circulator /* h */)
|
virtual void after_move_outer_ccb(Ccb_halfedge_circulator /* h */) override
|
||||||
{
|
{ compare_results("after_move_outer_ccb"); }
|
||||||
compare_results("after_move_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before an inner CCB is moved from one face to another.
|
||||||
* Notification before an inner CCB is moved from one face to another.
|
|
||||||
* \param from_f A handle to the face currently containing the inner CCB.
|
* \param from_f A handle to the face currently containing the inner CCB.
|
||||||
* \param to_f A handle to the face that should contain the inner CCB.
|
* \param to_f A handle to the face that should contain the inner CCB.
|
||||||
* \param h A circulator representing the boundary of the component.
|
* \param h A circulator representing the boundary of the component.
|
||||||
*/
|
*/
|
||||||
virtual void before_move_inner_ccb (Face_handle /* from_f */,
|
virtual void before_move_inner_ccb(Face_handle /* from_f */,
|
||||||
Face_handle /* to_f */,
|
Face_handle /* to_f */,
|
||||||
Ccb_halfedge_circulator /* h */)
|
Ccb_halfedge_circulator /* h */) override
|
||||||
{
|
{ compare_results("before_move_inner_ccb"); }
|
||||||
compare_results("before_move_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an inner CCB is moved from one face to another.
|
||||||
* Notification after an inner CCB is moved from one face to another.
|
|
||||||
* \param h A circulator representing the boundary of the component.
|
* \param h A circulator representing the boundary of the component.
|
||||||
*/
|
*/
|
||||||
virtual void after_move_inner_ccb (Ccb_halfedge_circulator /* h */)
|
virtual void after_move_inner_ccb(Ccb_halfedge_circulator /* h */) override
|
||||||
{
|
{ compare_results("after_move_inner_ccb"); }
|
||||||
compare_results("after_move_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before an isolated vertex is moved from one face to another.
|
||||||
* Notification before an isolated vertex is moved from one face to another.
|
|
||||||
* \param from_f A handle to the face currently containing the vertex.
|
* \param from_f A handle to the face currently containing the vertex.
|
||||||
* \param to_f A handle to the face that should contain the vertex.
|
* \param to_f A handle to the face that should contain the vertex.
|
||||||
* \param v The isolated vertex.
|
* \param v The isolated vertex.
|
||||||
*/
|
*/
|
||||||
virtual void before_move_isolated_vertex (Face_handle /* from_f */,
|
virtual void before_move_isolated_vertex(Face_handle /* from_f */,
|
||||||
Face_handle /* to_f */,
|
Face_handle /* to_f */,
|
||||||
Vertex_handle /* v */)
|
Vertex_handle /* v */) override
|
||||||
{
|
{ compare_results("before_move_isolated_vertex"); }
|
||||||
compare_results("before_move_isolated_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification after an isolated vertex is moved from one face to another.
|
||||||
* Notification after an isolated vertex is moved from one face to another.
|
|
||||||
* \param v The isolated vertex.
|
* \param v The isolated vertex.
|
||||||
*/
|
*/
|
||||||
virtual void after_move_isolated_vertex (Vertex_handle /* v */)
|
virtual void after_move_isolated_vertex(Vertex_handle /* v */) override
|
||||||
{
|
{ compare_results("after_move_isolated_vertex"); }
|
||||||
compare_results("after_move_isolated_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notificaion before the removal of a vertex.
|
||||||
* Notificaion before the removal of a vertex.
|
|
||||||
* \param v A handle to the vertex to be deleted.
|
* \param v A handle to the vertex to be deleted.
|
||||||
*/
|
*/
|
||||||
virtual void before_remove_vertex (Vertex_handle /* v */)
|
virtual void before_remove_vertex(Vertex_handle /* v */) override
|
||||||
{
|
{ compare_results("before_remove_vertex"); }
|
||||||
compare_results("before_remove_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notificaion after the removal of a vertex.
|
||||||
* Notificaion after the removal of a vertex.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_remove_vertex ()
|
virtual void after_remove_vertex() override
|
||||||
{
|
{ compare_results("after_remove_vertex"); }
|
||||||
compare_results("after_remove_vertex");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the removal of an edge.
|
||||||
* Notification before the removal of an edge.
|
|
||||||
* \param e A handle to one of the twin halfedges to be deleted.
|
* \param e A handle to one of the twin halfedges to be deleted.
|
||||||
*/
|
*/
|
||||||
virtual void before_remove_edge (Halfedge_handle /* e */)
|
virtual void before_remove_edge(Halfedge_handle /* e */) override
|
||||||
{
|
{ compare_results("before_remove_edge"); }
|
||||||
compare_results("before_remove_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notificaion after the removal of an edge.
|
||||||
* Notificaion after the removal of an edge.
|
|
||||||
*/
|
*/
|
||||||
virtual void after_remove_edge ()
|
virtual void after_remove_edge() override
|
||||||
{
|
{ compare_results("after_remove_edge"); }
|
||||||
compare_results("after_remove_edge");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the removal of an outer CCB.
|
||||||
* Notification before the removal of an outer CCB.
|
|
||||||
* \param f The face that owns the outer CCB.
|
* \param f The face that owns the outer CCB.
|
||||||
* \param h A circulator representing the boundary of the component.
|
* \param h A circulator representing the boundary of the component.
|
||||||
*/
|
*/
|
||||||
virtual void before_remove_outer_ccb (Face_handle /* f */,
|
virtual void before_remove_outer_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h */)
|
Ccb_halfedge_circulator /* h */) override
|
||||||
{
|
{ compare_results("before_remove_outer_ccb"); }
|
||||||
compare_results("before_remove_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notificaion after the removal of an outer CCB.
|
||||||
* Notificaion after the removal of an outer CCB.
|
|
||||||
* \param f The face that used to own the outer CCB.
|
* \param f The face that used to own the outer CCB.
|
||||||
*/
|
*/
|
||||||
virtual void after_remove_outer_ccb (Face_handle /* f */)
|
virtual void after_remove_outer_ccb(Face_handle /* f */) override
|
||||||
{
|
{ compare_results("after_remove_outer_ccb"); }
|
||||||
compare_results("after_remove_outer_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notification before the removal of an inner CCB.
|
||||||
* Notification before the removal of an inner CCB.
|
|
||||||
* \param f The face containing the inner CCB.
|
* \param f The face containing the inner CCB.
|
||||||
* \param h A circulator representing the boundary of the component.
|
* \param h A circulator representing the boundary of the component.
|
||||||
*/
|
*/
|
||||||
virtual void before_remove_inner_ccb (Face_handle /* f */,
|
virtual void before_remove_inner_ccb(Face_handle /* f */,
|
||||||
Ccb_halfedge_circulator /* h */)
|
Ccb_halfedge_circulator /* h */) override
|
||||||
{
|
{ compare_results("before_remove_inner_ccb"); }
|
||||||
compare_results("before_remove_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Notificaion after the removal of an inner CCB.
|
||||||
* Notificaion after the removal of an inner CCB.
|
|
||||||
* \param f The face that used to contain the inner CCB.
|
* \param f The face that used to contain the inner CCB.
|
||||||
*/
|
*/
|
||||||
virtual void after_remove_inner_ccb (Face_handle /* f */)
|
virtual void after_remove_inner_ccb(Face_handle /* f */) override
|
||||||
{
|
{ compare_results("after_remove_inner_ccb"); }
|
||||||
compare_results("after_remove_inner_ccb");
|
|
||||||
}
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int main (int argc, char * argv[])
|
int main (int argc, char* argv[]) {
|
||||||
{
|
if (argc != 2) {
|
||||||
if (argc != 2)
|
|
||||||
{
|
|
||||||
std::cout << "Usage: " << argv[0] << " inputfile" << std::endl;
|
std::cout << "Usage: " << argv[0] << " inputfile" << std::endl;
|
||||||
CGAL_error();
|
CGAL_error();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// Construct the arrangement containing one diamond-shaped face.
|
// Construct the arrangement containing one diamond-shaped face.
|
||||||
Arrangement_2 arr;
|
Arrangement_2 arr;
|
||||||
global_input_file.open(argv[1]);
|
global_input_file.open(argv[1]);
|
||||||
|
|
@ -721,55 +546,48 @@ int main (int argc, char * argv[])
|
||||||
int i_vh = 0, i_heh = 0;
|
int i_vh = 0, i_heh = 0;
|
||||||
std::vector<Arrangement_2::Halfedge_handle> heh_vec;
|
std::vector<Arrangement_2::Halfedge_handle> heh_vec;
|
||||||
std::vector<Arrangement_2::Vertex_handle> vh_vec;
|
std::vector<Arrangement_2::Vertex_handle> vh_vec;
|
||||||
while (!global_input_file.eof())
|
while (! global_input_file.eof()) {
|
||||||
{
|
|
||||||
skip_comments(global_input_file, one_line);
|
skip_comments(global_input_file, one_line);
|
||||||
std::istringstream str_stream(one_line);
|
std::istringstream str_stream(one_line);
|
||||||
char c;
|
char c;
|
||||||
str_stream >> c;
|
str_stream >> c;
|
||||||
if (!global_input_file.gcount())
|
if (!global_input_file.gcount())
|
||||||
break;
|
break;
|
||||||
if (c=='s')
|
if (c=='s') {
|
||||||
{
|
|
||||||
str_stream >> c;
|
str_stream >> c;
|
||||||
//read segment
|
//read segment
|
||||||
str_stream >> s;
|
str_stream >> s;
|
||||||
if (c=='i')
|
if (c=='i') {
|
||||||
{
|
|
||||||
// si means insert intersecting segment
|
// si means insert intersecting segment
|
||||||
insert(arr,s);
|
insert(arr,s);
|
||||||
std::cout << "intersecting segment insert " << s << std::endl;
|
std::cout << "intersecting segment insert " << s << std::endl;
|
||||||
}
|
}
|
||||||
else if (c=='n')
|
else if (c=='n') {
|
||||||
{
|
|
||||||
// sn means insert non intersecting segment
|
// sn means insert non intersecting segment
|
||||||
heh_vec.push_back(insert_non_intersecting_curve (arr, s));
|
heh_vec.push_back(insert_non_intersecting_curve (arr, s));
|
||||||
std::cout << "non intersecting segment insert " << s << std::endl;
|
std::cout << "non intersecting segment insert " << s << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c=='p')
|
else if (c=='p') {
|
||||||
{
|
|
||||||
// p means read point
|
// p means read point
|
||||||
str_stream >> p ;
|
str_stream >> p ;
|
||||||
std::cout << "point insert " << p << " index " << vh_vec.size() << std::endl;
|
std::cout << "point insert " << p << " index " << vh_vec.size()
|
||||||
|
<< std::endl;
|
||||||
vh_vec.push_back(insert_point(arr,p));
|
vh_vec.push_back(insert_point(arr,p));
|
||||||
}
|
}
|
||||||
else if (c=='e')
|
else if (c=='e') {
|
||||||
{
|
|
||||||
// e means read edge index to be removed
|
// e means read edge index to be removed
|
||||||
str_stream >> i_heh ;
|
str_stream >> i_heh ;
|
||||||
std::cout << "remove edge " << heh_vec[i_heh]->curve() << std::endl;
|
std::cout << "remove edge " << heh_vec[i_heh]->curve() << std::endl;
|
||||||
remove_edge(arr,heh_vec[i_heh]);
|
remove_edge(arr,heh_vec[i_heh]);
|
||||||
}
|
}
|
||||||
else if (c=='v')
|
else if (c=='v') {
|
||||||
{
|
|
||||||
// v means read point index to be removed
|
// v means read point index to be removed
|
||||||
str_stream >> i_vh ;
|
str_stream >> i_vh ;
|
||||||
std::cout << "remove point " << vh_vec[i_vh]->point() << std::endl;
|
std::cout << "remove point " << vh_vec[i_vh]->point() << std::endl;
|
||||||
remove_vertex(arr,vh_vec[i_vh]);
|
remove_vertex(arr,vh_vec[i_vh]);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
//error
|
//error
|
||||||
std::cout << "error, unknowen command" << std::endl;
|
std::cout << "error, unknowen command" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -1584,19 +1584,16 @@ protected:
|
||||||
|
|
||||||
// observer for the minimization diagram
|
// observer for the minimization diagram
|
||||||
// keeps the relevant data in the new faces
|
// keeps the relevant data in the new faces
|
||||||
class Keep_face_data_observer : public Md_observer
|
class Keep_face_data_observer : public Md_observer {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
typedef typename Minimization_diagram_2::Face_handle Face_handle;
|
using Base_aos = typename Minimization_diagram_2::Base_aos;
|
||||||
|
using Face_handle = typename Base_aos::Face_handle;
|
||||||
|
|
||||||
Keep_face_data_observer(Minimization_diagram_2& arr) :
|
Keep_face_data_observer(Base_aos& arr) : Md_observer(arr) {}
|
||||||
Md_observer(arr)
|
|
||||||
{}
|
|
||||||
|
|
||||||
virtual void after_split_face(Face_handle org_f,
|
virtual void after_split_face(Face_handle org_f,
|
||||||
Face_handle new_f,
|
Face_handle new_f,
|
||||||
bool /* is_hole*/)
|
bool /* is_hole*/) override {
|
||||||
{
|
|
||||||
// update data in the new face from the original face
|
// update data in the new face from the original face
|
||||||
if (org_f->get_aux_is_set(0))
|
if (org_f->get_aux_is_set(0))
|
||||||
new_f->set_aux_source(0, org_f->get_aux_source(0));
|
new_f->set_aux_source(0, org_f->get_aux_source(0));
|
||||||
|
|
@ -1610,34 +1607,30 @@ protected:
|
||||||
|
|
||||||
// observer for the minimization diagram
|
// observer for the minimization diagram
|
||||||
// keeps the relevant data in the new edges & vertices
|
// keeps the relevant data in the new edges & vertices
|
||||||
class Keep_edge_data_observer : public Md_observer
|
class Keep_edge_data_observer : public Md_observer {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
typedef typename Minimization_diagram_2::Halfedge_handle Halfedge_handle;
|
using Base_aos = typename Minimization_diagram_2::Base_aos;
|
||||||
typedef typename Minimization_diagram_2::Vertex_handle Vertex_handle;
|
using Vertex_handle = typename Base_aos::Vertex_handle;
|
||||||
typedef typename Minimization_diagram_2::X_monotone_curve_2
|
using Halfedge_handle = typename Base_aos::Halfedge_handle;
|
||||||
X_monotone_curve_2;
|
using X_monotone_curve_2 = typename Base_aos::X_monotone_curve_2;
|
||||||
|
|
||||||
typedef typename Envelope_divide_and_conquer_3<Traits,
|
using Self = typename Envelope_divide_and_conquer_3<Traits,
|
||||||
Minimization_diagram_2,
|
Minimization_diagram_2,
|
||||||
EnvelopeResolver_3,
|
EnvelopeResolver_3,
|
||||||
Overlay_2>::Self Self;
|
Overlay_2>::Self;
|
||||||
Keep_edge_data_observer(Minimization_diagram_2& arr,
|
Keep_edge_data_observer(Base_aos& arr, Self* b) :
|
||||||
Self* b) :
|
|
||||||
Md_observer(arr), base(b)
|
Md_observer(arr), base(b)
|
||||||
{
|
{ CGAL_assertion(base != nullptr); }
|
||||||
CGAL_assertion(base != nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* virtual void before_split_edge (Halfedge_handle e,
|
/* virtual void before_split_edge(Halfedge_handle e,
|
||||||
* Vertex_handle v,
|
* Vertex_handle v,
|
||||||
* const X_monotone_curve_2& c1,
|
* const X_monotone_curve_2& c1,
|
||||||
* const X_monotone_curve_2& c2)
|
* const X_monotone_curve_2& c2)
|
||||||
* {}
|
* {}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual void after_split_edge(Halfedge_handle he1, Halfedge_handle he2)
|
virtual void after_split_edge(Halfedge_handle he1, Halfedge_handle he2)
|
||||||
{
|
override {
|
||||||
// update data of the new vertex, which is the common vertex of he1 and
|
// update data of the new vertex, which is the common vertex of he1 and
|
||||||
// he2, and of the new edge according to the data in the original edge
|
// he2, and of the new edge according to the data in the original edge
|
||||||
CGAL_assertion(he2->source() == he1->target());
|
CGAL_assertion(he2->source() == he1->target());
|
||||||
|
|
@ -1657,20 +1650,17 @@ protected:
|
||||||
// the second halfedge
|
// the second halfedge
|
||||||
Halfedge_handle org_he = he1, new_he = he2;
|
Halfedge_handle org_he = he1, new_he = he2;
|
||||||
|
|
||||||
if (org_he->is_decision_set())
|
if (org_he->is_decision_set()) {
|
||||||
{
|
|
||||||
new_he->set_decision(org_he->get_decision());
|
new_he->set_decision(org_he->get_decision());
|
||||||
new_he->twin()->set_decision(org_he->get_decision());
|
new_he->twin()->set_decision(org_he->get_decision());
|
||||||
new_vertex->set_decision(org_he->get_decision());
|
new_vertex->set_decision(org_he->get_decision());
|
||||||
}
|
}
|
||||||
if (org_he->get_aux_is_set(0))
|
if (org_he->get_aux_is_set(0)) {
|
||||||
{
|
|
||||||
new_vertex->set_aux_source(0, org_he->get_aux_source(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->set_aux_source(0, org_he->get_aux_source(0));
|
||||||
new_he->twin()->set_aux_source(0, org_he->twin()->get_aux_source(0));
|
new_he->twin()->set_aux_source(0, org_he->twin()->get_aux_source(0));
|
||||||
}
|
}
|
||||||
if (org_he->get_aux_is_set(1))
|
if (org_he->get_aux_is_set(1)) {
|
||||||
{
|
|
||||||
new_vertex->set_aux_source(1, org_he->get_aux_source(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->set_aux_source(1, org_he->get_aux_source(1));
|
||||||
new_he->twin()->set_aux_source(1, org_he->twin()->get_aux_source(1));
|
new_he->twin()->set_aux_source(1, org_he->twin()->get_aux_source(1));
|
||||||
|
|
|
||||||
|
|
@ -1978,14 +1978,13 @@ protected:
|
||||||
// so we can later identify all the faces that form the original given face
|
// so we can later identify all the faces that form the original given face
|
||||||
// it also should remember the edges of the face, that are also projected
|
// it also should remember the edges of the face, that are also projected
|
||||||
// intersections
|
// intersections
|
||||||
class Copied_face_observer : public Md_observer
|
class Copied_face_observer : public Md_observer {
|
||||||
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
typedef typename Minimization_diagram_2::Face_handle Face_handle;
|
using Base_aos = typename Minimization_diagram_2::Base_aos;
|
||||||
typedef typename Minimization_diagram_2::Halfedge_handle Halfedge_handle;
|
|
||||||
typedef typename Minimization_diagram_2::X_monotone_curve_2
|
using Face_handle = typename Base_aos::Face_handle;
|
||||||
X_monotone_curve_2;
|
using Halfedge_handle = typename Base_aos::Halfedge_handle;
|
||||||
|
using X_monotone_curve_2 = typename Base_aos::X_monotone_curve_2;
|
||||||
|
|
||||||
Copied_face_observer(Halfedges_map& map_h) : map_halfedges(map_h) {}
|
Copied_face_observer(Halfedges_map& map_h) : map_halfedges(map_h) {}
|
||||||
|
|
||||||
|
|
@ -1997,8 +1996,7 @@ protected:
|
||||||
Faces_hash& parts,
|
Faces_hash& parts,
|
||||||
Vertices_hash& boundaryv,
|
Vertices_hash& boundaryv,
|
||||||
Vertices_hash& specialv,
|
Vertices_hash& specialv,
|
||||||
Vertices_to_edges_map& v_to_h)
|
Vertices_to_edges_map& v_to_h) {
|
||||||
{
|
|
||||||
boundary_halfedges = &boundary;
|
boundary_halfedges = &boundary;
|
||||||
special_edges = &specialh;
|
special_edges = &specialh;
|
||||||
new_edges = &newh;
|
new_edges = &newh;
|
||||||
|
|
@ -2009,20 +2007,16 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void after_split_face(Face_handle org_f,
|
virtual void after_split_face(Face_handle org_f,
|
||||||
Face_handle new_f, bool)
|
Face_handle new_f, bool) override {
|
||||||
{
|
|
||||||
// keep track of the face parts
|
// keep track of the face parts
|
||||||
if (face_parts->is_defined(org_f))
|
if (face_parts->is_defined(org_f))
|
||||||
(*face_parts)[new_f] = face_parts->default_value();
|
(*face_parts)[new_f] = face_parts->default_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void after_split_edge(Halfedge_handle org_he,
|
virtual void after_split_edge(Halfedge_handle org_he,
|
||||||
Halfedge_handle new_he)
|
Halfedge_handle new_he) override {
|
||||||
{
|
|
||||||
// take care of special edges that were split
|
// take care of special edges that were split
|
||||||
if (special_edges->is_defined(org_he))
|
if (special_edges->is_defined(org_he)) {
|
||||||
|
|
||||||
{
|
|
||||||
// if original edge was in the set, then now both split parts should
|
// if original edge was in the set, then now both split parts should
|
||||||
// be in the set
|
// be in the set
|
||||||
(*special_edges)[new_he] = special_edges->default_value();
|
(*special_edges)[new_he] = special_edges->default_value();
|
||||||
|
|
@ -2030,15 +2024,13 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
// take care of new edges that were split
|
// take care of new edges that were split
|
||||||
if (new_edges->is_defined(org_he))
|
if (new_edges->is_defined(org_he)) {
|
||||||
{
|
|
||||||
(*new_edges)[new_he] = (*new_edges)[org_he];
|
(*new_edges)[new_he] = (*new_edges)[org_he];
|
||||||
(*new_edges)[new_he->twin()] = (*new_edges)[org_he];
|
(*new_edges)[new_he->twin()] = (*new_edges)[org_he];
|
||||||
}
|
}
|
||||||
|
|
||||||
// take care for boundary edges
|
// take care for boundary edges
|
||||||
if (boundary_halfedges->is_defined(org_he))
|
if (boundary_halfedges->is_defined(org_he)) {
|
||||||
{
|
|
||||||
(*boundary_halfedges)[new_he] = boundary_halfedges->default_value();
|
(*boundary_halfedges)[new_he] = boundary_halfedges->default_value();
|
||||||
(*boundary_halfedges)[new_he->twin()] =
|
(*boundary_halfedges)[new_he->twin()] =
|
||||||
boundary_halfedges->default_value();
|
boundary_halfedges->default_value();
|
||||||
|
|
@ -2065,8 +2057,7 @@ protected:
|
||||||
Halfedge_handle correct_side_he;
|
Halfedge_handle correct_side_he;
|
||||||
if (face_parts->is_defined(org_he->face()))
|
if (face_parts->is_defined(org_he->face()))
|
||||||
correct_side_he = org_he;
|
correct_side_he = org_he;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
CGAL_assertion(face_parts->is_defined(new_he->twin()->face()));
|
CGAL_assertion(face_parts->is_defined(new_he->twin()->face()));
|
||||||
// new_he->twin() is directed as org_he, so on the boundary pointing
|
// new_he->twin() is directed as org_he, so on the boundary pointing
|
||||||
// inside the face, and has the new vertex as target
|
// inside the face, and has the new vertex as target
|
||||||
|
|
@ -2079,7 +2070,8 @@ protected:
|
||||||
//BZBZ
|
//BZBZ
|
||||||
/* CGAL_assertion(vertices_to_halfedges->is_defined(correct_side_he->source()) &&
|
/* CGAL_assertion(vertices_to_halfedges->is_defined(correct_side_he->source()) &&
|
||||||
vertices_to_halfedges->is_defined(correct_side_he->next()->target()));*/
|
vertices_to_halfedges->is_defined(correct_side_he->next()->target()));*/
|
||||||
(*vertices_to_halfedges)[correct_side_he->next()->target()] = correct_side_he->next();
|
(*vertices_to_halfedges)[correct_side_he->next()->target()] =
|
||||||
|
correct_side_he->next();
|
||||||
|
|
||||||
if (correct_side_he == org_he &&
|
if (correct_side_he == org_he &&
|
||||||
face_parts->is_defined(org_he->twin()->face()))
|
face_parts->is_defined(org_he->twin()->face()))
|
||||||
|
|
@ -2099,46 +2091,42 @@ protected:
|
||||||
Halfedges_map& map_halfedges;
|
Halfedges_map& map_halfedges;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// this observer is used in the process of resolving a face
|
// this observer is used in the process of resolving a face
|
||||||
// it listens to what happens in the copied arrangement, and copies back
|
// it listens to what happens in the copied arrangement, and copies back
|
||||||
// the actions to result arrangements very efficiently
|
// the actions to result arrangements very efficiently
|
||||||
class Copy_observer : public Md_observer
|
class Copy_observer : public Md_observer {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
typedef typename Minimization_diagram_2::Face_handle Face_handle;
|
using Base_aos = typename Minimization_diagram_2::Base_aos;
|
||||||
typedef typename Minimization_diagram_2::Halfedge_handle Halfedge_handle;
|
|
||||||
typedef typename Minimization_diagram_2::Vertex_handle Vertex_handle;
|
|
||||||
typedef typename Minimization_diagram_2::Point_2 Point_2;
|
|
||||||
typedef typename Minimization_diagram_2::X_monotone_curve_2
|
|
||||||
X_monotone_curve_2;
|
|
||||||
typedef typename Minimization_diagram_2::Ccb_halfedge_circulator
|
|
||||||
Ccb_halfedge_circulator;
|
|
||||||
|
|
||||||
typedef typename Traits::Left_side_category Left_side_category;
|
using Face_handle = typename Base_aos::Face_handle;
|
||||||
typedef typename Traits::Right_side_category Right_side_category;
|
using Halfedge_handle = typename Base_aos::Halfedge_handle;
|
||||||
typedef typename Traits::Top_side_category Top_side_category;
|
using Vertex_handle = typename Base_aos::Vertex_handle;
|
||||||
typedef typename Traits::Bottom_side_category Bottom_side_category;
|
using Point_2 = typename Base_aos::Point_2;
|
||||||
|
using X_monotone_curve_2 = typename Base_aos::X_monotone_curve_2;
|
||||||
|
using Ccb_halfedge_circulator = typename Base_aos::Ccb_halfedge_circulator;
|
||||||
|
|
||||||
|
using Left_side_category = typename Traits::Left_side_category;
|
||||||
|
using Right_side_category = typename Traits::Right_side_category;
|
||||||
|
using Top_side_category = typename Traits::Top_side_category;
|
||||||
|
using Bottom_side_category = typename Traits::Bottom_side_category;
|
||||||
|
|
||||||
Copy_observer(Minimization_diagram_2& small_,
|
Copy_observer(Minimization_diagram_2& small_,
|
||||||
Minimization_diagram_2& big,
|
Minimization_diagram_2& big,
|
||||||
Halfedges_map& map_h,
|
Halfedges_map& map_h,
|
||||||
Vertices_map& map_v,
|
Vertices_map& map_v,
|
||||||
Faces_map& map_f)
|
Faces_map& map_f) :
|
||||||
: small_arr(small_), big_arr(big),
|
small_arr(small_), big_arr(big),
|
||||||
big_arr_accessor(big_arr),
|
big_arr_accessor(big_arr),
|
||||||
map_halfedges(map_h),
|
map_halfedges(map_h),
|
||||||
map_vertices(map_v),
|
map_vertices(map_v),
|
||||||
map_faces(map_f)
|
map_faces(map_f)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~Copy_observer() {}
|
virtual ~Copy_observer() {}
|
||||||
|
|
||||||
virtual void before_create_vertex (const Point_2& /* p */)
|
virtual void before_create_vertex (const Point_2& /* p */) override {}
|
||||||
{}
|
|
||||||
|
|
||||||
virtual void after_create_vertex (Vertex_handle v)
|
virtual void after_create_vertex (Vertex_handle v) override {
|
||||||
{
|
|
||||||
// should create a new vertex with v->point() inside
|
// should create a new vertex with v->point() inside
|
||||||
Vertex_handle new_v = big_arr_accessor.create_vertex(v->point());
|
Vertex_handle new_v = big_arr_accessor.create_vertex(v->point());
|
||||||
|
|
||||||
|
|
@ -2149,11 +2137,11 @@ protected:
|
||||||
new_vertices.push_back(v);
|
new_vertices.push_back(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void before_create_boundary_vertex (const X_monotone_curve_2& cv,
|
virtual void before_create_boundary_vertex(const X_monotone_curve_2& cv,
|
||||||
Arr_curve_end ind,
|
Arr_curve_end ind,
|
||||||
Arr_parameter_space in_ps_x,
|
Arr_parameter_space in_ps_x,
|
||||||
Arr_parameter_space in_ps_y)
|
Arr_parameter_space in_ps_y)
|
||||||
{
|
override {
|
||||||
boundary_vertex_cv = cv;
|
boundary_vertex_cv = cv;
|
||||||
boundary_vertex_ind = ind;
|
boundary_vertex_ind = ind;
|
||||||
ps_x = in_ps_x;
|
ps_x = in_ps_x;
|
||||||
|
|
@ -2163,8 +2151,7 @@ protected:
|
||||||
bool is_bounded_impl(Arr_open_side_tag) { return false; }
|
bool is_bounded_impl(Arr_open_side_tag) { return false; }
|
||||||
bool is_bounded_impl(Arr_boundary_side_tag) { return true; }
|
bool is_bounded_impl(Arr_boundary_side_tag) { return true; }
|
||||||
|
|
||||||
bool is_bounded()
|
bool is_bounded() {
|
||||||
{
|
|
||||||
// This is the case of create boundary vertex.
|
// This is the case of create boundary vertex.
|
||||||
CGAL_assertion((ps_x != ARR_INTERIOR) || (ps_y != ARR_INTERIOR));
|
CGAL_assertion((ps_x != ARR_INTERIOR) || (ps_y != ARR_INTERIOR));
|
||||||
|
|
||||||
|
|
@ -2184,8 +2171,7 @@ protected:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void after_create_boundary_vertex(Vertex_handle v)
|
virtual void after_create_boundary_vertex(Vertex_handle v) override {
|
||||||
{
|
|
||||||
CGAL_assertion(big_arr.is_valid());
|
CGAL_assertion(big_arr.is_valid());
|
||||||
Vertex_handle new_v =
|
Vertex_handle new_v =
|
||||||
big_arr_accessor.create_boundary_vertex(boundary_vertex_cv,
|
big_arr_accessor.create_boundary_vertex(boundary_vertex_cv,
|
||||||
|
|
@ -2199,16 +2185,15 @@ protected:
|
||||||
map_vertices[v] = new_v;
|
map_vertices[v] = new_v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void before_split_fictitious_edge(Halfedge_handle e,
|
virtual void
|
||||||
Vertex_handle v)
|
before_split_fictitious_edge(Halfedge_handle e, Vertex_handle v) override {
|
||||||
{
|
|
||||||
split_fict_v = v;
|
split_fict_v = v;
|
||||||
split_fict_e = e;
|
split_fict_e = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
void after_split_fictitious_edge(Halfedge_handle e1,
|
virtual void
|
||||||
Halfedge_handle e2)
|
after_split_fictitious_edge(Halfedge_handle e1, Halfedge_handle e2)
|
||||||
{
|
override {
|
||||||
// find the corresponding split vertex in big_arr
|
// find the corresponding split vertex in big_arr
|
||||||
CGAL_assertion(map_vertices.is_defined(split_fict_v));
|
CGAL_assertion(map_vertices.is_defined(split_fict_v));
|
||||||
Vertex_handle big_v = map_vertices[split_fict_v];
|
Vertex_handle big_v = map_vertices[split_fict_v];
|
||||||
|
|
@ -2235,8 +2220,7 @@ protected:
|
||||||
|
|
||||||
virtual void before_create_edge(const X_monotone_curve_2& /* c */,
|
virtual void before_create_edge(const X_monotone_curve_2& /* c */,
|
||||||
Vertex_handle v1,
|
Vertex_handle v1,
|
||||||
Vertex_handle v2)
|
Vertex_handle v2) override {
|
||||||
{
|
|
||||||
// save state for after_create_edge event
|
// save state for after_create_edge event
|
||||||
create_edge_v1 = v1;
|
create_edge_v1 = v1;
|
||||||
create_edge_v2 = v2;
|
create_edge_v2 = v2;
|
||||||
|
|
@ -2244,9 +2228,7 @@ protected:
|
||||||
is_in_relocate = false;
|
is_in_relocate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void after_create_edge(Halfedge_handle e)
|
virtual void after_create_edge(Halfedge_handle e) override {
|
||||||
|
|
||||||
{
|
|
||||||
// a new edge e was created in small_arr, we should create a corresponding
|
// a new edge e was created in small_arr, we should create a corresponding
|
||||||
// edge in big_arr
|
// edge in big_arr
|
||||||
CGAL_assertion(map_vertices.is_defined(create_edge_v1));
|
CGAL_assertion(map_vertices.is_defined(create_edge_v1));
|
||||||
|
|
@ -2260,18 +2242,14 @@ protected:
|
||||||
// if we have 2 new vertices, they must be new.
|
// if we have 2 new vertices, they must be new.
|
||||||
// if we have only one, we should check which is new
|
// if we have only one, we should check which is new
|
||||||
bool v1_is_new = false, v2_is_new = false;
|
bool v1_is_new = false, v2_is_new = false;
|
||||||
if (new_vertices.size() == 1)
|
if (new_vertices.size() == 1) {
|
||||||
{
|
if (new_vertices.back() == create_edge_v1) v1_is_new = true;
|
||||||
if (new_vertices.back() == create_edge_v1)
|
else {
|
||||||
v1_is_new = true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CGAL_assertion(new_vertices.back() == create_edge_v2);
|
CGAL_assertion(new_vertices.back() == create_edge_v2);
|
||||||
v2_is_new = true;
|
v2_is_new = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (new_vertices.size() == 2)
|
if (new_vertices.size() == 2) {
|
||||||
{
|
|
||||||
v1_is_new = true;
|
v1_is_new = true;
|
||||||
v2_is_new = true;
|
v2_is_new = true;
|
||||||
}
|
}
|
||||||
|
|
@ -2285,15 +2263,13 @@ protected:
|
||||||
|
|
||||||
// if an endpoint is not new, but is isolated, we should remove it from
|
// if an endpoint is not new, but is isolated, we should remove it from
|
||||||
// its face's isolated vertices list, and treat it as new
|
// its face's isolated vertices list, and treat it as new
|
||||||
if (!v1_is_new && big_v1->is_isolated())
|
if (!v1_is_new && big_v1->is_isolated()) {
|
||||||
{
|
|
||||||
//Face_handle f = big_v1->face(); //big_arr.incident_face(big_v1);
|
//Face_handle f = big_v1->face(); //big_arr.incident_face(big_v1);
|
||||||
//big_arr_accessor.find_and_erase_isolated_vertex(f, big_v1);
|
//big_arr_accessor.find_and_erase_isolated_vertex(f, big_v1);
|
||||||
big_arr_accessor.remove_isolated_vertex_ex(big_v1);
|
big_arr_accessor.remove_isolated_vertex_ex(big_v1);
|
||||||
v1_is_new = true;
|
v1_is_new = true;
|
||||||
}
|
}
|
||||||
if (!v2_is_new && big_v2->is_isolated())
|
if (! v2_is_new && big_v2->is_isolated()) {
|
||||||
{
|
|
||||||
//Face_handle f = big_v2->face(); //big_arr.incident_face(big_v2);
|
//Face_handle f = big_v2->face(); //big_arr.incident_face(big_v2);
|
||||||
//big_arr_accessor.find_and_erase_isolated_vertex(f, big_v2);
|
//big_arr_accessor.find_and_erase_isolated_vertex(f, big_v2);
|
||||||
big_arr_accessor.remove_isolated_vertex_ex(big_v2);
|
big_arr_accessor.remove_isolated_vertex_ex(big_v2);
|
||||||
|
|
@ -2301,8 +2277,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
// now use the approppriate method to insert the new edge
|
// now use the approppriate method to insert the new edge
|
||||||
if (v1_is_new && v2_is_new)
|
if (v1_is_new && v2_is_new) {
|
||||||
{
|
|
||||||
// if both vertices are new - use the O(1) operation
|
// if both vertices are new - use the O(1) operation
|
||||||
// _insert_in_face_interior (in the face mapped to by he->face())
|
// _insert_in_face_interior (in the face mapped to by he->face())
|
||||||
CGAL_assertion(map_faces.is_defined(he->face()));
|
CGAL_assertion(map_faces.is_defined(he->face()));
|
||||||
|
|
@ -2319,8 +2294,7 @@ protected:
|
||||||
map_halfedges[he] = new_he;
|
map_halfedges[he] = new_he;
|
||||||
map_halfedges[he->twin()] = new_he->twin();
|
map_halfedges[he->twin()] = new_he->twin();
|
||||||
}
|
}
|
||||||
else if (!v1_is_new && !v2_is_new)
|
else if (! v1_is_new && !v2_is_new) {
|
||||||
{
|
|
||||||
// if both vertices are old - use _insert_at_vertices
|
// if both vertices are old - use _insert_at_vertices
|
||||||
// this is a linear action by the size of the faces involved
|
// this is a linear action by the size of the faces involved
|
||||||
// we can get relevant prev halfedges from he
|
// we can get relevant prev halfedges from he
|
||||||
|
|
@ -2360,8 +2334,7 @@ protected:
|
||||||
|
|
||||||
// if a new face was created update its mapping too
|
// if a new face was created update its mapping too
|
||||||
// the new face is the incident face of he
|
// the new face is the incident face of he
|
||||||
if (new_face)
|
if (new_face) {
|
||||||
{
|
|
||||||
map_faces[he->face()] = new_he->face();
|
map_faces[he->face()] = new_he->face();
|
||||||
// save state for move_hole/move_isolated_vertex events
|
// save state for move_hole/move_isolated_vertex events
|
||||||
is_in_relocate = true;
|
is_in_relocate = true;
|
||||||
|
|
@ -2372,16 +2345,14 @@ protected:
|
||||||
CGAL_assertion(map_faces.is_defined(he->face()) &&
|
CGAL_assertion(map_faces.is_defined(he->face()) &&
|
||||||
map_faces[he->face()] == new_he->face());
|
map_faces[he->face()] == new_he->face());
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// only one vertex is new - use the O(1) operation _insert_from_vertex
|
// only one vertex is new - use the O(1) operation _insert_from_vertex
|
||||||
// we can get the relevant prev halfedge from e
|
// we can get the relevant prev halfedge from e
|
||||||
Halfedge_handle prev = he->prev();
|
Halfedge_handle prev = he->prev();
|
||||||
CGAL_assertion(map_halfedges.is_defined(prev));
|
CGAL_assertion(map_halfedges.is_defined(prev));
|
||||||
Halfedge_handle big_prev = map_halfedges[prev];
|
Halfedge_handle big_prev = map_halfedges[prev];
|
||||||
Halfedge_handle new_he;
|
Halfedge_handle new_he;
|
||||||
if (!v1_is_new)
|
if (!v1_is_new) {
|
||||||
{
|
|
||||||
new_he = big_arr_accessor.insert_from_vertex_ex(big_prev,
|
new_he = big_arr_accessor.insert_from_vertex_ex(big_prev,
|
||||||
he->curve(), (HE_COMP_RES(he) == SMALLER ? ARR_LEFT_TO_RIGHT : ARR_RIGHT_TO_LEFT),
|
he->curve(), (HE_COMP_RES(he) == SMALLER ? ARR_LEFT_TO_RIGHT : ARR_RIGHT_TO_LEFT),
|
||||||
big_v2);
|
big_v2);
|
||||||
|
|
@ -2391,8 +2362,7 @@ protected:
|
||||||
map_halfedges[he] = new_he;
|
map_halfedges[he] = new_he;
|
||||||
map_halfedges[he->twin()] = new_he->twin();
|
map_halfedges[he->twin()] = new_he->twin();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
new_he =
|
new_he =
|
||||||
big_arr_accessor.insert_from_vertex_ex(big_prev,
|
big_arr_accessor.insert_from_vertex_ex(big_prev,
|
||||||
he->curve(), (HE_COMP_RES(he->twin()) == SMALLER ? ARR_LEFT_TO_RIGHT : ARR_RIGHT_TO_LEFT),
|
he->curve(), (HE_COMP_RES(he->twin()) == SMALLER ? ARR_LEFT_TO_RIGHT : ARR_RIGHT_TO_LEFT),
|
||||||
|
|
@ -2410,14 +2380,13 @@ protected:
|
||||||
Vertex_handle v,
|
Vertex_handle v,
|
||||||
const X_monotone_curve_2& /* c1 */,
|
const X_monotone_curve_2& /* c1 */,
|
||||||
const X_monotone_curve_2& /* c2 */)
|
const X_monotone_curve_2& /* c2 */)
|
||||||
{
|
override {
|
||||||
// save state info for using _split_edge in after event
|
// save state info for using _split_edge in after event
|
||||||
split_v = v;
|
split_v = v;
|
||||||
split_e = e;
|
split_e = e;
|
||||||
}
|
}
|
||||||
virtual void after_split_edge (Halfedge_handle e1,
|
virtual void after_split_edge(Halfedge_handle e1,
|
||||||
Halfedge_handle e2)
|
Halfedge_handle e2) override {
|
||||||
{
|
|
||||||
// find the corresponding split vertex in big_arr
|
// find the corresponding split vertex in big_arr
|
||||||
CGAL_assertion(map_vertices.is_defined(split_v));
|
CGAL_assertion(map_vertices.is_defined(split_v));
|
||||||
Vertex_handle big_v = map_vertices[split_v];
|
Vertex_handle big_v = map_vertices[split_v];
|
||||||
|
|
@ -2448,11 +2417,10 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void before_add_isolated_vertex(Face_handle f,
|
virtual void before_add_isolated_vertex(Face_handle f,
|
||||||
Vertex_handle /* v */)
|
Vertex_handle /* v */) override
|
||||||
{
|
{ saved_face = f; }
|
||||||
saved_face = f;
|
|
||||||
}
|
virtual void after_add_isolated_vertex(Vertex_handle v) override
|
||||||
virtual void after_add_isolated_vertex(Vertex_handle v)
|
|
||||||
{
|
{
|
||||||
// make sure it is the only new vertex right now
|
// make sure it is the only new vertex right now
|
||||||
CGAL_assertion(new_vertices.size() == 1 &&
|
CGAL_assertion(new_vertices.size() == 1 &&
|
||||||
|
|
@ -2475,15 +2443,14 @@ protected:
|
||||||
|
|
||||||
virtual void before_move_inner_ccb(Face_handle from_f,
|
virtual void before_move_inner_ccb(Face_handle from_f,
|
||||||
Face_handle to_f,
|
Face_handle to_f,
|
||||||
Ccb_halfedge_circulator )
|
Ccb_halfedge_circulator) override {
|
||||||
{
|
|
||||||
// should be used after insert_at_vertices which creates a new face
|
// should be used after insert_at_vertices which creates a new face
|
||||||
CGAL_assertion(is_in_relocate);
|
CGAL_assertion(is_in_relocate);
|
||||||
move_from = from_f;
|
move_from = from_f;
|
||||||
move_to = to_f;
|
move_to = to_f;
|
||||||
}
|
}
|
||||||
virtual void after_move_inner_ccb(Ccb_halfedge_circulator h)
|
|
||||||
{
|
virtual void after_move_inner_ccb(Ccb_halfedge_circulator h) override {
|
||||||
CGAL_assertion(map_faces.is_defined(move_from));
|
CGAL_assertion(map_faces.is_defined(move_from));
|
||||||
CGAL_assertion(map_faces.is_defined(move_to));
|
CGAL_assertion(map_faces.is_defined(move_to));
|
||||||
CGAL_assertion(map_halfedges.is_defined(h));
|
CGAL_assertion(map_halfedges.is_defined(h));
|
||||||
|
|
@ -2500,16 +2467,14 @@ protected:
|
||||||
|
|
||||||
virtual void before_move_isolated_vertex(Face_handle from_f,
|
virtual void before_move_isolated_vertex(Face_handle from_f,
|
||||||
Face_handle to_f,
|
Face_handle to_f,
|
||||||
Vertex_handle )
|
Vertex_handle) override {
|
||||||
{
|
|
||||||
// should be used after insert_at_vertices which creates a new face
|
// should be used after insert_at_vertices which creates a new face
|
||||||
|
|
||||||
CGAL_assertion(is_in_relocate);
|
CGAL_assertion(is_in_relocate);
|
||||||
move_from = from_f;
|
move_from = from_f;
|
||||||
move_to = to_f;
|
move_to = to_f;
|
||||||
}
|
}
|
||||||
virtual void after_move_isolated_vertex(Vertex_handle v)
|
virtual void after_move_isolated_vertex(Vertex_handle v) override {
|
||||||
{
|
|
||||||
CGAL_assertion(map_faces.is_defined(move_from));
|
CGAL_assertion(map_faces.is_defined(move_from));
|
||||||
CGAL_assertion(map_faces.is_defined(move_to));
|
CGAL_assertion(map_faces.is_defined(move_to));
|
||||||
CGAL_assertion(map_vertices.is_defined(v));
|
CGAL_assertion(map_vertices.is_defined(v));
|
||||||
|
|
@ -2524,12 +2489,12 @@ protected:
|
||||||
protected:
|
protected:
|
||||||
Minimization_diagram_2& small_arr;
|
Minimization_diagram_2& small_arr;
|
||||||
Minimization_diagram_2& big_arr;
|
Minimization_diagram_2& big_arr;
|
||||||
Md_accessor big_arr_accessor;
|
Md_accessor big_arr_accessor;
|
||||||
|
|
||||||
// mappings between small_arr features to big_arr features
|
// mappings between small_arr features to big_arr features
|
||||||
Halfedges_map& map_halfedges;
|
Halfedges_map& map_halfedges;
|
||||||
Vertices_map& map_vertices;
|
Vertices_map& map_vertices;
|
||||||
Faces_map& map_faces;
|
Faces_map& map_faces;
|
||||||
std::deque<Vertex_handle> new_vertices;
|
std::deque<Vertex_handle> new_vertices;
|
||||||
|
|
||||||
// state for actions
|
// state for actions
|
||||||
|
|
@ -2537,25 +2502,23 @@ protected:
|
||||||
Vertex_handle create_edge_v2;
|
Vertex_handle create_edge_v2;
|
||||||
Vertex_handle split_v, split_fict_v;
|
Vertex_handle split_v, split_fict_v;
|
||||||
Halfedge_handle split_e, split_fict_e;
|
Halfedge_handle split_e, split_fict_e;
|
||||||
Face_handle saved_face;
|
Face_handle saved_face;
|
||||||
Face_handle move_from;
|
Face_handle move_from;
|
||||||
Face_handle move_to;
|
Face_handle move_to;
|
||||||
|
|
||||||
// for the create_vertex call-back
|
// for the create_vertex call-back
|
||||||
X_monotone_curve_2 boundary_vertex_cv;
|
X_monotone_curve_2 boundary_vertex_cv;
|
||||||
Arr_curve_end boundary_vertex_ind;
|
Arr_curve_end boundary_vertex_ind;
|
||||||
Arr_parameter_space ps_x;
|
Arr_parameter_space ps_x;
|
||||||
Arr_parameter_space ps_y;
|
Arr_parameter_space ps_y;
|
||||||
bool is_in_relocate;
|
bool is_in_relocate;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// A zone visitor for the Minimization Diagram which only inserts
|
// A zone visitor for the Minimization Diagram which only inserts
|
||||||
// parts of the curve which are inside a given face
|
// parts of the curve which are inside a given face
|
||||||
// it also remembers those parts which overlap the boundary of the original
|
// it also remembers those parts which overlap the boundary of the original
|
||||||
// face
|
// face
|
||||||
class Copied_face_zone_visitor
|
class Copied_face_zone_visitor {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
typedef typename Minimization_diagram_2::Vertex_handle Vertex_handle;
|
typedef typename Minimization_diagram_2::Vertex_handle Vertex_handle;
|
||||||
typedef typename Minimization_diagram_2::Halfedge_handle Halfedge_handle;
|
typedef typename Minimization_diagram_2::Halfedge_handle Halfedge_handle;
|
||||||
|
|
@ -2639,7 +2602,7 @@ protected:
|
||||||
// the zone visitor functions
|
// the zone visitor functions
|
||||||
|
|
||||||
/*! Initialize the visitor with an arrangement object. */
|
/*! Initialize the visitor with an arrangement object. */
|
||||||
void init (Minimization_diagram_2* arr)
|
void init(Minimization_diagram_2* arr)
|
||||||
{
|
{
|
||||||
CGAL_assertion(&copied_arr == arr);
|
CGAL_assertion(&copied_arr == arr);
|
||||||
insert_visitor.init(arr);
|
insert_visitor.init(arr);
|
||||||
|
|
@ -2821,8 +2784,7 @@ protected:
|
||||||
result_new_he->twin()->set_has_equal_aux_data_in_target_and_face(1, flag);
|
result_new_he->twin()->set_has_equal_aux_data_in_target_and_face(1, flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
result_new_he->twin()->set_is_equal_aux_data_in_target(0, true);
|
result_new_he->twin()->set_is_equal_aux_data_in_target(0, true);
|
||||||
result_new_he->twin()->set_is_equal_aux_data_in_target(1, true);
|
result_new_he->twin()->set_is_equal_aux_data_in_target(1, true);
|
||||||
result_new_he->twin()->set_has_equal_aux_data_in_target(0, true);
|
result_new_he->twin()->set_has_equal_aux_data_in_target(0, true);
|
||||||
|
|
@ -2833,8 +2795,7 @@ protected:
|
||||||
|
|
||||||
return base_result;
|
return base_result;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// we don't insert the subcurve, but it might touch a vertex of the
|
// we don't insert the subcurve, but it might touch a vertex of the
|
||||||
// face's boundary - we need to check it and identify special vertices
|
// face's boundary - we need to check it and identify special vertices
|
||||||
if (left_v != Vertex_handle(nullptr) &&
|
if (left_v != Vertex_handle(nullptr) &&
|
||||||
|
|
@ -2852,8 +2813,7 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Handle the a subcurve that overlaps a given edge.
|
||||||
* Handle the a subcurve that overlaps a given edge.
|
|
||||||
* \param cv The overlapping subcurve.
|
* \param cv The overlapping subcurve.
|
||||||
* \param he The overlapped halfedge (directed from left to right).
|
* \param he The overlapped halfedge (directed from left to right).
|
||||||
* \param left_v The vertex that corresponds to the left endpoint of cv
|
* \param left_v The vertex that corresponds to the left endpoint of cv
|
||||||
|
|
@ -2906,7 +2866,6 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
||||||
* Handle point that lies inside a given face.
|
* Handle point that lies inside a given face.
|
||||||
* \param p The point.
|
* \param p The point.
|
||||||
* \param face The face inside which the point lies.
|
* \param face The face inside which the point lies.
|
||||||
|
|
@ -3134,18 +3093,18 @@ protected:
|
||||||
Vertices_list& result_special_vertices;
|
Vertices_list& result_special_vertices;
|
||||||
|
|
||||||
// helper collections (for copied_arr features)
|
// helper collections (for copied_arr features)
|
||||||
Halfedges_hash copied_arr_boundary_halfedges;
|
Halfedges_hash copied_arr_boundary_halfedges;
|
||||||
Vertices_hash copied_arr_orig_vertices;
|
Vertices_hash copied_arr_orig_vertices;
|
||||||
Vertices_hash copied_arr_new_boundary_vertices;
|
Vertices_hash copied_arr_new_boundary_vertices;
|
||||||
Vertices_to_edges_map copied_vertices_to_halfedges;
|
Vertices_to_edges_map copied_vertices_to_halfedges;
|
||||||
|
|
||||||
Halfedges_hash copied_arr_special_edges;
|
Halfedges_hash copied_arr_special_edges;
|
||||||
Halfedges_hash_w_type copied_arr_new_edges;
|
Halfedges_hash_w_type copied_arr_new_edges;
|
||||||
Faces_hash copied_face_parts;
|
Faces_hash copied_face_parts;
|
||||||
Vertices_hash copied_arr_special_vertices;
|
Vertices_hash copied_arr_special_vertices;
|
||||||
|
|
||||||
// this observer will take care of the result arrangegment
|
// this observer will take care of the result arrangegment
|
||||||
Copy_observer md_copy_observer;
|
Copy_observer md_copy_observer;
|
||||||
|
|
||||||
// this observer will keep all our information in the helper collections
|
// this observer will keep all our information in the helper collections
|
||||||
// during the insert process
|
// during the insert process
|
||||||
|
|
@ -3160,26 +3119,23 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
// this minimization diagram observer updates data in new faces created
|
// this minimization diagram observer updates data in new faces created
|
||||||
class New_faces_observer : public Md_observer
|
class New_faces_observer : public Md_observer {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
typedef typename Minimization_diagram_2::Face_handle Face_handle;
|
using Base_aos = typename Minimization_diagram_2::Base_aos;
|
||||||
|
using Face_handle = typename Base_aos::Face_handle;
|
||||||
|
|
||||||
New_faces_observer(Minimization_diagram_2& arr) : Md_observer(arr) {}
|
New_faces_observer(Base_aos& arr) : Md_observer(arr) {}
|
||||||
|
|
||||||
virtual ~New_faces_observer() {}
|
virtual ~New_faces_observer() {}
|
||||||
|
|
||||||
virtual void after_split_face(Face_handle org_f,
|
virtual void after_split_face(Face_handle org_f, Face_handle new_f, bool)
|
||||||
Face_handle new_f,
|
override {
|
||||||
bool)
|
|
||||||
{
|
|
||||||
// update the new face's aux_data from original face
|
// update the new face's aux_data from original face
|
||||||
if (org_f->get_aux_is_set(0))
|
if (org_f->get_aux_is_set(0))
|
||||||
new_f->set_aux_source(0, org_f->get_aux_source(0));
|
new_f->set_aux_source(0, org_f->get_aux_source(0));
|
||||||
if (org_f->get_aux_is_set(1))
|
if (org_f->get_aux_is_set(1))
|
||||||
new_f->set_aux_source(1, org_f->get_aux_source(1));
|
new_f->set_aux_source(1, org_f->get_aux_source(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! The geometry traits object.
|
//! The geometry traits object.
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,13 @@ private:
|
||||||
// face mergers.
|
// face mergers.
|
||||||
class My_observer : public Arrangement_2::Observer {
|
class My_observer : public Arrangement_2::Observer {
|
||||||
public:
|
public:
|
||||||
My_observer(Arrangement_2& arr) : Arrangement_2::Observer(arr) {}
|
using Base_aos = typename Arrangement_2::Base_aos;
|
||||||
|
using Face_handle = typename Base_aos::Face_handle;
|
||||||
|
|
||||||
|
My_observer(Base_aos& arr) : Arrangement_2::Observer(arr) {}
|
||||||
|
|
||||||
virtual void after_split_face(Face_handle f, Face_handle new_f,
|
virtual void after_split_face(Face_handle f, Face_handle new_f,
|
||||||
bool /* is_hole */)
|
bool /* is_hole */) override
|
||||||
{ if (f->contained()) new_f->set_contained(true); }
|
{ if (f->contained()) new_f->set_contained(true); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,61 +87,81 @@ private:
|
||||||
// Observer to track any changes of the attached arrangement.
|
// Observer to track any changes of the attached arrangement.
|
||||||
class Observer : public Arrangement_2::Observer
|
class Observer : public Arrangement_2::Observer
|
||||||
{
|
{
|
||||||
|
using Base = typename Arrangement_2::Observer;
|
||||||
typedef typename Arrangement_2::Observer Base;
|
using Self = Observer;
|
||||||
typedef Observer Self;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using Base_aos = typename Arrangement_2::Base_aos;
|
||||||
|
using Vertex_handle = typename Base_aos::Vertex_handle;
|
||||||
|
using Halfedge_handle = typename Base_aos::Halfedge_handle;
|
||||||
|
using Face_handle = typename Base_aos::Face_handle;
|
||||||
|
using Ccb_halfedge_circulator = typename Base_aos::Ccb_halfedge_circulator;
|
||||||
|
|
||||||
bool has_changed;
|
bool has_changed;
|
||||||
|
|
||||||
Observer() : Base(), has_changed(false)
|
Observer() : Base(), has_changed(false) {}
|
||||||
{}
|
|
||||||
|
|
||||||
Observer(const Arrangement_2& arr)
|
Observer(const Base_aos& arr) :
|
||||||
: Base(const_cast<Arrangement_2&>(arr)), has_changed(false)
|
Base(const_cast<Base_aos&>(arr)), has_changed(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// Aos_observer interface
|
// Aos_observer interface
|
||||||
|
|
||||||
void after_attach() { has_changed = false; }
|
virtual void after_attach() override { has_changed = false; }
|
||||||
|
|
||||||
|
virtual void after_global_change() override { has_changed = true; }
|
||||||
void after_global_change() { has_changed = true; }
|
virtual void after_create_vertex(Vertex_handle) override
|
||||||
void after_create_vertex(Vertex_handle) { has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_create_boundary_vertex(Vertex_handle) { has_changed = true; }
|
virtual void after_create_boundary_vertex(Vertex_handle) override
|
||||||
void after_create_edge(Halfedge_handle) { has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_modify_vertex(Vertex_handle) { has_changed = true; }
|
virtual void after_create_edge(Halfedge_handle) override
|
||||||
void after_modify_edge(Halfedge_handle) { has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_split_edge(Halfedge_handle, Halfedge_handle) {
|
virtual void after_modify_vertex(Vertex_handle) override
|
||||||
has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_split_fictitious_edge(Halfedge_handle, Halfedge_handle) {
|
virtual void after_modify_edge(Halfedge_handle) override
|
||||||
has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_split_face(Face_handle, Face_handle, bool) {
|
virtual void after_split_edge(Halfedge_handle, Halfedge_handle) override
|
||||||
has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_split_outer_ccb(Face_handle, Ccb_halfedge_circulator,
|
virtual void after_split_fictitious_edge(Halfedge_handle, Halfedge_handle)
|
||||||
Ccb_halfedge_circulator) {
|
override
|
||||||
has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_split_inner_ccb(Face_handle, Ccb_halfedge_circulator,
|
virtual void after_split_face(Face_handle, Face_handle, bool) override
|
||||||
Ccb_halfedge_circulator) {
|
{ has_changed = true; }
|
||||||
has_changed = true; }
|
virtual void after_split_outer_ccb(Face_handle, Ccb_halfedge_circulator,
|
||||||
void after_add_outer_ccb(Ccb_halfedge_circulator) { has_changed = true; }
|
Ccb_halfedge_circulator) override
|
||||||
void after_add_inner_ccb(Ccb_halfedge_circulator) { has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_add_isolated_vertex(Vertex_handle) { has_changed = true; }
|
virtual void after_split_inner_ccb(Face_handle, Ccb_halfedge_circulator,
|
||||||
void after_merge_edge(Halfedge_handle) { has_changed = true; }
|
Ccb_halfedge_circulator) override
|
||||||
void after_merge_fictitious_edge(Halfedge_handle) { has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_merge_face(Face_handle) { has_changed = true; }
|
virtual void after_add_outer_ccb(Ccb_halfedge_circulator) override
|
||||||
void after_merge_outer_ccb(Face_handle, Ccb_halfedge_circulator) {
|
{ has_changed = true; }
|
||||||
has_changed = true; }
|
virtual void after_add_inner_ccb(Ccb_halfedge_circulator) override
|
||||||
void after_merge_inner_ccb(Face_handle, Ccb_halfedge_circulator) {
|
{ has_changed = true; }
|
||||||
has_changed = true; }
|
virtual void after_add_isolated_vertex(Vertex_handle) override
|
||||||
void after_move_outer_ccb(Ccb_halfedge_circulator) { has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_move_inner_ccb(Ccb_halfedge_circulator) { has_changed = true; }
|
virtual void after_merge_edge(Halfedge_handle) override
|
||||||
void after_move_isolated_vertex(Vertex_handle) { has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_remove_vertex() { has_changed = true; }
|
virtual void after_merge_fictitious_edge(Halfedge_handle) override
|
||||||
void after_remove_edge() { has_changed = true; }
|
{ has_changed = true; }
|
||||||
void after_remove_outer_ccb(Face_handle) { has_changed = true; }
|
virtual void after_merge_face(Face_handle) override { has_changed = true; }
|
||||||
void after_remove_inner_ccb(Face_handle) { has_changed = true; }
|
virtual void after_merge_outer_ccb(Face_handle, Ccb_halfedge_circulator)
|
||||||
|
override
|
||||||
|
{ has_changed = true; }
|
||||||
|
virtual void after_merge_inner_ccb(Face_handle, Ccb_halfedge_circulator)
|
||||||
|
override
|
||||||
|
{ has_changed = true; }
|
||||||
|
virtual void after_move_outer_ccb(Ccb_halfedge_circulator) override
|
||||||
|
{ has_changed = true; }
|
||||||
|
virtual void after_move_inner_ccb(Ccb_halfedge_circulator) override
|
||||||
|
{ has_changed = true; }
|
||||||
|
virtual void after_move_isolated_vertex(Vertex_handle) override
|
||||||
|
{ has_changed = true; }
|
||||||
|
virtual void after_remove_vertex() override { has_changed = true; }
|
||||||
|
virtual void after_remove_edge() override { has_changed = true; }
|
||||||
|
virtual void after_remove_outer_ccb(Face_handle) override
|
||||||
|
{ has_changed = true; }
|
||||||
|
virtual void after_remove_inner_ccb(Face_handle) override
|
||||||
|
{ has_changed = true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue