mirror of https://github.com/CGAL/cgal
Replaced get_data() and set_data() with get_env_data() and set_env_data() to avoid clashes with other extensions of the Dcel; Added template parameters (vertex-base, halfedge-base, and face-base) with default values to Envelope_pm_dcel
This commit is contained in:
parent
fe1843d245
commit
afff35cbdd
|
|
@ -21,19 +21,18 @@
|
||||||
#include <CGAL/Arr_default_dcel.h>
|
#include <CGAL/Arr_default_dcel.h>
|
||||||
#include <CGAL/Envelope_3/Envelope_base.h>
|
#include <CGAL/Envelope_3/Envelope_base.h>
|
||||||
|
|
||||||
namespace CGAL
|
namespace CGAL {
|
||||||
{
|
|
||||||
namespace Envelope_3
|
|
||||||
{
|
|
||||||
|
|
||||||
template <class Data>
|
namespace Envelope_3 {
|
||||||
class Dcel_info
|
|
||||||
{
|
template <typename Data_>
|
||||||
|
class Dcel_info {
|
||||||
public:
|
public:
|
||||||
typedef Dcel_info<Data> Self;
|
using Data = Data_;
|
||||||
typedef std::list<Data> Data_container;
|
using Self = Dcel_info<Data>;
|
||||||
typedef typename Data_container::iterator Data_iterator;
|
using Data_container = std::list<Data>;
|
||||||
typedef typename Data_container::const_iterator Data_const_iterator;
|
using Data_iterator = typename Data_container::iterator;
|
||||||
|
using Data_const_iterator = typename Data_container::const_iterator;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*! data container */
|
/*! data container */
|
||||||
|
|
@ -46,8 +45,7 @@ protected:
|
||||||
Dac_decision m_decision;
|
Dac_decision m_decision;
|
||||||
public:
|
public:
|
||||||
/*! Constructor */
|
/*! Constructor */
|
||||||
Dcel_info() : m_is_set(false), m_decision(DAC_DECISION_NOT_SET)
|
Dcel_info() : m_is_set(false), m_decision(DAC_DECISION_NOT_SET) {}
|
||||||
{}
|
|
||||||
|
|
||||||
/*! \brief returns true iff data has been set already */
|
/*! \brief returns true iff data has been set already */
|
||||||
bool get_is_set() const { return m_is_set; }
|
bool get_is_set() const { return m_is_set; }
|
||||||
|
|
@ -55,194 +53,127 @@ public:
|
||||||
/*! \brief resets the flag */
|
/*! \brief resets the flag */
|
||||||
void set_is_set(bool flag) { m_is_set = flag; }
|
void set_is_set(bool flag) { m_is_set = flag; }
|
||||||
|
|
||||||
bool is_decision_set()
|
bool is_decision_set() { return (m_decision != DAC_DECISION_NOT_SET); }
|
||||||
{
|
|
||||||
return (m_decision != DAC_DECISION_NOT_SET);
|
|
||||||
}
|
|
||||||
|
|
||||||
Dac_decision get_decision() const
|
Dac_decision get_decision() const { return m_decision; }
|
||||||
{
|
|
||||||
return m_decision;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_decision(Comparison_result comp)
|
void set_decision(Comparison_result comp)
|
||||||
{
|
{ m_decision = enum_cast<Dac_decision>(comp); }
|
||||||
m_decision = enum_cast<Dac_decision>(comp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_decision(Dac_decision dec)
|
void set_decision(Dac_decision dec) { m_decision = dec; }
|
||||||
{
|
|
||||||
m_decision = dec;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! User-friendly interface: */
|
/*! User-friendly interface: */
|
||||||
size_t number_of_surfaces () const
|
size_t number_of_surfaces() const { return m_data.size(); }
|
||||||
{
|
|
||||||
return (m_data.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
Data_const_iterator surfaces_begin () const
|
Data_const_iterator surfaces_begin() const { return m_data.begin(); }
|
||||||
{
|
|
||||||
return (m_data.begin());
|
|
||||||
}
|
|
||||||
|
|
||||||
Data_const_iterator surfaces_end () const
|
Data_const_iterator surfaces_end() const { return m_data.end(); }
|
||||||
{
|
|
||||||
return (m_data.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Obtain the first Xy-monotone surface associated with the face.
|
||||||
* Get the first Xy-monotone surface associated with the face.
|
|
||||||
* \pre number_of_surfaces() is not 0.
|
* \pre number_of_surfaces() is not 0.
|
||||||
*/
|
*/
|
||||||
const Data& surface() const
|
const Data& surface() const {
|
||||||
{
|
CGAL_precondition(m_data.size() > 0);
|
||||||
CGAL_precondition (m_data.size() > 0);
|
return m_data.front();
|
||||||
return (m_data.front());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Obtain the number of data objects associated with the face.
|
||||||
* Get the number of data objects associated with the face.
|
|
||||||
*/
|
*/
|
||||||
int number_of_data_objects() const
|
int number_of_data_objects() const { return static_cast<int>(m_data.size()); }
|
||||||
{
|
|
||||||
return static_cast<int>(m_data.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Check whether the data is set to be empty
|
||||||
* check if the data is set to be empty
|
|
||||||
*/
|
*/
|
||||||
bool has_no_data() const
|
bool has_no_data() const
|
||||||
{
|
{ return (m_is_set && (number_of_data_objects() == 0)); }
|
||||||
return (m_is_set && number_of_data_objects() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Obtain the first data object associated with the face.
|
||||||
* Get the first data object associated with the face.
|
|
||||||
* \pre number_of_data_objects() is not 0.
|
* \pre number_of_data_objects() is not 0.
|
||||||
*/
|
*/
|
||||||
const Data& get_data() const
|
const Data& get_env_data() const {
|
||||||
{
|
CGAL_precondition(m_data.size() > 0);
|
||||||
CGAL_precondition (m_data.size() > 0);
|
return m_data.front();
|
||||||
|
|
||||||
return (m_data.front());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Obtain the data iterators (const version).
|
||||||
* Get the data iterators (const version).
|
|
||||||
*/
|
*/
|
||||||
Data_const_iterator begin_data() const
|
Data_const_iterator begin_data() const { return m_data.begin(); }
|
||||||
{
|
|
||||||
return (m_data.begin());
|
|
||||||
}
|
|
||||||
|
|
||||||
Data_const_iterator end_data() const
|
Data_const_iterator end_data() const { return m_data.end(); }
|
||||||
{
|
|
||||||
return (m_data.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Obtain the data iterators (non-const version).
|
||||||
* Get the data iterators (non-const version).
|
|
||||||
*/
|
*/
|
||||||
Data_iterator begin_data()
|
Data_iterator begin_data() { return m_data.begin(); }
|
||||||
{
|
|
||||||
return (m_data.begin());
|
|
||||||
}
|
|
||||||
|
|
||||||
Data_iterator end_data()
|
Data_iterator end_data() { return m_data.end(); }
|
||||||
{
|
|
||||||
return (m_data.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*! Set a data object to the face.
|
||||||
* Set a data object to the face.
|
|
||||||
* \param data The data object to set.
|
* \param data The data object to set.
|
||||||
*/
|
*/
|
||||||
void set_data (const Data & data)
|
void set_env_data(const Data& data) {
|
||||||
{
|
|
||||||
clear_data();
|
clear_data();
|
||||||
add_data(data);
|
add_data(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Set a range of data objects to the face.
|
||||||
* Set a range of data objects to the face.
|
|
||||||
* \param begin A begin iterator for the data range.
|
* \param begin A begin iterator for the data range.
|
||||||
* \param end A past-the-end iterator for the data range.
|
* \param end A past-the-end iterator for the data range.
|
||||||
*/
|
*/
|
||||||
template <class InputIterator>
|
template <typename InputIterator>
|
||||||
void set_data(const InputIterator & begin, const InputIterator & end)
|
void set_env_data(InputIterator begin, InputIterator end) {
|
||||||
{
|
|
||||||
clear_data();
|
clear_data();
|
||||||
add_data(begin, end);
|
add_data(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! set the data to be empty.
|
||||||
* set the data to be empty.
|
|
||||||
*/
|
*/
|
||||||
void set_no_data()
|
void set_no_data() {
|
||||||
{
|
|
||||||
clear_data();
|
clear_data();
|
||||||
m_is_set = true;
|
m_is_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Add a data object to the face.
|
||||||
* Add a data object to the face.
|
|
||||||
* \param data The additional data object.
|
* \param data The additional data object.
|
||||||
*/
|
*/
|
||||||
void add_data (const Data & data)
|
void add_data(const Data& data) {
|
||||||
{
|
|
||||||
m_data.push_back(data);
|
m_data.push_back(data);
|
||||||
m_is_set = true;
|
m_is_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Add a range of data objects to the face.
|
||||||
* Add a range of data objects to the face.
|
|
||||||
* \param begin A begin iterator for the data range.
|
* \param begin A begin iterator for the data range.
|
||||||
* \param end A past-the-end iterator for the data range.
|
* \param end A past-the-end iterator for the data range.
|
||||||
*/
|
*/
|
||||||
template <class InputIterator>
|
template <typename InputIterator>
|
||||||
void add_data (const InputIterator & begin, const InputIterator & end)
|
void add_data(InputIterator begin, InputIterator end) {
|
||||||
{
|
for (auto it = begin; it != end; it++) m_data.push_back(*it);
|
||||||
InputIterator it;
|
|
||||||
for (it = begin; it != end; it++)
|
|
||||||
m_data.push_back(*it);
|
|
||||||
m_is_set = true;
|
m_is_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Clear the data objects.
|
||||||
* Clear the data objects.
|
|
||||||
*/
|
*/
|
||||||
void clear_data ()
|
void clear_data() {
|
||||||
{
|
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
m_is_set = false;
|
m_is_set = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Check whether the set of data objects in the input range is equal to our
|
||||||
* Check if the set of data objects in the input range is equal to our
|
|
||||||
* set of data objects
|
* set of data objects
|
||||||
*/
|
*/
|
||||||
template <class InputIterator>
|
template <typename InputIterator>
|
||||||
bool is_equal_data(const InputIterator & begin, const InputIterator & end)
|
bool is_equal_data(InputIterator begin, InputIterator end) const {
|
||||||
const
|
if (! get_is_set()) return false;
|
||||||
{
|
|
||||||
if (!get_is_set())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// insert the input data objects into a set
|
// insert the input data objects into a set
|
||||||
std::set<Data> input_data(begin, end);
|
std::set<Data> input_data(begin, end);
|
||||||
std::set<Data> my_data(begin_data(), end_data());
|
std::set<Data> my_data(begin_data(), end_data());
|
||||||
if (input_data.size() != my_data.size())
|
if (input_data.size() != my_data.size()) return false;
|
||||||
return false;
|
|
||||||
return (my_data == input_data);
|
return (my_data == input_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator>
|
template <typename InputIterator>
|
||||||
bool has_equal_data(const InputIterator & begin, const InputIterator & end)
|
bool has_equal_data(InputIterator begin, InputIterator end) const {
|
||||||
const
|
if (! get_is_set()) return false;
|
||||||
{
|
|
||||||
if (!get_is_set())
|
|
||||||
return false;
|
|
||||||
// insert the input data objects into a set
|
// insert the input data objects into a set
|
||||||
std::set<Data> input_data(begin, end);
|
std::set<Data> input_data(begin, end);
|
||||||
std::set<Data> my_data(begin_data(), end_data());
|
std::set<Data> my_data(begin_data(), end_data());
|
||||||
|
|
@ -260,49 +191,46 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<class HandleType>
|
template<class HandleType>
|
||||||
void set_aux_source(unsigned int id, HandleType h)
|
void set_aux_source(unsigned int id, HandleType h) {
|
||||||
{
|
|
||||||
CGAL_precondition(id < 2);
|
CGAL_precondition(id < 2);
|
||||||
m_aux_source[id] = make_object(h);
|
m_aux_source[id] = make_object(h);
|
||||||
}
|
}
|
||||||
void set_aux_source(unsigned int id, const Object& o)
|
|
||||||
{
|
void set_aux_source(unsigned int id, const Object& o) {
|
||||||
CGAL_precondition(id < 2);
|
CGAL_precondition(id < 2);
|
||||||
CGAL_precondition(!o.is_empty());
|
CGAL_precondition(!o.is_empty());
|
||||||
m_aux_source[id] = o;
|
m_aux_source[id] = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Object& get_aux_source(unsigned int id)
|
const Object& get_aux_source(unsigned int id) {
|
||||||
{
|
|
||||||
CGAL_precondition(id < 2);
|
CGAL_precondition(id < 2);
|
||||||
CGAL_precondition (!m_aux_source[id].is_empty());
|
CGAL_precondition (!m_aux_source[id].is_empty());
|
||||||
return m_aux_source[id];
|
return m_aux_source[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief returns true iff the point has been set already */
|
/*! \brief returns true iff the point has been set already */
|
||||||
bool get_aux_is_set(unsigned int id) const
|
bool get_aux_is_set(unsigned int id) const {
|
||||||
{
|
|
||||||
CGAL_precondition(id < 2);
|
CGAL_precondition(id < 2);
|
||||||
return (!m_aux_source[id].is_empty());
|
return (! m_aux_source[id].is_empty());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! Extend the planar-map vertex */
|
/*! Extend the planar-map vertex */
|
||||||
template <class Point_2, class Data>
|
template <typename BaseVertex, class VertexData>
|
||||||
class Envelope_pm_vertex : public CGAL::Arr_vertex_base<Point_2>,
|
class Envelope_pm_vertex : public BaseVertex, public Dcel_info<VertexData> {
|
||||||
public Dcel_info<Data>
|
public:
|
||||||
{
|
using Base_vertex = BaseVertex;
|
||||||
typedef CGAL::Arr_vertex_base<Point_2> Base_vertex;
|
using Vertex_data = VertexData;
|
||||||
typedef Dcel_info<Data> Base_info;
|
|
||||||
typedef Envelope_pm_vertex<Point_2, Data> Self;
|
private:
|
||||||
|
using Self = Envelope_pm_vertex<Base_vertex, Vertex_data>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// all flags are bits in this variable:
|
// all flags are bits in this variable:
|
||||||
unsigned short flags;
|
unsigned short flags;
|
||||||
|
|
||||||
// the flags indications:
|
// the flags indications:
|
||||||
enum Bit_pos
|
enum Bit_pos {
|
||||||
{
|
|
||||||
// for an isolated vertex only
|
// for an isolated vertex only
|
||||||
IS_EQUAL = 0,
|
IS_EQUAL = 0,
|
||||||
IS_EQUAL_AUX = 1,
|
IS_EQUAL_AUX = 1,
|
||||||
|
|
@ -316,10 +244,12 @@ protected:
|
||||||
// intersection points
|
// intersection points
|
||||||
IS_INTERSECTION = 7
|
IS_INTERSECTION = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using Base_info = Dcel_info<Vertex_data>;
|
||||||
|
|
||||||
/*! Constructor */
|
/*! Constructor */
|
||||||
Envelope_pm_vertex() : Dcel_info<Data>(), flags(0)
|
Envelope_pm_vertex() : Dcel_info<Vertex_data>(), flags(0) {}
|
||||||
{}
|
|
||||||
|
|
||||||
/*void set_is_fake(bool b)
|
/*void set_is_fake(bool b)
|
||||||
{
|
{
|
||||||
|
|
@ -339,42 +269,26 @@ public:
|
||||||
return get_bit(IS_FAKE);
|
return get_bit(IS_FAKE);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void set_is_equal_data_in_face(bool b)
|
void set_is_equal_data_in_face(bool b) { set_bit(IS_EQUAL, b); }
|
||||||
{
|
bool get_is_equal_data_in_face() const { return get_bit(IS_EQUAL); }
|
||||||
set_bit(IS_EQUAL, b);
|
|
||||||
}
|
|
||||||
bool get_is_equal_data_in_face() const
|
|
||||||
{
|
|
||||||
return get_bit(IS_EQUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_has_equal_data_in_face(bool b)
|
void set_has_equal_data_in_face(bool b) { set_bit(HAS_EQUAL, b); }
|
||||||
{
|
bool get_has_equal_data_in_face() const { return get_bit(HAS_EQUAL); }
|
||||||
set_bit(HAS_EQUAL, b);
|
|
||||||
}
|
|
||||||
bool get_has_equal_data_in_face() const
|
|
||||||
{
|
|
||||||
return get_bit(HAS_EQUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_is_equal_aux_data_in_face(unsigned int id, bool b)
|
void set_is_equal_aux_data_in_face(unsigned int id, bool b) {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
set_bit(IS_EQUAL_AUX+id, b);
|
set_bit(IS_EQUAL_AUX+id, b);
|
||||||
}
|
}
|
||||||
bool get_is_equal_aux_data_in_face(unsigned int id) const
|
bool get_is_equal_aux_data_in_face(unsigned int id) const {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
return get_bit(IS_EQUAL_AUX+id);
|
return get_bit(IS_EQUAL_AUX+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_has_equal_aux_data_in_face(unsigned int id, bool b)
|
void set_has_equal_aux_data_in_face(unsigned int id, bool b) {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
set_bit(HAS_EQUAL_AUX+id, b);
|
set_bit(HAS_EQUAL_AUX+id, b);
|
||||||
}
|
}
|
||||||
bool get_has_equal_aux_data_in_face(unsigned int id) const
|
bool get_has_equal_aux_data_in_face(unsigned int id) const {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
return get_bit(HAS_EQUAL_AUX+id);
|
return get_bit(HAS_EQUAL_AUX+id);
|
||||||
}
|
}
|
||||||
|
|
@ -382,8 +296,7 @@ public:
|
||||||
/*! Assign from another vertex.
|
/*! Assign from another vertex.
|
||||||
* \param v the other vertex.
|
* \param v the other vertex.
|
||||||
*/
|
*/
|
||||||
virtual void assign(const Base_vertex & v)
|
virtual void assign(const Base_vertex& v) {
|
||||||
{
|
|
||||||
Base_vertex::assign(v);
|
Base_vertex::assign(v);
|
||||||
|
|
||||||
const Self & ex_v = static_cast<const Self&>(v);
|
const Self & ex_v = static_cast<const Self&>(v);
|
||||||
|
|
@ -392,18 +305,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void set_bit(unsigned int ind, bool b)
|
void set_bit(unsigned int ind, bool b) {
|
||||||
{
|
// set bit "ind" to 1 or 0:
|
||||||
if (b)
|
if (b) flags |= (1 << ind);
|
||||||
// set bit "ind" to 1:
|
else flags &= ~(1 << ind);
|
||||||
flags |= (1 << ind);
|
|
||||||
else
|
|
||||||
// set bit "ind" to 0:
|
|
||||||
flags &= ~(1 << ind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_bit(unsigned int ind) const
|
bool get_bit(unsigned int ind) const {
|
||||||
{
|
|
||||||
// (1 << i) is bit i on, other bits off (start counting from 0)
|
// (1 << i) is bit i on, other bits off (start counting from 0)
|
||||||
unsigned int mask = 1 << ind;
|
unsigned int mask = 1 << ind;
|
||||||
return ((flags & mask) == mask);
|
return ((flags & mask) == mask);
|
||||||
|
|
@ -411,23 +319,22 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! Extend the planar-map halfedge */
|
/*! Extend the planar-map halfedge */
|
||||||
template <class X_monotone_curve_2, class Data>
|
template <typename BaseHalfedge, typename HalfedgeData>
|
||||||
class
|
class Envelope_pm_halfedge : public BaseHalfedge,
|
||||||
Envelope_pm_halfedge : public CGAL::Arr_halfedge_base<X_monotone_curve_2>,
|
public Dcel_info<HalfedgeData> {
|
||||||
public Dcel_info<Data>
|
public:
|
||||||
{
|
using Base_halfedge = BaseHalfedge;
|
||||||
typedef CGAL::Arr_halfedge_base<X_monotone_curve_2> Base_halfedge;
|
using Halfedge_data = HalfedgeData;
|
||||||
typedef Dcel_info<Data> Base_info;
|
|
||||||
typedef Envelope_pm_halfedge<X_monotone_curve_2, Data> Self;
|
private:
|
||||||
|
using Self = Envelope_pm_halfedge<Base_halfedge, Halfedge_data>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// all flags are bits in this variable:
|
// all flags are bits in this variable:
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
// flags indications
|
// flags indications
|
||||||
enum Bit_pos
|
enum Bit_pos {
|
||||||
{
|
|
||||||
// indications for the Envelope algorithm
|
// indications for the Envelope algorithm
|
||||||
// relation between halfedge and incident face
|
// relation between halfedge and incident face
|
||||||
IS_EQUAL_FACE = 0,
|
IS_EQUAL_FACE = 0,
|
||||||
|
|
@ -448,8 +355,9 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Envelope_pm_halfedge() : Dcel_info<Data>(), flags(0)
|
using Base_info = Dcel_info<Halfedge_data>;
|
||||||
{}
|
|
||||||
|
Envelope_pm_halfedge() : Dcel_info<Halfedge_data>(), flags(0) {}
|
||||||
|
|
||||||
/* void set_is_fake(bool b)
|
/* void set_is_fake(bool b)
|
||||||
{
|
{
|
||||||
|
|
@ -460,102 +368,64 @@ public:
|
||||||
return get_bit(IS_FAKE);
|
return get_bit(IS_FAKE);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void set_is_equal_data_in_face(bool b)
|
void set_is_equal_data_in_face(bool b) { set_bit(IS_EQUAL_FACE, b); }
|
||||||
{
|
bool get_is_equal_data_in_face() const { return get_bit(IS_EQUAL_FACE); }
|
||||||
set_bit(IS_EQUAL_FACE, b);
|
|
||||||
}
|
|
||||||
bool get_is_equal_data_in_face() const
|
|
||||||
{
|
|
||||||
return get_bit(IS_EQUAL_FACE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_has_equal_data_in_face(bool b)
|
void set_has_equal_data_in_face(bool b) { set_bit(HAS_EQUAL_FACE, b); }
|
||||||
{
|
bool get_has_equal_data_in_face() const { return get_bit(HAS_EQUAL_FACE); }
|
||||||
set_bit(HAS_EQUAL_FACE, b);
|
|
||||||
}
|
|
||||||
bool get_has_equal_data_in_face() const
|
|
||||||
{
|
|
||||||
return get_bit(HAS_EQUAL_FACE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_is_equal_aux_data_in_face(unsigned int id, bool b)
|
void set_is_equal_aux_data_in_face(unsigned int id, bool b) {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
set_bit(IS_EQUAL_AUX_FACE+id, b);
|
set_bit(IS_EQUAL_AUX_FACE+id, b);
|
||||||
}
|
}
|
||||||
bool get_is_equal_aux_data_in_face(unsigned int id) const
|
bool get_is_equal_aux_data_in_face(unsigned int id) const {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
return get_bit(IS_EQUAL_AUX_FACE+id);
|
return get_bit(IS_EQUAL_AUX_FACE+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_has_equal_aux_data_in_face(unsigned int id, bool b)
|
void set_has_equal_aux_data_in_face(unsigned int id, bool b) {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
set_bit(HAS_EQUAL_AUX_FACE+id, b);
|
set_bit(HAS_EQUAL_AUX_FACE+id, b);
|
||||||
}
|
}
|
||||||
bool get_has_equal_aux_data_in_face(unsigned int id) const
|
bool get_has_equal_aux_data_in_face(unsigned int id) const {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
return get_bit(HAS_EQUAL_AUX_FACE+id);
|
return get_bit(HAS_EQUAL_AUX_FACE+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_is_equal_data_in_target(bool b)
|
void set_is_equal_data_in_target(bool b) { set_bit(IS_EQUAL_TARGET, b); }
|
||||||
{
|
bool get_is_equal_data_in_target() const { return get_bit(IS_EQUAL_TARGET); }
|
||||||
set_bit(IS_EQUAL_TARGET, b);
|
|
||||||
}
|
|
||||||
bool get_is_equal_data_in_target() const
|
|
||||||
{
|
|
||||||
return get_bit(IS_EQUAL_TARGET);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_has_equal_data_in_target(bool b)
|
void set_has_equal_data_in_target(bool b) { set_bit(HAS_EQUAL_TARGET, b); }
|
||||||
{
|
bool get_has_equal_data_in_target() const { return get_bit(HAS_EQUAL_TARGET); }
|
||||||
set_bit(HAS_EQUAL_TARGET, b);
|
|
||||||
}
|
|
||||||
bool get_has_equal_data_in_target() const
|
|
||||||
{
|
|
||||||
return get_bit(HAS_EQUAL_TARGET);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_is_equal_aux_data_in_target(unsigned int id, bool b)
|
void set_is_equal_aux_data_in_target(unsigned int id, bool b) {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
set_bit(IS_EQUAL_AUX_TARGET+id, b);
|
set_bit(IS_EQUAL_AUX_TARGET+id, b);
|
||||||
}
|
}
|
||||||
bool get_is_equal_aux_data_in_target(unsigned int id) const
|
bool get_is_equal_aux_data_in_target(unsigned int id) const {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
return get_bit(IS_EQUAL_AUX_TARGET+id);
|
return get_bit(IS_EQUAL_AUX_TARGET+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_has_equal_aux_data_in_target(unsigned int id, bool b)
|
void set_has_equal_aux_data_in_target(unsigned int id, bool b) {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
set_bit(HAS_EQUAL_AUX_TARGET+id, b);
|
set_bit(HAS_EQUAL_AUX_TARGET+id, b);
|
||||||
}
|
}
|
||||||
bool get_has_equal_aux_data_in_target(unsigned int id) const
|
bool get_has_equal_aux_data_in_target(unsigned int id) const {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
return get_bit(HAS_EQUAL_AUX_TARGET+id);
|
return get_bit(HAS_EQUAL_AUX_TARGET+id);
|
||||||
}
|
}
|
||||||
// access to flags that contain relation between target and face
|
// access to flags that contain relation between target and face
|
||||||
void set_has_equal_data_in_target_and_face(bool b)
|
void set_has_equal_data_in_target_and_face(bool b)
|
||||||
{
|
{ set_bit(HAS_EQUAL_F_T, b); }
|
||||||
set_bit(HAS_EQUAL_F_T, b);
|
|
||||||
}
|
|
||||||
bool get_has_equal_data_in_target_and_face() const
|
bool get_has_equal_data_in_target_and_face() const
|
||||||
{
|
{ return get_bit(HAS_EQUAL_F_T); }
|
||||||
return get_bit(HAS_EQUAL_F_T);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_has_equal_aux_data_in_target_and_face(unsigned int id, bool b)
|
void set_has_equal_aux_data_in_target_and_face(unsigned int id, bool b) {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
set_bit(HAS_EQUAL_AUX_F_T+id, b);
|
set_bit(HAS_EQUAL_AUX_F_T+id, b);
|
||||||
}
|
}
|
||||||
bool get_has_equal_aux_data_in_target_and_face(unsigned int id) const
|
bool get_has_equal_aux_data_in_target_and_face(unsigned int id) const {
|
||||||
{
|
|
||||||
CGAL_assertion(id < 2);
|
CGAL_assertion(id < 2);
|
||||||
return get_bit(HAS_EQUAL_AUX_F_T+id);
|
return get_bit(HAS_EQUAL_AUX_F_T+id);
|
||||||
}
|
}
|
||||||
|
|
@ -563,8 +433,7 @@ public:
|
||||||
/*! Assign from another halfedge.
|
/*! Assign from another halfedge.
|
||||||
* \param h the other halfedge.
|
* \param h the other halfedge.
|
||||||
*/
|
*/
|
||||||
virtual void assign(const Base_halfedge & h)
|
virtual void assign(const Base_halfedge& h) {
|
||||||
{
|
|
||||||
Base_halfedge::assign(h);
|
Base_halfedge::assign(h);
|
||||||
|
|
||||||
const Self & ex_h = static_cast<const Self&>(h);
|
const Self & ex_h = static_cast<const Self&>(h);
|
||||||
|
|
@ -573,99 +442,93 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void set_bit(unsigned int ind, bool b)
|
void set_bit(unsigned int ind, bool b) {
|
||||||
{
|
if (b) flags |= (1 << ind);
|
||||||
if (b)
|
else flags &= ~(1 << ind);
|
||||||
// set bit "ind" to 1:
|
|
||||||
flags |= (1 << ind);
|
|
||||||
else
|
|
||||||
// set bit "ind" to 0:
|
|
||||||
flags &= ~(1 << ind);
|
|
||||||
CGAL_assertion(get_bit(ind) == b);
|
CGAL_assertion(get_bit(ind) == b);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_bit(unsigned int ind) const
|
bool get_bit(unsigned int ind) const {
|
||||||
{
|
|
||||||
// (1 << i) is bit i on, other bits off (start counting from 0)
|
// (1 << i) is bit i on, other bits off (start counting from 0)
|
||||||
unsigned int mask = 1 << ind;
|
unsigned int mask = 1 << ind;
|
||||||
return ((flags & mask) == mask);
|
return ((flags & mask) == mask);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! Extend the planar-map face */
|
//! Extend the planar-map face.
|
||||||
template <class Data>
|
template <typename BaseFace, typename FaceData>
|
||||||
class Envelope_pm_face : public CGAL::Arr_face_base,
|
class Envelope_pm_face : public BaseFace, public Dcel_info<FaceData> {
|
||||||
public Dcel_info<Data>
|
public:
|
||||||
{
|
using Base_face = BaseFace;
|
||||||
typedef CGAL::Arr_face_base Base_face;
|
using Face_data = FaceData;
|
||||||
typedef Dcel_info<Data> Base_info;
|
|
||||||
typedef Envelope_pm_face<Data> Self;
|
private:
|
||||||
|
using Self = Envelope_pm_face<Base_face, Face_data>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::list<Data> Data_container;
|
using Base_info = Dcel_info<Face_data>;
|
||||||
typedef typename Data_container::iterator Data_iterator;
|
using Data_container = std::list<Face_data>;
|
||||||
typedef typename Data_container::const_iterator Data_const_iterator;
|
using Data_iterator = typename Data_container::iterator;
|
||||||
|
using Data_const_iterator = typename Data_container::const_iterator;
|
||||||
|
|
||||||
/*! Constructor */
|
/*! Construct.
|
||||||
Envelope_pm_face() : Dcel_info<Data>()
|
*/
|
||||||
{}
|
Envelope_pm_face() : Dcel_info<Face_data>() {}
|
||||||
|
|
||||||
/*! Assign from another face.
|
/*! Assign from another face.
|
||||||
* \param f the other face.
|
* \param f the other face.
|
||||||
*/
|
*/
|
||||||
virtual void assign (const Base_face & f)
|
virtual void assign(const Base_face& f) {
|
||||||
{
|
|
||||||
Base_face::assign(f);
|
Base_face::assign(f);
|
||||||
|
|
||||||
const Self & ex_f = static_cast<const Self&>(f);
|
const Self& ex_f = static_cast<const Self&>(f);
|
||||||
this->Base_info::operator=(ex_f);
|
this->Base_info::operator=(ex_f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! A new dcel builder with full Envelope features */
|
/*! A new dcel builder with full Envelope features */
|
||||||
template <class Traits, class Data>
|
template <typename Traits_, typename DcelData,
|
||||||
class Envelope_pm_dcel : public
|
typename VertexBase = Arr_vertex_base<typename Traits_::Point_2>,
|
||||||
CGAL::Arr_dcel_base<Envelope_pm_vertex<typename Traits::Point_2, Data>,
|
typename HalfedgeBase =
|
||||||
Envelope_pm_halfedge<typename Traits::X_monotone_curve_2,
|
Arr_halfedge_base<typename Traits_::X_monotone_curve_2>,
|
||||||
Data>,
|
typename FaceBase = Arr_face_base>
|
||||||
Envelope_pm_face<Data> >
|
class Envelope_pm_dcel :
|
||||||
{
|
public CGAL::Arr_dcel_base<Envelope_pm_vertex<VertexBase, DcelData>,
|
||||||
|
Envelope_pm_halfedge<HalfedgeBase, DcelData>,
|
||||||
|
Envelope_pm_face<FaceBase, DcelData>> {
|
||||||
public:
|
public:
|
||||||
|
using Dcel_data = DcelData;
|
||||||
|
using Face_base = FaceBase;
|
||||||
|
|
||||||
typedef Data Face_data;
|
using Face_data = Dcel_data;
|
||||||
typedef typename Envelope_pm_face<Data>::Data_iterator
|
using Env_pm_face = Envelope_pm_face<Face_base, Dcel_data>;
|
||||||
Face_data_iterator;
|
using Face_data_iterator = typename Env_pm_face::Data_iterator;
|
||||||
typedef typename Envelope_pm_face<Data>::Data_const_iterator
|
using Face_data_const_iterator = typename Env_pm_face::Data_const_iterator;
|
||||||
Face_data_const_iterator;
|
|
||||||
|
|
||||||
typedef Data Edge_data;
|
using Edge_data = Dcel_data;
|
||||||
typedef Face_data_iterator Edge_data_iterator;
|
using Edge_data_iterator = Face_data_iterator;
|
||||||
typedef Face_data_const_iterator Edge_data_const_iterator;
|
using Edge_data_const_iterator = Face_data_const_iterator;
|
||||||
|
|
||||||
typedef Data Vertex_data;
|
using Vertex_data = Dcel_data;
|
||||||
typedef Face_data_iterator Vertex_data_iterator;
|
using Vertex_data_iterator = Face_data_iterator;
|
||||||
typedef Face_data_const_iterator Vertex_data_const_iterator;
|
using Vertex_data_const_iterator = Face_data_const_iterator;
|
||||||
|
|
||||||
typedef Dcel_info<Data> Dcel_elem_with_data;
|
using Dcel_elem_with_data = Dcel_info<Dcel_data>;
|
||||||
|
using Dcel_data_iterator = Face_data_iterator;
|
||||||
typedef Data Dcel_data;
|
using Dcel_data_const_iterator = Face_data_const_iterator;
|
||||||
typedef Face_data_iterator Dcel_data_iterator;
|
|
||||||
typedef Face_data_const_iterator Dcel_data_const_iterator;
|
|
||||||
|
|
||||||
/*! \struct
|
/*! \struct
|
||||||
* An auxiliary structure for rebinding the DCEL with a new traits class.
|
* An auxiliary structure for rebinding the DCEL with a new traits class.
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct rebind
|
struct rebind { typedef Envelope_pm_dcel<T, Face_data> other; };
|
||||||
{
|
|
||||||
typedef Envelope_pm_dcel<T, Face_data> other;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*! Constructor */
|
/*! Constructor */
|
||||||
Envelope_pm_dcel() {}
|
Envelope_pm_dcel() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Envelope_3
|
} // namespace Envelope_3
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue