rep is now an inner class of each handle, compiling, not running

This commit is contained in:
Michal Kleinbort 2012-01-08 10:04:28 +00:00
parent b1a5bda2da
commit 7ece7b3c83
12 changed files with 535 additions and 1766 deletions

View File

@ -58,14 +58,6 @@ class Td_active_edge : public Handle
{
public:
//type of trapezoid type
enum Type
{
TD_TRAPEZOID,
TD_EDGE,
TD_VERTEX
};
//type of traits class
typedef Td_traits_ Traits;
@ -89,23 +81,6 @@ public:
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoid parameter space
// Ninetuple which represents the Trapezoid:
// - for regular & edge trapezoids or active point trapezoids:
// left vertex, right vertex, bottom halfedge, top halfedge
// - for removed point trapezoids:
// point or X_monotone_curve_2+ cv end
// type flag + on boundaries flags,
// left-bottom neighbor trapezoid, left-top neighbor trapezoid,
// right-bottom neighbor trapezoid, right-top neighbor trapezoid
typedef Td_ninetuple<Vertex_const_handle,
Vertex_const_handle,
Halfedge_const_handle,
Halfedge_const_handle,
unsigned char,
boost::optional<Td_map_item>, boost::optional<Td_map_item>,
boost::optional<Td_map_item>, boost::optional<Td_map_item> > Trpz_parameter_space;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
@ -143,11 +118,36 @@ public:
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_active_edge<Td_traits_>;
public:
//c'tors
Data (Halfedge_const_handle _he,
boost::optional<Td_map_item> _lb,
boost::optional<Td_map_item> _lt,
boost::optional<Td_map_item> _rb,
boost::optional<Td_map_item> _rt)
: he(_he),lb(_lb),lt(_lt),rb(_rb),rt(_rt)
{ }
~Data() { }
protected:
Halfedge_const_handle he;
boost::optional<Td_map_item> lb;
boost::optional<Td_map_item> lt;
boost::optional<Td_map_item> rb;
boost::optional<Td_map_item> rt;
};
private:
Trpz_parameter_space* ptr() const { return (Trpz_parameter_space*)(PTR); }
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
@ -191,57 +191,35 @@ public:
if (halfedge() != Traits::empty_he_handle() &&
halfedge()->direction() != he->direction())
{
ptr()->e2 = he->twin();
ptr()->he = he->twin();
}
else
{
ptr()->e2 = he;
ptr()->he = he;
}
}
/*! Set left bottom neighbour. */
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->e5 = lb; }
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->lb = lb; }
/*! Set left top neighbour. */
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->e6 = lt; }
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->lt = lt; }
/*! Set right bottom neighbour. */
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->e7 = rb; }
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->rb = rb; }
/*! Set right top neighbour. */
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->e8 = rt; }
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->rt = rt; }
public:
/// \name Constructors.
//@{
/*! Default constructor. */
//Td_active_edge()
//{
// //define the initial trapezoid: left, right, btm, top are at infinity.
// // its type is TD_TRAPEZOID ,it is on all boundaries, and has no neighbours
// PTR = new Trpz_parameter_space
// (Traits::vtx_at_left_infinity(),
// Traits::vtx_at_right_infinity(),
// Traits::he_at_bottom_infinity(),
// Traits::he_at_top_infinity(),
// CGAL_TD_EDGE | CGAL_TD_ON_ALL_BOUNDARIES ,
// boost::none, boost::none , boost::none , boost::none);
// m_dag_node = 0;
//}
//
Td_active_edge ()
{
//build the type flag
unsigned char type_flag = 0;
type_flag |= CGAL_TD_EDGE;
PTR = new Trpz_parameter_space
(Traits::empty_vtx_handle(),Traits::empty_vtx_handle(), Traits::empty_he_handle(), Traits::empty_he_handle(),
type_flag | CGAL_TD_INTERIOR, boost::none, boost::none, boost::none, boost::none);
PTR = new Data
(Traits::empty_he_handle(), boost::none, boost::none, boost::none, boost::none);
m_dag_node = NULL;
}
/*! Constructor given Vertex & Halfedge handles. */
@ -251,13 +229,7 @@ public:
Dag_node* node = 0)
{
//build the type flag
unsigned char type_flag = 0;
type_flag |= CGAL_TD_EDGE;
PTR = new Trpz_parameter_space
(Traits::empty_vtx_handle(),Traits::empty_vtx_handle(), he, Traits::empty_he_handle(),
type_flag | CGAL_TD_INTERIOR, lb, lt, rb, rt);
PTR = new Data(he, lb, lt, rb, rt);
m_dag_node = node;
}
@ -320,20 +292,20 @@ public:
inline Halfedge_const_handle halfedge() const
{
return ptr()->e2;
return ptr()->he;
}
/*! Access left bottom neighbour. */
boost::optional<Td_map_item> lb() const { return ptr()->e5; }
boost::optional<Td_map_item> lb() const { return ptr()->lb; }
/*! Access left top neighbour. */
boost::optional<Td_map_item> lt() const { return ptr()->e6; }
boost::optional<Td_map_item> lt() const { return ptr()->lt; }
/*! Access right bottom neighbour. */
boost::optional<Td_map_item> rb() const { return ptr()->e7; }
boost::optional<Td_map_item> rb() const { return ptr()->rb; }
/*! Access right top neighbour. */
boost::optional<Td_map_item> rt() const { return ptr()->e8; }
boost::optional<Td_map_item> rt() const { return ptr()->rt; }
/*! Access DAG node. */
Dag_node* dag_node() const {return m_dag_node;}

View File

@ -58,14 +58,6 @@ class Td_active_fictitious_vertex : public Handle
{
public:
//type of trapezoid type
enum Type
{
TD_TRAPEZOID,
TD_EDGE,
TD_VERTEX
};
//type of traits class
typedef Td_traits_ Traits;
@ -89,23 +81,6 @@ public:
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoid parameter space
// Ninetuple which represents the Trapezoid:
// - for regular & edge trapezoids or active point trapezoids:
// left vertex, right vertex, bottom halfedge, top halfedge
// - for removed point trapezoids:
// point or X_monotone_curve_2+ cv end
// type flag + on boundaries flags,
// left-bottom neighbor trapezoid, left-top neighbor trapezoid,
// right-bottom neighbor trapezoid, right-top neighbor trapezoid
typedef Td_ninetuple<Vertex_const_handle,
Vertex_const_handle,
Halfedge_const_handle,
Halfedge_const_handle,
unsigned char,
boost::optional<Td_map_item>, boost::optional<Td_map_item>,
boost::optional<Td_map_item>, boost::optional<Td_map_item> > Trpz_parameter_space;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
@ -143,11 +118,41 @@ public:
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_active_fictitious_vertex<Td_traits_>;
public:
//c'tors
Data (Vertex_const_handle _v,
Halfedge_const_handle _bottom_he,
Halfedge_const_handle _top_he,
boost::optional<Td_map_item> _lb,
boost::optional<Td_map_item> _lt,
boost::optional<Td_map_item> _rb,
boost::optional<Td_map_item> _rt)
: v(_v),bottom_he(_bottom_he),top_he(_top_he),
lb(_lb),lt(_lt),rb(_rb),rt(_rt)
{ }
~Data() { }
protected:
Vertex_const_handle v;
Halfedge_const_handle bottom_he;
Halfedge_const_handle top_he;
boost::optional<Td_map_item> lb;
boost::optional<Td_map_item> lt;
boost::optional<Td_map_item> rb;
boost::optional<Td_map_item> rt;
};
private:
Trpz_parameter_space* ptr() const { return (Trpz_parameter_space*)(PTR); }
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
@ -186,29 +191,22 @@ public:
}
/*! Set the trapezoid's left (Vertex_const_handle). */
CGAL_TD_INLINE void set_left(Vertex_const_handle v)
CGAL_TD_INLINE void set_vertex(Vertex_const_handle v)
{
ptr()->e0 = v;
ptr()->v = v;
}
///*! Set the trapezoid's right (Vertex_const_handle). */
//CGAL_TD_INLINE void set_right(Vertex_const_handle v)
//{
// CGAL_precondition(is_active());
// ptr()->e1 = v;
//}
/*! Set the trapezoid's bottom (Halfedge_const_handle). */
inline void set_bottom(Halfedge_const_handle he)
{
if (bottom() != Traits::empty_he_handle() &&
bottom_unsafe()->direction() != he->direction())
bottom()->direction() != he->direction())
{
ptr()->e2 = he->twin();
ptr()->bottom_he = he->twin();
}
else
{
ptr()->e2 = he;
ptr()->bottom_he = he;
}
}
@ -216,13 +214,13 @@ public:
CGAL_TD_INLINE void set_top(Halfedge_const_handle he)
{
if (top() != Traits::empty_he_handle() &&
top_unsafe()->direction() != he->direction())
top()->direction() != he->direction())
{
ptr()->e3 = he->twin();
ptr()->top_he = he->twin();
}
else
{
ptr()->e3 = he;
ptr()->top_he = he;
}
}
@ -230,47 +228,26 @@ public:
/*! Set left bottom neighbour. */
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->e5 = lb; }
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->lb = lb; }
/*! Set left top neighbour. */
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->e6 = lt; }
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->lt = lt; }
/*! Set right bottom neighbour. */
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->e7 = rb; }
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->rb = rb; }
/*! Set right top neighbour. */
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->e8 = rt; }
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->rt = rt; }
public:
/// \name Constructors.
//@{
/*! Default constructor. */
//Td_active_fictitious_vertex()
//{
// //define the initial trapezoid: left, right, btm, top are at infinity.
// // its type is TD_TRAPEZOID ,it is on all boundaries, and has no neighbours
// PTR = new Trpz_parameter_space
// (Traits::empty_vtx_handle(),
// Traits::empty_vtx_handle(),
// Traits::empty_he_handle(),
// Traits::empty_he_handle(),
// CGAL_TD_VERTEX | CGAL_TD_ON_ALL_BOUNDARIES ,
// boost::none, boost::none , boost::none , boost::none);
// m_dag_node = 0;
//}
Td_active_fictitious_vertex ()
{
//build the type flag
unsigned char type_flag = 0;
type_flag |= CGAL_TD_VERTEX;
PTR = new Trpz_parameter_space
(Traits::empty_vtx_handle(), Traits::empty_vtx_handle(),
Traits::empty_he_handle(), Traits::empty_he_handle(), type_flag | CGAL_TD_INTERIOR,
PTR = new Data
(Traits::empty_vtx_handle(), Traits::empty_he_handle(), Traits::empty_he_handle(),
boost::none, boost::none, boost::none, boost::none);
m_dag_node = NULL;
}
@ -280,58 +257,20 @@ public:
Halfedge_const_handle btm_he,
Halfedge_const_handle top_he,
boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
Dag_node* node = 0)
//Vertex_const_handle l, Vertex_const_handle r,
//Halfedge_const_handle b, Halfedge_const_handle t,
//Type tp = TD_TRAPEZOID,
//unsigned char boundness_flag = CGAL_TD_INTERIOR,
//Self* lb = 0, Self* lt = 0,
//Self* rb = 0, Self* rt = 0,
//Dag_node* node = 0)
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
Dag_node* node = 0)
{
//build the type flag
unsigned char type_flag = 0;
type_flag |= CGAL_TD_VERTEX;
PTR = new Trpz_parameter_space
(v, Traits::empty_vtx_handle(),
btm_he, top_he, type_flag | CGAL_TD_INTERIOR, lb, lt, rb, rt);
PTR = new Data(v, btm_he, top_he, lb, lt, rb, rt);
m_dag_node = node;
}
///*! Constructor given Pointers to Vertex & Halfedge handles. */
//Td_active_fictitious_vertex (Vertex_const_handle* l, Vertex_const_handle* r ,
// Halfedge_const_handle* b, Halfedge_const_handle* t,
// unsigned char type_flag,
// bool on_left_bndry,
// bool on_right_bndry,
// bool on_bottom_bndry,
// bool on_top_bndry,
// Self* lb = 0, Self* lt = 0,
// Self* rb = 0, Self* rt = 0,
// Dag_node* node = 0)
//{
// PTR = new Trpz_parameter_space
// (l ? *l : Traits::vtx_at_left_infinity(),
// r ? *r : Traits::vtx_at_right_infinity(),
// b ? *b : Traits::he_at_bottom_infinity(),
// t ? *t : Traits::he_at_top_infinity(),
// (type_flag |
// (on_left_bndry ? CGAL_TD_ON_LEFT_BOUNDARY : 0) |
// (on_right_bndry ? CGAL_TD_ON_RIGHT_BOUNDARY : 0) |
// (on_bottom_bndry ? CGAL_TD_ON_BOTTOM_BOUNDARY : 0) |
// (on_top_bndry ? CGAL_TD_ON_TOP_BOUNDARY : 0) ),
//lb, lt, rb, rt);
// m_dag_node = node;
// }
/*! Copy constructor. */
Td_active_fictitious_vertex (const Self& tr) : Handle(tr)
{
{
m_dag_node = tr.m_dag_node;
}
}
//@}
@ -342,20 +281,20 @@ public:
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
CGAL_TD_INLINE Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
CGAL_TD_INLINE bool operator== (const Self& t2) const
inline bool operator== (const Self& t2) const
{
return CGAL::identical(*this,t2);
}
/*! Operator!=. */
CGAL_TD_INLINE bool operator!= (const Self& t2) const
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
@ -366,106 +305,62 @@ public:
/// \name Access methods.
//@{
CGAL_TD_INLINE Self& self()
{
return *this;
}
inline Self& self()
{
return *this;
}
CGAL_TD_INLINE const Self& self() const
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
inline unsigned long id() const
{
return (unsigned long) PTR;
}
/*! Access trapezoid left. */
inline Vertex_const_handle left_unsafe() const
{
return ptr()->e0;
//CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e0)) != NULL);
//return boost::get<Vertex_const_handle>(ptr()->e0);
return (unsigned long) PTR;
}
/*! Access trapezoid left.
* filters out the infinite case which returns predefined dummy values
*/
inline Vertex_const_handle left() const
inline Vertex_const_handle vertex() const
{
return left_unsafe();
return ptr()->v;
}
inline Curve_end curve_end() const
{
return Curve_end(left()->curve_end());
return Curve_end(vertex()->curve_end());
}
///*! Access trapezoid right. */
//CGAL_TD_INLINE Vertex_const_handle right_unsafe() const
//{
// CGAL_assertion(false);
// return boost::get<Vertex_const_handle>(ptr()->e1);
//}
///*! Access trapezoid right.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Vertex_const_handle right () const
//{
// CGAL_precondition(is_active());
// if (is_on_right_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary())
// {
// return Traits::vtx_at_right_infinity();
// }
// //else
// return right_unsafe();
//}
/*! Access trapezoid bottom. */
inline Halfedge_const_handle bottom_unsafe () const
{
return ptr()->e2;
//CGAL_assertion(boost::get<Halfedge_const_handle>(&(ptr()->e2)) != NULL);
//return boost::get<Halfedge_const_handle>(ptr()->e2);
}
/*! Access trapezoid bottom.
* filters out the infinite case which returns predefined dummy values
*/
inline Halfedge_const_handle bottom () const
{
return bottom_unsafe();
return ptr()->bottom_he;
}
/*! Access trapezoid top. */
inline Halfedge_const_handle top_unsafe () const
{
return ptr()->e3;
}
/*! Access trapezoid top.
* filters out the infinite case which returns predefined dummy values
*/
inline Halfedge_const_handle top () const
{
return top_unsafe();
return ptr()->top_he;
}
/*! Access left bottom neighbour. */
boost::optional<Td_map_item> lb() const { return ptr()->e5; }
boost::optional<Td_map_item> lb() const { return ptr()->lb; }
/*! Access left top neighbour. */
boost::optional<Td_map_item> lt() const { return ptr()->e6; }
boost::optional<Td_map_item> lt() const { return ptr()->lt; }
/*! Access right bottom neighbour. */
boost::optional<Td_map_item> rb() const { return ptr()->e7; }
boost::optional<Td_map_item> rb() const { return ptr()->rb; }
/*! Access right top neighbour. */
boost::optional<Td_map_item> rt() const { return ptr()->e8; }
boost::optional<Td_map_item> rt() const { return ptr()->rt; }
/*! Access DAG node. */
Dag_node* dag_node() const {return m_dag_node;}

View File

@ -26,9 +26,10 @@
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <CGAL/tuple.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
//#include <boost/shared_ptr.hpp>
#ifdef CGAL_TD_DEBUG
@ -54,14 +55,7 @@ template <class Td_traits_>
class Td_active_trapezoid : public Handle
{
public:
//type of trapezoid type
enum Type
{
TD_TRAPEZOID,
TD_EDGE,
TD_VERTEX
};
//type of traits class
typedef Td_traits_ Traits;
@ -84,23 +78,6 @@ public:
typedef typename Traits::Td_active_trapezoid Self;
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoid parameter space
// Ninetuple which represents the Trapezoid:
// - for regular & edge trapezoids or active point trapezoids:
// left vertex, right vertex, bottom halfedge, top halfedge
// - for removed point trapezoids:
// point or X_monotone_curve_2+ cv end
// type flag + on boundaries flags,
// left-bottom neighbor trapezoid, left-top neighbor trapezoid,
// right-bottom neighbor trapezoid, right-top neighbor trapezoid
typedef Td_ninetuple<Vertex_const_handle,
Vertex_const_handle,
Halfedge_const_handle,
Halfedge_const_handle,
unsigned char,
boost::optional<Td_map_item>, boost::optional<Td_map_item>,
boost::optional<Td_map_item>, boost::optional<Td_map_item> > Trpz_parameter_space;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
@ -114,7 +91,6 @@ public:
//type of Trapezoidal map search structure
typedef typename TD::Dag_node Dag_node;
//friend class declarations:
friend class Trapezoidal_decomposition_2<Traits>;
@ -139,13 +115,49 @@ public:
#endif
#endif
protected:
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_active_trapezoid<Td_traits_>;
public:
//c'tors
Data (Vertex_const_handle _left_v,
Vertex_const_handle _right_v,
Halfedge_const_handle _bottom_he,
Halfedge_const_handle _top_he,
boost::optional<Td_map_item> _lb,
boost::optional<Td_map_item> _lt,
boost::optional<Td_map_item> _rb,
boost::optional<Td_map_item> _rt)
: left_v(_left_v),right_v(_right_v),bottom_he(_bottom_he),top_he(_top_he),
lb(_lb),lt(_lt),rb(_rb),rt(_rt)
{ }
~Data() { }
protected:
Vertex_const_handle left_v;
Vertex_const_handle right_v;
Halfedge_const_handle bottom_he;
Halfedge_const_handle top_he;
boost::optional<Td_map_item> lb;
boost::optional<Td_map_item> lt;
boost::optional<Td_map_item> rb;
boost::optional<Td_map_item> rt;
};
private:
Trpz_parameter_space* ptr() const { return (Trpz_parameter_space*)(PTR); }
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
#ifdef CGAL_PM_FRIEND_CLASS
protected:
@ -184,26 +196,26 @@ public:
/*! Set the trapezoid's left (Vertex_const_handle). */
inline void set_left(Vertex_const_handle v)
{
ptr()->e0 = v;
ptr()->left_v = v;
}
/*! Set the trapezoid's right (Vertex_const_handle). */
inline void set_right(Vertex_const_handle v)
{
ptr()->e1 = v;
ptr()->right_v = v;
}
/*! Set the trapezoid's bottom (Halfedge_const_handle). */
inline void set_bottom(Halfedge_const_handle he)
{
if (!is_on_bottom_boundary() &&
bottom_unsafe()->direction() != he->direction())
bottom()->direction() != he->direction())
{
ptr()->e2 = he->twin();
ptr()->bottom_he = he->twin();
}
else
{
ptr()->e2 = he;
ptr()->bottom_he = he;
}
}
@ -211,28 +223,28 @@ public:
inline void set_top(Halfedge_const_handle he)
{
if (!is_on_top_boundary() &&
top_unsafe()->direction() != he->direction())
top()->direction() != he->direction())
{
ptr()->e3 = he->twin();
ptr()->top_he = he->twin();
}
else
{
ptr()->e3 = he;
ptr()->top_he = he;
}
}
/*! Set left bottom neighbour. */
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->e5 = lb; }
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->lb = lb; }
/*! Set left top neighbour. */
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->e6 = lt; }
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->lt = lt; }
/*! Set right bottom neighbour. */
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->e7 = rb; }
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->rb = rb; }
/*! Set right top neighbour. */
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->e8 = rt; }
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->rt = rt; }
public:
@ -243,15 +255,14 @@ public:
Td_active_trapezoid()
{
//define the initial trapezoid: left, right, btm, top are at infinity.
// its type is TD_TRAPEZOID ,it is on all boundaries, and has no neighbours
PTR = new Trpz_parameter_space
// has no neighbours
PTR = new Data
(Traits::empty_vtx_handle(),
Traits::empty_vtx_handle(),
Traits::empty_he_handle(),
Traits::empty_he_handle(),
CGAL_TD_TRAPEZOID | CGAL_TD_ON_ALL_BOUNDARIES ,
boost::none, boost::none , boost::none , boost::none);
m_dag_node = 0;
}
@ -262,87 +273,10 @@ public:
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
Dag_node* node = 0)
{
//build the type flag
unsigned char type_flag = 0;
PTR = new Trpz_parameter_space
(l, r, b, t, type_flag , lb, lt, rb, rt);
PTR = new Data (l, r, b, t, lb, lt, rb, rt);
m_dag_node = node;
}
///*! Constructor given Vertex & Halfedge handles. */
//Td_active_trapezoid (Vertex_const_handle l, Vertex_const_handle r,
// Halfedge_const_handle b, Halfedge_const_handle t,
// Type tp = TD_TRAPEZOID,
// unsigned char boundness_flag = CGAL_TD_INTERIOR,
// boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
// boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
// Dag_node* node = 0)
//{
//
// //build the type flag
// unsigned char type_flag = 0;
// if (tp == TD_TRAPEZOID)
// type_flag |= CGAL_TD_TRAPEZOID;
// else if (tp == TD_EDGE)
// type_flag |= CGAL_TD_EDGE;
// else //tp == TD_VERTEX
// type_flag |= CGAL_TD_VERTEX;
// PTR = new Trpz_parameter_space
// (l, r, b, t, type_flag | boundness_flag, lb, lt, rb, rt);
// m_dag_node = node;
//}
//
///*! Constructor given Pointers to Vertex & Halfedge handles. */
//Td_active_trapezoid (Vertex_const_handle& l, Vertex_const_handle& r ,
// Halfedge_const_handle& b, Halfedge_const_handle& t,
// unsigned char type_flag,
// bool on_left_bndry,
// bool on_right_bndry,
// bool on_bottom_bndry,
// bool on_top_bndry,
// boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
// boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
// Dag_node* node = 0)
//{
// PTR = new Trpz_parameter_space
// (l ,r ,b ,t ,
// (type_flag |
// (on_left_bndry ? CGAL_TD_ON_LEFT_BOUNDARY : 0) |
// (on_right_bndry ? CGAL_TD_ON_RIGHT_BOUNDARY : 0) |
// (on_bottom_bndry ? CGAL_TD_ON_BOTTOM_BOUNDARY : 0) |
// (on_top_bndry ? CGAL_TD_ON_TOP_BOUNDARY : 0) ),
// lb, lt, rb, rt);
// m_dag_node = node;
//}
///*! Constructor given Pointers to Vertex & Halfedge handles. */ //MICHAL: TBR
//Td_active_trapezoid (Vertex_const_handle* l, Vertex_const_handle* r ,
// Halfedge_const_handle* b, Halfedge_const_handle* t,
// unsigned char type_flag,
// bool on_left_bndry,
// bool on_right_bndry,
// bool on_bottom_bndry,
// bool on_top_bndry,
// boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
// boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
// Dag_node* node = 0)
//{
// PTR = new Trpz_parameter_space
// (l ? *l : Traits::empty_vtx_handle(),
// r ? *r : Traits::empty_vtx_handle(),
// b ? *b : Traits::empty_he_handle(),
// t ? *t : Traits::empty_he_handle(),
// (type_flag |
// (on_left_bndry ? CGAL_TD_ON_LEFT_BOUNDARY : 0) |
// (on_right_bndry ? CGAL_TD_ON_RIGHT_BOUNDARY : 0) |
// (on_bottom_bndry ? CGAL_TD_ON_BOTTOM_BOUNDARY : 0) |
// (on_top_bndry ? CGAL_TD_ON_TOP_BOUNDARY : 0) ),
// lb, lt, rb, rt);
// m_dag_node = node;
//}
/*! Copy constructor. */
Td_active_trapezoid (const Self& tr) : Handle(tr)
@ -399,36 +333,12 @@ public:
return (unsigned long) PTR;
}
/*! Access trapezoid left. */
inline Vertex_const_handle left_unsafe() const
{
return ptr()->e0;
//CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e0)) != NULL);
//return boost::get<Vertex_const_handle>(ptr()->e0);
}
/*! Access trapezoid left.
* filters out the infinite case which returns predefined dummy values
*/
inline Vertex_const_handle left() const
{
return left_unsafe();
//if (is_on_left_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary()) //MICHAL: why all 3 and not only is_on_left_boundary()?
//{
// return Traits::empty_vtx_handle();
//}
////else
//return left_unsafe();
}
/*! Access trapezoid right. */
inline Vertex_const_handle right_unsafe() const
{
return ptr()->e1;
//CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e1)) != NULL);
//return boost::get<Vertex_const_handle>(ptr()->e1);
return ptr()->left_v;
}
/*! Access trapezoid right.
@ -436,23 +346,7 @@ public:
*/
inline Vertex_const_handle right () const
{
return right_unsafe();
//if (is_on_right_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary())
//{
// return Traits::empty_vtx_handle();
//}
////else
//return right_unsafe();
}
/*! Access trapezoid bottom. */
inline Halfedge_const_handle bottom_unsafe () const
{
return ptr()->e2;
//CGAL_assertion(boost::get<Halfedge_const_handle>(&(ptr()->e2)) != NULL);
//return boost::get<Halfedge_const_handle>(ptr()->e2);
return ptr()->right_v;
}
/*! Access trapezoid bottom.
@ -460,57 +354,17 @@ public:
*/
inline Halfedge_const_handle bottom () const
{
return bottom_unsafe();
// return !is_on_bottom_boundary() ?
// bottom_unsafe() : Traits::empty_he_handle();
return ptr()->bottom_he;
}
/*! Access trapezoid top. */
inline Halfedge_const_handle top_unsafe () const
{
return ptr()->e3;
}
/*! Access trapezoid top.
* filters out the infinite case which returns predefined dummy values
*/
inline Halfedge_const_handle top () const
{
return top_unsafe();
// return !is_on_top_boundary() ?
// top_unsafe() : Traits::empty_he_handle();
return ptr()->top_he;
}
///*! Access trapezoid type. */
//inline Type type() const //MICHAL: TBR
//{
// switch(ptr()->e4 & CGAL_TD_TYPE_MASK)
// {
// case CGAL_TD_TRAPEZOID:
// return TD_TRAPEZOID;
// case CGAL_TD_EDGE:
// return TD_EDGE;
// case CGAL_TD_VERTEX:
// return TD_VERTEX;
// default:
// CGAL_assertion(false);
// return TD_TRAPEZOID;
// }
// }
///*! Access trapezoid type flag. */
//inline unsigned char type_flag() const
// {
// return (ptr()->e4 & CGAL_TD_TYPE_MASK);
// }
///*! Access on boundaries flag. */
//inline unsigned char on_boundaries_flag() const
//{
// return (ptr()->e4 & CGAL_TD_ON_ALL_BOUNDARIES);
//}
/*! Access is on left boundary. */
inline bool is_on_left_boundary() const
{
@ -543,16 +397,16 @@ public:
}
/*! Access left bottom neighbour. */
boost::optional<Td_map_item> lb() const { return ptr()->e5; }
boost::optional<Td_map_item> lb() const { return ptr()->lb; }
/*! Access left top neighbour. */
boost::optional<Td_map_item> lt() const { return ptr()->e6; }
boost::optional<Td_map_item> lt() const { return ptr()->lt; }
/*! Access right bottom neighbour. */
boost::optional<Td_map_item> rb() const { return ptr()->e7; }
boost::optional<Td_map_item> rb() const { return ptr()->rb; }
/*! Access right top neighbour. */
boost::optional<Td_map_item> rt() const { return ptr()->e8; }
boost::optional<Td_map_item> rt() const { return ptr()->rt; }
/*! Access DAG node. */
Dag_node* dag_node() const {return m_dag_node;}
@ -561,15 +415,15 @@ public:
//@}
/*! Removing this trapezoid (defining it as in-active) */
inline void remove(Dag_node* left=0) //MICHAL: TBR - need to add before_removal method that sets the left child of the dag node
{
CGAL_precondition(is_active());
///*! Removing this trapezoid (defining it as in-active) */
//inline void remove(Dag_node* left=0) //MICHAL: TBR - need to add before_removal method that sets the left child of the dag node
//{
// CGAL_precondition(is_active());
// resets left son in data structure depending on input.
if (left)
m_dag_node->set_left_child(*left);
}
// // resets left son in data structure depending on input.
// if (left)
// m_dag_node->set_left_child(*left);
//}
/* Merge this trapezoid with the input trapezoid.
Precondition:

View File

@ -58,14 +58,6 @@ class Td_active_vertex : public Handle
{
public:
//type of trapezoid type
enum Type
{
TD_TRAPEZOID,
TD_EDGE,
TD_VERTEX
};
//type of traits class
typedef Td_traits_ Traits;
@ -89,23 +81,6 @@ public:
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoid parameter space
// Ninetuple which represents the Trapezoid:
// - for regular & edge trapezoids or active point trapezoids:
// left vertex, right vertex, bottom halfedge, top halfedge
// - for removed point trapezoids:
// point or X_monotone_curve_2+ cv end
// type flag + on boundaries flags,
// left-bottom neighbor trapezoid, left-top neighbor trapezoid,
// right-bottom neighbor trapezoid, right-top neighbor trapezoid
typedef Td_ninetuple<Vertex_const_handle,
Vertex_const_handle,
Halfedge_const_handle,
Halfedge_const_handle,
unsigned char,
boost::optional<Td_map_item>, boost::optional<Td_map_item>,
boost::optional<Td_map_item>, boost::optional<Td_map_item> > Trpz_parameter_space;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
@ -143,11 +118,41 @@ public:
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_active_vertex<Td_traits_>;
public:
//c'tors
Data (Vertex_const_handle _v,
Halfedge_const_handle _bottom_he,
Halfedge_const_handle _top_he,
boost::optional<Td_map_item> _lb,
boost::optional<Td_map_item> _lt,
boost::optional<Td_map_item> _rb,
boost::optional<Td_map_item> _rt)
: v(_v),bottom_he(_bottom_he),top_he(_top_he),
lb(_lb),lt(_lt),rb(_rb),rt(_rt)
{ }
~Data() { }
protected:
Vertex_const_handle v;
Halfedge_const_handle bottom_he;
Halfedge_const_handle top_he;
boost::optional<Td_map_item> lb;
boost::optional<Td_map_item> lt;
boost::optional<Td_map_item> rb;
boost::optional<Td_map_item> rt;
};
private:
Trpz_parameter_space* ptr() const { return (Trpz_parameter_space*)(PTR); }
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
@ -188,29 +193,22 @@ public:
}
/*! Set the trapezoid's left (Vertex_const_handle). */
inline void set_left(Vertex_const_handle v)
inline void set_vertex(Vertex_const_handle v)
{
ptr()->e0 = v;
ptr()->v = v;
}
///*! Set the trapezoid's right (Vertex_const_handle). */
//CGAL_TD_INLINE void set_right(Vertex_const_handle v)
//{
// CGAL_precondition(is_active());
// ptr()->e1 = v;
//}
/*! Set the trapezoid's bottom (Halfedge_const_handle). */
inline void set_bottom(Halfedge_const_handle he)
{
if (bottom() != Traits::empty_he_handle() &&
bottom_unsafe()->direction() != he->direction())
bottom()->direction() != he->direction())
{
ptr()->e2 = he->twin();
ptr()->bottom_he = he->twin();
}
else
{
ptr()->e2 = he;
ptr()->bottom_he = he;
}
}
@ -218,61 +216,38 @@ public:
inline void set_top(Halfedge_const_handle he)
{
if (top() != Traits::empty_he_handle() &&
top_unsafe()->direction() != he->direction())
top()->direction() != he->direction())
{
ptr()->e3 = he->twin();
ptr()->top_he = he->twin();
}
else
{
ptr()->e3 = he;
ptr()->top_he = he;
}
}
/*! Set left bottom neighbour. */
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->e5 = lb; }
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->lb = lb; }
/*! Set left top neighbour. */
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->e6 = lt; }
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->lt = lt; }
/*! Set right bottom neighbour. */
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->e7 = rb; }
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->rb = rb; }
/*! Set right top neighbour. */
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->e8 = rt; }
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->rt = rt; }
public:
/// \name Constructors.
//@{
///*! Default constructor. */
//Td_active_vertex()
//{
// //define the initial trapezoid: left, right, btm, top are at infinity.
// // its type is TD_TRAPEZOID ,it is on all boundaries, and has no neighbours
// PTR = new Trpz_parameter_space
// (Traits::vtx_at_left_infinity(),
// Traits::vtx_at_right_infinity(),
// Traits::he_at_bottom_infinity(),
// Traits::he_at_top_infinity(),
// CGAL_TD_TRAPEZOID | CGAL_TD_ON_ALL_BOUNDARIES ,
// 0, 0, 0, 0);
// m_dag_node = 0;
//}
Td_active_vertex ()
{
//build the type flag
unsigned char type_flag = 0;
type_flag |= CGAL_TD_VERTEX;
PTR = new Trpz_parameter_space
(Traits::empty_vtx_handle(), Traits::empty_vtx_handle(),
Traits::empty_he_handle(), Traits::empty_he_handle(), type_flag | CGAL_TD_INTERIOR,
PTR = new Data
(Traits::empty_vtx_handle(), Traits::empty_he_handle(), Traits::empty_he_handle(),
boost::none, boost::none, boost::none, boost::none);
m_dag_node = NULL;
}
@ -283,58 +258,20 @@ public:
Halfedge_const_handle btm_he,
Halfedge_const_handle top_he,
boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
Dag_node* node = 0)
//Vertex_const_handle l, Vertex_const_handle r,
//Halfedge_const_handle b, Halfedge_const_handle t,
//Type tp = TD_TRAPEZOID,
//unsigned char boundness_flag = CGAL_TD_INTERIOR,
//Self* lb = 0, Self* lt = 0,
//Self* rb = 0, Self* rt = 0,
//Dag_node* node = 0)
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
Dag_node* node = 0)
{
//build the type flag
unsigned char type_flag = 0;
type_flag |= CGAL_TD_VERTEX;
PTR = new Trpz_parameter_space
(v, Traits::empty_vtx_handle(),
btm_he, top_he, type_flag | CGAL_TD_INTERIOR, lb, lt, rb, rt);
PTR = new Data (v, btm_he, top_he, lb, lt, rb, rt);
m_dag_node = node;
}
///*! Constructor given Pointers to Vertex & Halfedge handles. */
//Td_active_vertex (Vertex_const_handle* l, Vertex_const_handle* r ,
// Halfedge_const_handle* b, Halfedge_const_handle* t,
// unsigned char type_flag,
// bool on_left_bndry,
// bool on_right_bndry,
// bool on_bottom_bndry,
// bool on_top_bndry,
// Self* lb = 0, Self* lt = 0,
// Self* rb = 0, Self* rt = 0,
// Dag_node* node = 0)
//{
// PTR = new Trpz_parameter_space
// (l ? *l : Traits::vtx_at_left_infinity(),
// r ? *r : Traits::vtx_at_right_infinity(),
// b ? *b : Traits::he_at_bottom_infinity(),
// t ? *t : Traits::he_at_top_infinity(),
// (type_flag |
// (on_left_bndry ? CGAL_TD_ON_LEFT_BOUNDARY : 0) |
// (on_right_bndry ? CGAL_TD_ON_RIGHT_BOUNDARY : 0) |
// (on_bottom_bndry ? CGAL_TD_ON_BOTTOM_BOUNDARY : 0) |
// (on_top_bndry ? CGAL_TD_ON_TOP_BOUNDARY : 0) ),
//lb, lt, rb, rt);
// m_dag_node = node;
// }
//
/*! Copy constructor. */
Td_active_vertex (const Self& tr) : Handle(tr)
{
{
m_dag_node = tr.m_dag_node;
}
}
//@}
@ -385,63 +322,19 @@ public:
return (unsigned long) PTR;
}
/*! Access trapezoid left. */
inline Vertex_const_handle left_unsafe() const
inline Vertex_const_handle vertex() const
{
return ptr()->e0;
//CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e0)) != NULL);
//return boost::get<Vertex_const_handle>(ptr()->e0);
}
/*! Access trapezoid left.
* filters out the infinite case which returns predefined dummy values
*/
inline Vertex_const_handle left() const
{
return left_unsafe();
return ptr()->v;
}
inline Curve_end curve_end() const
{
return Curve_end(left()->curve_end());
return Curve_end(vertex()->curve_end());
}
inline const Point& point() const
{
return left()->point();
}
///*! Access trapezoid right. */
//CGAL_TD_INLINE Vertex_const_handle right_unsafe() const
// {
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e1)) != NULL);
// return boost::get<Vertex_const_handle>(ptr()->e1);
// }
///*! Access trapezoid right.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Vertex_const_handle right () const
//{
// CGAL_precondition(is_active());
// if (is_on_right_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary())
// {
// return Traits::vtx_at_right_infinity();
// }
// //else
// return right_unsafe();
//}
//
/*! Access trapezoid bottom. */
inline Halfedge_const_handle bottom_unsafe () const
{
return ptr()->e2;
//CGAL_assertion(boost::get<Halfedge_const_handle>(&(ptr()->e2)) != NULL);
//return boost::get<Halfedge_const_handle>(ptr()->e2);
return vertex()->point();
}
/*! Access trapezoid bottom.
@ -449,37 +342,34 @@ public:
*/
inline Halfedge_const_handle bottom () const
{
return bottom_unsafe();
return ptr()->bottom_he;
}
/*! Access trapezoid top. */
inline Halfedge_const_handle top_unsafe () const
{
return ptr()->e3;
}
///*! Access trapezoid top. */
//inline Halfedge_const_handle top_unsafe () const
//{
// return ptr()->top_he;
//}
/*! Access trapezoid top.
* filters out the infinite case which returns predefined dummy values
*/
inline Halfedge_const_handle top () const
{
return top_unsafe();
return ptr()->top_he;
}
/*! Access left bottom neighbour. */
boost::optional<Td_map_item> lb() const { return ptr()->e5; }
boost::optional<Td_map_item> lb() const { return ptr()->lb; }
/*! Access left top neighbour. */
boost::optional<Td_map_item> lt() const { return ptr()->e6; }
boost::optional<Td_map_item> lt() const { return ptr()->lt; }
/*! Access right bottom neighbour. */
boost::optional<Td_map_item> rb() const { return ptr()->e7; }
boost::optional<Td_map_item> rb() const { return ptr()->rb; }
/*! Access right top neighbour. */
boost::optional<Td_map_item> rt() const { return ptr()->e8; }
boost::optional<Td_map_item> rt() const { return ptr()->rt; }
/*! Access DAG node. */
Dag_node* dag_node() const {return m_dag_node;}

View File

@ -58,14 +58,6 @@ class Td_inactive_edge : public Handle
{
public:
//type of trapezoid type
enum Type
{
TD_TRAPEZOID,
TD_EDGE,
TD_VERTEX
};
//type of traits class
typedef Td_traits_ Traits;
@ -87,25 +79,8 @@ public:
//type of Td_inactive_edge (Self)
typedef typename Traits::Td_inactive_edge Self;
typedef typename Traits::Td_map_item Td_map_item;
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoid parameter space
// Ninetuple which represents the Trapezoid:
// - for regular & edge trapezoids or active point trapezoids:
// left vertex, right vertex, bottom halfedge, top halfedge
// - for removed point trapezoids:
// point or X_monotone_curve_2+ cv end
// type flag + on boundaries flags,
// left-bottom neighbor trapezoid, left-top neighbor trapezoid,
// right-bottom neighbor trapezoid, right-top neighbor trapezoid
typedef Td_ninetuple<Vertex_const_handle,
Vertex_const_handle,
boost::shared_ptr<X_monotone_curve_2>,
Halfedge_const_handle,
unsigned char,
boost::optional<Td_map_item>, boost::optional<Td_map_item>,
boost::optional<Td_map_item>, boost::optional<Td_map_item> > Trpz_parameter_space;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
@ -143,11 +118,36 @@ public:
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_inactive_edge<Td_traits_>;
public:
//c'tors
Data (boost::shared_ptr<X_monotone_curve_2> _cv)
//,boost::optional<Td_map_item> _lb,
// boost::optional<Td_map_item> _lt,
// boost::optional<Td_map_item> _rb,
// boost::optional<Td_map_item> _rt)
: cv(_cv) //, lb(_lb),lt(_lt),rb(_rb),rt(_rt)
{ }
~Data() { }
protected:
boost::shared_ptr<X_monotone_curve_2> cv;
//boost::optional<Td_map_item> lb; //MICHAL: Do we need neighbours for inactive edge?
//boost::optional<Td_map_item> lt;
//boost::optional<Td_map_item> rb;
//boost::optional<Td_map_item> rt;
};
private:
Trpz_parameter_space* ptr() const { return (Trpz_parameter_space*)(PTR); }
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
@ -162,15 +162,15 @@ public:
Dag_node* m_dag_node; //pointer to the search structure (DAG) node
/*! Initialize the trapezoid's neighbours. */
inline void init_neighbours(boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none)
{
set_lb(lb);
set_lt(lt);
set_rb(rb);
set_rt(rt);
}
///*! Initialize the trapezoid's neighbours. */
//inline void init_neighbours(boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
// boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none)
//{
// set_lb(lb);
// set_lt(lt);
// set_rb(rb);
// set_rt(rt);
//}
/*! Set the DAG node. */
inline void set_dag_node(Dag_node* p)
@ -185,148 +185,42 @@ public:
}
///*! Set the trapezoid's left (Vertex_const_handle). */
//CGAL_TD_INLINE void set_left(Vertex_const_handle v)
//{
// CGAL_precondition(is_active());
// ptr()->e0 = v;
//}
//
///*! Set the trapezoid's right (Vertex_const_handle). */
//CGAL_TD_INLINE void set_right(Vertex_const_handle v)
//{
// CGAL_precondition(is_active());
// ptr()->e1 = v;
//}
//
///*! Set the trapezoid's bottom (Halfedge_const_handle). */
//CGAL_TD_INLINE void set_bottom(Halfedge_const_handle he)
//{
// CGAL_precondition(is_active());
// if (!is_on_bottom_boundary() &&
// bottom_unsafe()->direction() != he->direction())
// {
// ptr()->e2 = he->twin();
// }
// else
// {
// ptr()->e2 = he;
// }
//}
//
///*! Set the trapezoid's top (Halfedge_const_handle). */
//CGAL_TD_INLINE void set_top(Halfedge_const_handle he)
//{
// CGAL_precondition(is_active());
// if (!is_on_top_boundary() &&
// top_unsafe()->direction() != he->direction())
// {
// ptr()->e3 = he->twin();
// }
// else
// {
// ptr()->e3 = he;
// }
//}
//CGAL_TD_INLINE void update_removed_trpz()
//{
// CGAL_precondition(is_active());
// if (type() == TD_EDGE)
// {
// //ptr()->e2 = (boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(top()->curve()));
// set_curve_for_rem_he(top()->curve());
// return;
// }
//
// //else if (type() == TD_VERTEX)
//
// Curve_end v_ce(left()->curve_end());
// ptr()->e2 = (boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(v_ce.cv()));
// //CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2>>( &(ptr()->e2)) != NULL);
//
// ptr()->e1 = (v_ce.ce() == ARR_MIN_END ) ? CGAL_TD_CV_MIN_END : CGAL_TD_CV_MAX_END;
//
// if (!is_on_boundaries())
// { //if the trapezoid respresents an inner vertex
// ptr()->e0 = left()->point();
// }
//}
/*! Set the x_monotone_curve_2 for removed edge degenerate trapezoid. */
CGAL_TD_INLINE void set_curve(const X_monotone_curve_2& cv)
{
ptr()->e2 = (boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(cv));
ptr()->cv = (boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(cv));
}
/*! Set left bottom neighbour. */
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->e5 = lb; }
inline void set_lb(boost::optional<Td_map_item> lb) { } //ptr()->lb = lb; }
/*! Set left top neighbour. */
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->e6 = lt; }
inline void set_lt(boost::optional<Td_map_item> lt) { } //ptr()->lt = lt; }
/*! Set right bottom neighbour. */
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->e7 = rb; }
inline void set_rb(boost::optional<Td_map_item> rb) { } //ptr()->rb = rb; }
/*! Set right top neighbour. */
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->e8 = rt; }
inline void set_rt(boost::optional<Td_map_item> rt) { } //ptr()->rt = rt; }
public:
/// \name Constructors.
//@{
///*! Default constructor. */
//Td_inactive_edge()
//{
// //define the initial trapezoid: left, right, btm, top are at infinity.
// // its type is TD_TRAPEZOID ,it is on all boundaries, and has no neighbours
// PTR = new Trpz_parameter_space
// (Traits::vtx_at_left_infinity(),
// Traits::vtx_at_right_infinity(),
// Traits::he_at_bottom_infinity(),
// Traits::he_at_top_infinity(),
// CGAL_TD_TRAPEZOID | CGAL_TD_ON_ALL_BOUNDARIES ,
// 0, 0, 0, 0);
// m_dag_node = 0;
//}
/*! Constructor given Vertex & Halfedge handles. */
Td_inactive_edge (Halfedge_const_handle he_before_rem,
boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
Dag_node* node = 0)
//Vertex_const_handle l, Vertex_const_handle r,
// Halfedge_const_handle b, Halfedge_const_handle t,
// Type tp = TD_TRAPEZOID,
// unsigned char boundness_flag = CGAL_TD_INTERIOR,
// Self* lb = 0, Self* lt = 0,
// Self* rb = 0, Self* rt = 0,
// Dag_node* node = 0)
Td_inactive_edge (Halfedge_const_handle he_before_rem, Dag_node* node = NULL)
{
//build the type flag
unsigned char type_flag = 0;
type_flag |= CGAL_TD_EDGE;
PTR = new Trpz_parameter_space
(Traits::empty_vtx_handle(),
Traits::empty_vtx_handle(),
(boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(he_before_rem->curve())),
Traits::empty_he_handle(),
type_flag | CGAL_TD_INTERIOR, lb, lt, rb, rt);
PTR = new Data((boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(he_before_rem->curve())));
m_dag_node = node;
}
/*! Copy constructor. */
Td_inactive_edge (const Self& tr) : Handle(tr)
{
{
m_dag_node = tr.m_dag_node;
}
}
//@}
@ -337,20 +231,20 @@ public:
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
CGAL_TD_INLINE Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
CGAL_TD_INLINE bool operator== (const Self& t2) const
inline bool operator== (const Self& t2) const
{
return CGAL::identical(*this,t2);
return CGAL::identical(*this,t2);
}
/*! Operator!=. */
CGAL_TD_INLINE bool operator!= (const Self& t2) const
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
@ -361,126 +255,40 @@ public:
/// \name Access methods.
//@{
CGAL_TD_INLINE Self& self()
{
return *this;
}
inline Self& self()
{
return *this;
}
CGAL_TD_INLINE const Self& self() const
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
CGAL_TD_INLINE unsigned long id() const
{
return (unsigned long) PTR;
}
///*! Access trapezoid left. */
//CGAL_TD_INLINE Vertex_const_handle left_unsafe() const
// {
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e0)) != NULL);
// return boost::get<Vertex_const_handle>(ptr()->e0);
// }
///*! Access trapezoid left.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Vertex_const_handle left() const
// {
// CGAL_precondition(is_active());
// if (is_on_left_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary())
// {
// return Traits::vtx_at_left_infinity();
// }
// //else
// return left_unsafe();
// }
///*! Access trapezoid right. */
//CGAL_TD_INLINE Vertex_const_handle right_unsafe() const
// {
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e1)) != NULL);
// return boost::get<Vertex_const_handle>(ptr()->e1);
// }
///*! Access trapezoid right.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Vertex_const_handle right () const
//{
// CGAL_precondition(is_active());
// if (is_on_right_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary())
// {
// return Traits::vtx_at_right_infinity();
// }
// //else
// return right_unsafe();
//}
//
///*! Access trapezoid bottom. */
//CGAL_TD_INLINE Halfedge_const_handle bottom_unsafe () const
//{
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Halfedge_const_handle>(&(ptr()->e2)) != NULL);
// return boost::get<Halfedge_const_handle>(ptr()->e2);
// }
//
///*! Access trapezoid bottom.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Halfedge_const_handle bottom () const
// {
// CGAL_precondition(is_active());
// return !is_on_bottom_boundary() ?
// bottom_unsafe() : Traits::he_at_bottom_infinity();
// }
///*! Access trapezoid top. */
//CGAL_TD_INLINE Halfedge_const_handle top_unsafe () const
// {
// CGAL_precondition(is_active());
// return ptr()->e3;
// }
///*! Access trapezoid top.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Halfedge_const_handle top () const
// {
// CGAL_precondition(is_active());
// return !is_on_top_boundary() ?
// top_unsafe() : Traits::he_at_top_infinity();
// }
inline unsigned long id() const
{
return (unsigned long) PTR;
}
inline X_monotone_curve_2& curve() const
{
X_monotone_curve_2* cv_ptr = (ptr()->e2).get();
X_monotone_curve_2* cv_ptr = (ptr()->cv).get();
CGAL_assertion(cv_ptr != NULL);
return *cv_ptr;
}
/*! Access left bottom neighbour. */
boost::optional<Td_map_item> lb() const { return ptr()->e5; }
boost::optional<Td_map_item> lb() const { return boost::none; }
/*! Access left top neighbour. */
boost::optional<Td_map_item> lt() const { return ptr()->e6; }
boost::optional<Td_map_item> lt() const { return boost::none; }
/*! Access right bottom neighbour. */
boost::optional<Td_map_item> rb() const { return ptr()->e7; }
boost::optional<Td_map_item> rb() const { return boost::none; }
/*! Access right top neighbour. */
boost::optional<Td_map_item> rt() const { return ptr()->e8; }
boost::optional<Td_map_item> rt() const { return boost::none; }
/*! Access DAG node. */
Dag_node* dag_node() const {return m_dag_node;}

View File

@ -58,14 +58,6 @@ class Td_inactive_fictitious_vertex : public Handle
{
public:
//type of trapezoid type
enum Type
{
TD_TRAPEZOID,
TD_EDGE,
TD_VERTEX
};
//type of traits class
typedef Td_traits_ Traits;
@ -89,24 +81,6 @@ public:
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoid parameter space
// Ninetuple which represents the Trapezoid:
// - for regular & edge trapezoids or active point trapezoids:
// left vertex, right vertex, bottom halfedge, top halfedge
// - for removed point trapezoids:
// point or X_monotone_curve_2+ cv end
// type flag + on boundaries flags,
// left-bottom neighbor trapezoid, left-top neighbor trapezoid,
// right-bottom neighbor trapezoid, right-top neighbor trapezoid
typedef Td_ninetuple<Vertex_const_handle,
unsigned char,
boost::shared_ptr<X_monotone_curve_2>,
Halfedge_const_handle,
unsigned char,
boost::optional<Td_map_item>, boost::optional<Td_map_item>,
boost::optional<Td_map_item>, boost::optional<Td_map_item> > Trpz_parameter_space;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
@ -144,11 +118,29 @@ public:
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_inactive_fictitious_vertex<Td_traits_>;
public:
//c'tors
Data (boost::shared_ptr<X_monotone_curve_2> _cv,
unsigned char _chr): cv(_cv),chr(_chr) //MICHAL: Do we need neighbours for inactive fict vertex?
{ }
~Data() { }
protected:
boost::shared_ptr<X_monotone_curve_2> cv;
unsigned char chr;
};
private:
Trpz_parameter_space* ptr() const { return (Trpz_parameter_space*)(PTR); }
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
@ -163,15 +155,15 @@ public:
Dag_node* m_dag_node; //pointer to the search structure (DAG) node
/*! Initialize the trapezoid's neighbours. */
inline void init_neighbours(boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none)
{
set_lb(lb);
set_lt(lt);
set_rb(rb);
set_rt(rt);
}
///*! Initialize the trapezoid's neighbours. */
//inline void init_neighbours(boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
// boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none)
//{
// set_lb(lb);
// set_lt(lt);
// set_rb(rb);
// set_rt(rt);
//}
/*! Set the DAG node. */
inline void set_dag_node(Dag_node* p)
@ -186,130 +178,46 @@ public:
}
///*! Set the trapezoid's left (Vertex_const_handle). */
//CGAL_TD_INLINE void set_left(Vertex_const_handle v)
//{
// CGAL_asserion(false)
// //CGAL_precondition(is_active());
// //ptr()->e0 = v;
//}
//
///*! Set the trapezoid's right (Vertex_const_handle). */
//CGAL_TD_INLINE void set_right(Vertex_const_handle v)
//{
// CGAL_precondition(is_active());
// ptr()->e1 = v;
//}
inline void set_curve_end(Vertex_const_handle v_before_rem)
{
Curve_end v_ce(v_before_rem->curve_end());
ptr()->e2 = (boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(v_ce.cv()));
ptr()->cv = (boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(v_ce.cv()));
//CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2>>( &(ptr()->e2)) != NULL);
ptr()->e1 = (v_ce.ce() == ARR_MIN_END ) ? CGAL_TD_CV_MIN_END : CGAL_TD_CV_MAX_END;
ptr()->chr = (v_ce.ce() == ARR_MIN_END ) ? CGAL_TD_CV_MIN_END : CGAL_TD_CV_MAX_END;
}
///*! Set the trapezoid's bottom (Halfedge_const_handle). */
//CGAL_TD_INLINE void set_bottom(Halfedge_const_handle he)
//{
// CGAL_precondition(is_active());
// if (!is_on_bottom_boundary() &&
// bottom_unsafe()->direction() != he->direction())
// {
// ptr()->e2 = he->twin();
// }
// else
// {
// ptr()->e2 = he;
// }
//}
//
///*! Set the trapezoid's top (Halfedge_const_handle). */
//CGAL_TD_INLINE void set_top(Halfedge_const_handle he)
//{
// CGAL_precondition(is_active());
// if (!is_on_top_boundary() &&
// top_unsafe()->direction() != he->direction())
// {
// ptr()->e3 = he->twin();
// }
// else
// {
// ptr()->e3 = he;
// }
//}
/*! Set left bottom neighbour. */
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->e5 = lb; }
inline void set_lb(boost::optional<Td_map_item> lb) { }
/*! Set left top neighbour. */
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->e6 = lt; }
inline void set_lt(boost::optional<Td_map_item> lt) { }
/*! Set right bottom neighbour. */
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->e7 = rb; }
inline void set_rb(boost::optional<Td_map_item> rb) { }
/*! Set right top neighbour. */
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->e8 = rt; }
inline void set_rt(boost::optional<Td_map_item> rt) { }
public:
/// \name Constructors.
//@{
/*! Default constructor. */
/*Td_inactive_fictitious_vertex()
{
//define the initial trapezoid: left, right, btm, top are at infinity.
// its type is TD_TRAPEZOID ,it is on all boundaries, and has no neighbours
PTR = new Trpz_parameter_space
(Traits::vtx_at_left_infinity(),
Traits::vtx_at_right_infinity(),
Traits::he_at_bottom_infinity(),
Traits::he_at_top_infinity(),
CGAL_TD_VERTEX | CGAL_TD_ON_ALL_BOUNDARIES ,
boost::none, boost::none , boost::none , boost::none);
m_dag_node = 0;
}*/
/*! Constructor given Vertex & Halfedge handles. */
Td_inactive_fictitious_vertex (Vertex_const_handle v_before_rem,
boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
Dag_node* node = 0)
//Vertex_const_handle l, Vertex_const_handle r,
// Halfedge_const_handle b, Halfedge_const_handle t,
// Type tp = TD_TRAPEZOID,
// unsigned char boundness_flag = CGAL_TD_INTERIOR,
// Self* lb = 0, Self* lt = 0,
// Self* rb = 0, Self* rt = 0,
// Dag_node* node = 0)
Td_inactive_fictitious_vertex (Vertex_const_handle v_before_rem, Dag_node* node = NULL)
{
//build the type flag
unsigned char type_flag = 0;
type_flag |= CGAL_TD_VERTEX;
Curve_end v_ce(v_before_rem->curve_end());
PTR = new Trpz_parameter_space
(Traits::empty_vtx_handle(),
(v_ce.ce() == ARR_MIN_END ) ? CGAL_TD_CV_MIN_END : CGAL_TD_CV_MAX_END,
(boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(v_ce.cv())),
Traits::empty_he_handle(),
type_flag | CGAL_TD_INTERIOR, lb, lt, rb, rt);
PTR = new Data((boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(v_ce.cv())),
(v_ce.ce() == ARR_MIN_END ) ? CGAL_TD_CV_MIN_END : CGAL_TD_CV_MAX_END);
m_dag_node = node;
}
/*! Copy constructor. */
Td_inactive_fictitious_vertex (const Self& tr) : Handle(tr)
{
{
m_dag_node = tr.m_dag_node;
}
}
//@}
@ -320,20 +228,20 @@ public:
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
CGAL_TD_INLINE Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
CGAL_TD_INLINE bool operator== (const Self& t2) const
inline bool operator== (const Self& t2) const
{
return CGAL::identical(*this,t2);
return CGAL::identical(*this,t2);
}
/*! Operator!=. */
CGAL_TD_INLINE bool operator!= (const Self& t2) const
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
@ -344,236 +252,46 @@ public:
/// \name Access methods.
//@{
CGAL_TD_INLINE Self& self()
{
return *this;
}
inline Self& self()
{
return *this;
}
CGAL_TD_INLINE const Self& self() const
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
CGAL_TD_INLINE unsigned long id() const
{
return (unsigned long) PTR;
}
///*! Access trapezoid left. */
//CGAL_TD_INLINE Vertex_const_handle left_unsafe() const
// {
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e0)) != NULL);
// return boost::get<Vertex_const_handle>(ptr()->e0);
// }
///*! Access trapezoid left.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Vertex_const_handle left() const
// {
// CGAL_precondition(is_active());
// if (is_on_left_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary())
// {
// return Traits::vtx_at_left_infinity();
// }
// //else
// return left_unsafe();
// }
///*! Access trapezoid right. */
//CGAL_TD_INLINE Vertex_const_handle right_unsafe() const
// {
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e1)) != NULL);
// return boost::get<Vertex_const_handle>(ptr()->e1);
// }
///*! Access trapezoid right.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Vertex_const_handle right () const
//{
// CGAL_precondition(is_active());
// if (is_on_right_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary())
// {
// return Traits::vtx_at_right_infinity();
// }
// //else
// return right_unsafe();
//}
//
///*! Access trapezoid bottom. */
//CGAL_TD_INLINE Halfedge_const_handle bottom_unsafe () const
//{
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Halfedge_const_handle>(&(ptr()->e2)) != NULL);
// return boost::get<Halfedge_const_handle>(ptr()->e2);
// }
//
///*! Access trapezoid bottom.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Halfedge_const_handle bottom () const
// {
// CGAL_precondition(is_active());
// return !is_on_bottom_boundary() ?
// bottom_unsafe() : Traits::he_at_bottom_infinity();
// }
///*! Access trapezoid top. */
//CGAL_TD_INLINE Halfedge_const_handle top_unsafe () const
// {
// CGAL_precondition(is_active());
// return ptr()->e3;
// }
//
///*! Access trapezoid top.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Halfedge_const_handle top () const
// {
// CGAL_precondition(is_active());
// return !is_on_top_boundary() ?
// top_unsafe() : Traits::he_at_top_infinity();
// }
//CGAL_TD_INLINE Point point_for_inner_rem_vtx() const
// {
// CGAL_precondition(!is_active());
// CGAL_precondition(type() == TD_VERTEX);
// CGAL_precondition(!is_on_boundaries());
// CGAL_assertion(boost::get<Point>( &(ptr()->e0)) != NULL);
// return boost::get<Point>( ptr()->e0 );
// }
//CGAL_TD_INLINE std::pair<X_monotone_curve_2*,Arr_curve_end> curve_end() const
//{
// CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != NULL);
// CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != NULL);
// X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
// CGAL_assertion(cv_ptr != NULL);
//
// Arr_curve_end ce =
// (boost::get<unsigned char>(ptr()->e1) == CGAL_TD_CV_MIN_END) ?
// ARR_MIN_END : ARR_MAX_END;
//
// return std::make_pair(cv_ptr, ce);
//}
CGAL_TD_INLINE Curve_end curve_end() const
inline unsigned long id() const
{
X_monotone_curve_2* cv_ptr = (ptr()->e2).get();
return (unsigned long) PTR;
}
inline Curve_end curve_end() const
{
X_monotone_curve_2* cv_ptr = (ptr()->cv).get();
CGAL_assertion(cv_ptr != NULL);
Arr_curve_end ce =
(ptr()->e1 == CGAL_TD_CV_MIN_END) ?
(ptr()->chr == CGAL_TD_CV_MIN_END) ?
ARR_MIN_END : ARR_MAX_END;
return Curve_end(*cv_ptr, ce);
}
//CGAL_TD_INLINE Curve_end curve_end_for_rem_vtx() const
//{
// CGAL_precondition(!is_active());
// CGAL_precondition(type() == TD_VERTEX);
// CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != NULL);
// CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != NULL);
// X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
// CGAL_assertion(cv_ptr != NULL);
//
// Arr_curve_end ce =
// (boost::get<unsigned char>(ptr()->e1) == CGAL_TD_CV_MIN_END) ?
// ARR_MIN_END : ARR_MAX_END;
//
// return Curve_end(*cv_ptr, ce);
//}
//CGAL_TD_INLINE X_monotone_curve_2& curve_for_rem_he() const
//{
// CGAL_precondition(!is_active() && type() == TD_EDGE);
//
// CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != NULL);
// X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
// CGAL_assertion(cv_ptr != NULL);
// return *cv_ptr;
//}
///*! Access trapezoid type. */
//CGAL_TD_INLINE Type type() const
//{
// switch(ptr()->e4 & CGAL_TD_TYPE_MASK)
// {
// case CGAL_TD_TRAPEZOID:
// return TD_TRAPEZOID;
// case CGAL_TD_EDGE:
// return TD_EDGE;
// case CGAL_TD_VERTEX:
// return TD_VERTEX;
// default:
// CGAL_assertion(false);
// return TD_TRAPEZOID;
// }
// }
///*! Access trapezoid type flag. */
//CGAL_TD_INLINE unsigned char type_flag() const
// {
// return (ptr()->e4 & CGAL_TD_TYPE_MASK);
// }
/*! Access on boundaries flag. */
//CGAL_TD_INLINE unsigned char on_boundaries_flag() const
//{
// return (ptr()->e4 & CGAL_TD_ON_ALL_BOUNDARIES);
//}
//
///*! Access is on left boundary. */
//CGAL_TD_INLINE bool is_on_left_boundary() const
// {
// return (ptr()->e4 & CGAL_TD_ON_LEFT_BOUNDARY) != 0;
// }
///*! Access is on right boundary. */
//CGAL_TD_INLINE bool is_on_right_boundary() const
//{
// return (ptr()->e4 & CGAL_TD_ON_RIGHT_BOUNDARY) != 0;
// }
///*! Access is on bottom boundary. */
//CGAL_TD_INLINE bool is_on_bottom_boundary() const
//{
// return (ptr()->e4 & CGAL_TD_ON_BOTTOM_BOUNDARY) != 0;
// }
///*! Access is on top boundary. */
//CGAL_TD_INLINE bool is_on_top_boundary() const
//{
// return (ptr()->e4 & CGAL_TD_ON_TOP_BOUNDARY) != 0;
//}
//
///*! Access is on at least one boundary. */
//CGAL_TD_INLINE bool is_on_boundaries() const
//{
// return (ptr()->e4 & CGAL_TD_ON_ALL_BOUNDARIES) != 0;
//}
/*! Access left bottom neighbour. */
boost::optional<Td_map_item> lb() const { return ptr()->e5; }
boost::optional<Td_map_item> lb() const { return boost::none; }
/*! Access left top neighbour. */
boost::optional<Td_map_item> lt() const { return ptr()->e6; }
boost::optional<Td_map_item> lt() const { return boost::none; }
/*! Access right bottom neighbour. */
boost::optional<Td_map_item> rb() const { return ptr()->e7; }
boost::optional<Td_map_item> rb() const { return boost::none; }
/*! Access right top neighbour. */
boost::optional<Td_map_item> rt() const { return ptr()->e8; }
boost::optional<Td_map_item> rt() const { return boost::none; }
/*! Access DAG node. */
Dag_node* dag_node() const {return m_dag_node;}

View File

@ -27,7 +27,6 @@
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <boost/shared_ptr.hpp>
#ifdef CGAL_TD_DEBUG
@ -58,14 +57,6 @@ class Td_inactive_trapezoid : public Handle
{
public:
//type of trapezoid type
enum Type
{
TD_TRAPEZOID,
TD_EDGE,
TD_VERTEX
};
//type of traits class
typedef Td_traits_ Traits;
@ -89,23 +80,6 @@ public:
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoid parameter space
// Ninetuple which represents the Trapezoid:
// - for regular & edge trapezoids or active point trapezoids:
// left vertex, right vertex, bottom halfedge, top halfedge
// - for removed point trapezoids:
// point or X_monotone_curve_2+ cv end
// type flag + on boundaries flags,
// left-bottom neighbor trapezoid, left-top neighbor trapezoid,
// right-bottom neighbor trapezoid, right-top neighbor trapezoid
typedef Td_ninetuple<Vertex_const_handle,
Vertex_const_handle,
Halfedge_const_handle,
Halfedge_const_handle,
unsigned char,
boost::optional<Td_map_item>, boost::optional<Td_map_item>,
boost::optional<Td_map_item>, boost::optional<Td_map_item> > Trpz_parameter_space;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
@ -143,11 +117,24 @@ public:
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_inactive_trapezoid<Td_traits_>;
public:
//c'tors
Data () { }
~Data() { }
};
private:
Trpz_parameter_space* ptr() const { return (Trpz_parameter_space*)(PTR); }
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
@ -162,15 +149,15 @@ public:
Dag_node* m_dag_node; //pointer to the search structure (DAG) node
/*! Initialize the trapezoid's neighbours. */
inline void init_neighbours(boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none)
{
set_lb(lb);
set_lt(lt);
set_rb(rb);
set_rt(rt);
}
///*! Initialize the trapezoid's neighbours. */
//inline void init_neighbours(boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
// boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none)
//{
// set_lb(lb);
// set_lt(lt);
// set_rb(rb);
// set_rt(rt);
//}
/*! Set the DAG node. */
CGAL_TD_INLINE void set_dag_node(Dag_node* p)
@ -187,16 +174,16 @@ public:
/*! Set left bottom neighbour. */
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->e5 = lb; }
inline void set_lb(boost::optional<Td_map_item> lb) { }
/*! Set left top neighbour. */
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->e6 = lt; }
inline void set_lt(boost::optional<Td_map_item> lt) { }
/*! Set right bottom neighbour. */
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->e7 = rb; }
inline void set_rb(boost::optional<Td_map_item> rb) { }
/*! Set right top neighbour. */
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->e8 = rt; }
inline void set_rt(boost::optional<Td_map_item> rt) { }
public:
@ -205,74 +192,18 @@ public:
//@{
/*! Default constructor. */
Td_inactive_trapezoid()
Td_inactive_trapezoid(Dag_node* node = NULL)
{
//define the initial trapezoid: left, right, btm, top are at infinity.
// its type is TD_TRAPEZOID ,it is on all boundaries, and has no neighbours
PTR = new Trpz_parameter_space
(Traits::empty_vtx_handle(), Traits::empty_vtx_handle(),
Traits::empty_he_handle(), Traits::empty_he_handle(),
CGAL_TD_TRAPEZOID | CGAL_TD_ON_ALL_BOUNDARIES ,
boost::none, boost::none, boost::none, boost::none);
m_dag_node = 0;
PTR = new Data();
m_dag_node = node;
}
///*! Constructor given Vertex & Halfedge handles. */
//Td_inactive_trapezoid (Vertex_const_handle l, Vertex_const_handle r,
// Halfedge_const_handle b, Halfedge_const_handle t,
// Type tp = TD_TRAPEZOID,
// unsigned char boundness_flag = CGAL_TD_INTERIOR,
// Self* lb = 0, Self* lt = 0,
// Self* rb = 0, Self* rt = 0,
// Dag_node* node = 0)
//{
//
// //build the type flag
// unsigned char type_flag = 0;
// if (tp == TD_TRAPEZOID)
// type_flag |= CGAL_TD_TRAPEZOID;
// else if (tp == TD_EDGE)
// type_flag |= CGAL_TD_EDGE;
// else //tp == TD_VERTEX
// type_flag |= CGAL_TD_VERTEX;
// PTR = new Trpz_parameter_space
// (l, r, b, t, type_flag | boundness_flag, lb, lt, rb, rt);
// m_dag_node = node;
//}
//
///*! Constructor given Pointers to Vertex & Halfedge handles. */
//Td_inactive_trapezoid (Vertex_const_handle* l, Vertex_const_handle* r ,
// Halfedge_const_handle* b, Halfedge_const_handle* t,
// unsigned char type_flag,
// bool on_left_bndry,
// bool on_right_bndry,
// bool on_bottom_bndry,
// bool on_top_bndry,
// Self* lb = 0, Self* lt = 0,
// Self* rb = 0, Self* rt = 0,
// Dag_node* node = 0)
//{
// PTR = new Trpz_parameter_space
// (l ? *l : Traits::vtx_at_left_infinity(),
// r ? *r : Traits::vtx_at_right_infinity(),
// b ? *b : Traits::he_at_bottom_infinity(),
// t ? *t : Traits::he_at_top_infinity(),
// (type_flag |
// (on_left_bndry ? CGAL_TD_ON_LEFT_BOUNDARY : 0) |
// (on_right_bndry ? CGAL_TD_ON_RIGHT_BOUNDARY : 0) |
// (on_bottom_bndry ? CGAL_TD_ON_BOTTOM_BOUNDARY : 0) |
// (on_top_bndry ? CGAL_TD_ON_TOP_BOUNDARY : 0) ),
//lb, lt, rb, rt);
// m_dag_node = node;
// }
/*! Copy constructor. */
Td_inactive_trapezoid (const Self& tr) : Handle(tr)
{
{
m_dag_node = tr.m_dag_node;
}
}
//@}
@ -283,20 +214,20 @@ public:
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
CGAL_TD_INLINE Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
CGAL_TD_INLINE bool operator== (const Self& t2) const
inline bool operator== (const Self& t2) const
{
return CGAL::identical(*this,t2);
return CGAL::identical(*this,t2);
}
/*! Operator!=. */
CGAL_TD_INLINE bool operator!= (const Self& t2) const
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
@ -307,47 +238,39 @@ public:
/// \name Access methods.
//@{
CGAL_TD_INLINE Self& self()
{
return *this;
}
inline Self& self()
{
return *this;
}
CGAL_TD_INLINE const Self& self() const
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
CGAL_TD_INLINE unsigned long id() const
inline unsigned long id() const
{
return (unsigned long) PTR;
}
/*! Access left bottom neighbour. */
boost::optional<Td_map_item> lb() const { return ptr()->e5; }
boost::optional<Td_map_item> lb() const { return boost::none; }
/*! Access left top neighbour. */
boost::optional<Td_map_item> lt() const { return ptr()->e6; }
boost::optional<Td_map_item> lt() const { return boost::none; }
/*! Access right bottom neighbour. */
boost::optional<Td_map_item> rb() const { return ptr()->e7; }
boost::optional<Td_map_item> rb() const { return boost::none; }
/*! Access right top neighbour. */
boost::optional<Td_map_item> rt() const { return ptr()->e8; }
boost::optional<Td_map_item> rt() const { return boost::none; }
/*! Access DAG node. */
Dag_node* dag_node() const {return m_dag_node;}
//@}
/*! is trapezoid active */
bool is_active() const
{
return rb()!=
(Self*)CGAL_TD_DELETE_SIGNATURE;
}

View File

@ -27,7 +27,6 @@
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <boost/shared_ptr.hpp>
#ifdef CGAL_TD_DEBUG
@ -58,14 +57,6 @@ class Td_inactive_vertex : public Handle
{
public:
//type of trapezoid type
enum Type
{
TD_TRAPEZOID,
TD_EDGE,
TD_VERTEX
};
//type of traits class
typedef Td_traits_ Traits;
@ -89,23 +80,6 @@ public:
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoid parameter space
// Ninetuple which represents the Trapezoid:
// - for regular & edge trapezoids or active point trapezoids:
// left vertex, right vertex, bottom halfedge, top halfedge
// - for removed point trapezoids:
// point or X_monotone_curve_2+ cv end
// type flag + on boundaries flags,
// left-bottom neighbor trapezoid, left-top neighbor trapezoid,
// right-bottom neighbor trapezoid, right-top neighbor trapezoid
typedef Td_ninetuple<Point,
Vertex_const_handle,
Halfedge_const_handle,
Halfedge_const_handle,
unsigned char,
boost::optional<Td_map_item>, boost::optional<Td_map_item>,
boost::optional<Td_map_item>, boost::optional<Td_map_item> > Trpz_parameter_space;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
@ -143,11 +117,28 @@ public:
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_inactive_vertex<Td_traits_>;
public:
//c'tors
Data (Point _p): p(_p) //MICHAL: Do we need neighbours for inactive vertex?
{ }
~Data() { }
protected:
Point p;
};
private:
Trpz_parameter_space* ptr() const { return (Trpz_parameter_space*)(PTR); }
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
@ -162,15 +153,15 @@ public:
Dag_node* m_dag_node; //pointer to the search structure (DAG) node
/*! Initialize the trapezoid's neighbours. */
inline void init_neighbours(boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none)
{
set_lb(lb);
set_lt(lt);
set_rb(rb);
set_rt(rt);
}
///*! Initialize the trapezoid's neighbours. */
//inline void init_neighbours(boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
// boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none)
//{
// set_lb(lb);
// set_lt(lt);
// set_rb(rb);
// set_rt(rt);
//}
/*! Set the DAG node. */
inline void set_dag_node(Dag_node* p)
@ -185,123 +176,43 @@ public:
}
///*! Set the trapezoid's left (Vertex_const_handle). */
//CGAL_TD_INLINE void set_left(Vertex_const_handle v)
//{
// CGAL_precondition(is_active());
// ptr()->e0 = v;
//}
inline void set_point(Vertex_const_handle v_before_rem)
{
ptr()->e0 = v_before_rem->point();
ptr()->p = v_before_rem->point();
}
///*! Set the trapezoid's right (Vertex_const_handle). */
//CGAL_TD_INLINE void set_right(Vertex_const_handle v)
//{
// CGAL_precondition(is_active());
// ptr()->e1 = v;
//}
//
///*! Set the trapezoid's bottom (Halfedge_const_handle). */
//CGAL_TD_INLINE void set_bottom(Halfedge_const_handle he)
//{
// CGAL_precondition(is_active());
// if (!is_on_bottom_boundary() &&
// bottom_unsafe()->direction() != he->direction())
// {
// ptr()->e2 = he->twin();
// }
// else
// {
// ptr()->e2 = he;
// }
//}
//
///*! Set the trapezoid's top (Halfedge_const_handle). */
//CGAL_TD_INLINE void set_top(Halfedge_const_handle he)
//{
// CGAL_precondition(is_active());
// if (!is_on_top_boundary() &&
// top_unsafe()->direction() != he->direction())
// {
// ptr()->e3 = he->twin();
// }
// else
// {
// ptr()->e3 = he;
// }
//}
/*! Set left bottom neighbour. */
inline void set_lb(boost::optional<Td_map_item> lb) { ptr()->e5 = lb; }
inline void set_lb(boost::optional<Td_map_item> lb) { }
/*! Set left top neighbour. */
inline void set_lt(boost::optional<Td_map_item> lt) { ptr()->e6 = lt; }
inline void set_lt(boost::optional<Td_map_item> lt) { }
/*! Set right bottom neighbour. */
inline void set_rb(boost::optional<Td_map_item> rb) { ptr()->e7 = rb; }
inline void set_rb(boost::optional<Td_map_item> rb) { }
/*! Set right top neighbour. */
inline void set_rt(boost::optional<Td_map_item> rt) { ptr()->e8 = rt; }
inline void set_rt(boost::optional<Td_map_item> rt) { }
public:
/// \name Constructors.
//@{
///*! Default constructor. */
//Td_inactive_vertex()
//{
// //define the initial trapezoid: left, right, btm, top are at infinity.
// // its type is TD_TRAPEZOID ,it is on all boundaries, and has no neighbours
// PTR = new Trpz_parameter_space
// (Traits::vtx_at_left_infinity(),
// Traits::vtx_at_right_infinity(),
// Traits::he_at_bottom_infinity(),
// Traits::he_at_top_infinity(),
// CGAL_TD_TRAPEZOID | CGAL_TD_ON_ALL_BOUNDARIES ,
// 0, 0, 0, 0);
// m_dag_node = 0;
//}
/*! Constructor given Vertex & Halfedge handles. */
Td_inactive_vertex (Vertex_const_handle v_before_rem,
boost::optional<Td_map_item> lb = boost::none, boost::optional<Td_map_item> lt = boost::none,
boost::optional<Td_map_item> rb = boost::none, boost::optional<Td_map_item> rt = boost::none,
Dag_node* node = 0)
//Vertex_const_handle l, Vertex_const_handle r,
// Halfedge_const_handle b, Halfedge_const_handle t,
// Type tp = TD_TRAPEZOID,
// unsigned char boundness_flag = CGAL_TD_INTERIOR,
// Self* lb = 0, Self* lt = 0,
// Self* rb = 0, Self* rt = 0,
// Dag_node* node = 0)
Td_inactive_vertex (Vertex_const_handle v_before_rem, Dag_node* node = NULL)
{
//build the type flag
unsigned char type_flag = 0;
type_flag |= CGAL_TD_VERTEX;
PTR = new Trpz_parameter_space
(v_before_rem->point(),
Traits::empty_vtx_handle(),
Traits::empty_he_handle(),
Traits::empty_he_handle(),
type_flag | CGAL_TD_INTERIOR, lb, lt, rb, rt);
PTR = new Data(v_before_rem->point());
m_dag_node = node;
}
/*! Copy constructor. */
Td_inactive_vertex (const Self& tr) : Handle(tr)
{
{
m_dag_node = tr.m_dag_node;
}
}
//@}
@ -312,20 +223,20 @@ public:
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
CGAL_TD_INLINE Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
CGAL_TD_INLINE bool operator== (const Self& t2) const
inline bool operator== (const Self& t2) const
{
return CGAL::identical(*this,t2);
return CGAL::identical(*this,t2);
}
/*! Operator!=. */
CGAL_TD_INLINE bool operator!= (const Self& t2) const
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
@ -336,243 +247,38 @@ public:
/// \name Access methods.
//@{
CGAL_TD_INLINE Self& self()
{
return *this;
}
inline Self& self()
{
return *this;
}
CGAL_TD_INLINE const Self& self() const
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
CGAL_TD_INLINE unsigned long id() const
{
return (unsigned long) PTR;
}
///*! Access trapezoid left. */
//CGAL_TD_INLINE Vertex_const_handle left_unsafe() const
// {
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e0)) != NULL);
// return boost::get<Vertex_const_handle>(ptr()->e0);
// }
///*! Access trapezoid left.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Vertex_const_handle left() const
// {
// CGAL_precondition(is_active());
// if (is_on_left_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary())
// {
// return Traits::vtx_at_left_infinity();
// }
// //else
// return left_unsafe();
// }
///*! Access trapezoid right. */
//CGAL_TD_INLINE Vertex_const_handle right_unsafe() const
// {
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Vertex_const_handle>(&(ptr()->e1)) != NULL);
// return boost::get<Vertex_const_handle>(ptr()->e1);
// }
///*! Access trapezoid right.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Vertex_const_handle right () const
//{
// CGAL_precondition(is_active());
// if (is_on_right_boundary() && is_on_bottom_boundary()
// && is_on_top_boundary())
// {
// return Traits::vtx_at_right_infinity();
// }
// //else
// return right_unsafe();
//}
//
///*! Access trapezoid bottom. */
//CGAL_TD_INLINE Halfedge_const_handle bottom_unsafe () const
//{
// CGAL_precondition(is_active());
// CGAL_assertion(boost::get<Halfedge_const_handle>(&(ptr()->e2)) != NULL);
// return boost::get<Halfedge_const_handle>(ptr()->e2);
// }
//
///*! Access trapezoid bottom.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Halfedge_const_handle bottom () const
// {
// CGAL_precondition(is_active());
// return !is_on_bottom_boundary() ?
// bottom_unsafe() : Traits::he_at_bottom_infinity();
// }
///*! Access trapezoid top. */
//CGAL_TD_INLINE Halfedge_const_handle top_unsafe () const
// {
// CGAL_precondition(is_active());
// return ptr()->e3;
// }
//
///*! Access trapezoid top.
//* filters out the infinite case which returns predefined dummy values
//*/
//CGAL_TD_INLINE Halfedge_const_handle top () const
// {
// CGAL_precondition(is_active());
// return !is_on_top_boundary() ?
// top_unsafe() : Traits::he_at_top_infinity();
// }
inline unsigned long id() const
{
return (unsigned long) PTR;
}
inline Point& point() const
{
return ptr()->e0;
//CGAL_assertion(boost::get<Point>( &(ptr()->e0)) != NULL);
//return boost::get<Point>( ptr()->e0 );
return ptr()->p;
}
//CGAL_TD_INLINE std::pair<X_monotone_curve_2*,Arr_curve_end> curve_end_pair_for_boundary_rem_vtx() const
// {
// CGAL_precondition(!is_active());
// CGAL_precondition(type() == TD_VERTEX);
// CGAL_precondition(is_on_boundaries());
// CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != NULL);
// CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != NULL);
// X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
// CGAL_assertion(cv_ptr != NULL);
//
// Arr_curve_end ce =
// (boost::get<unsigned char>(ptr()->e1) == CGAL_TD_CV_MIN_END) ?
// ARR_MIN_END : ARR_MAX_END;
//
// return std::make_pair(cv_ptr, ce);
//}
//CGAL_TD_INLINE Curve_end curve_end_for_boundary_rem_vtx() const
//{
// CGAL_precondition(!is_active());
// CGAL_precondition(type() == TD_VERTEX);
// CGAL_precondition(is_on_boundaries());
// CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != NULL);
// CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != NULL);
// X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
// CGAL_assertion(cv_ptr != NULL);
//
// Arr_curve_end ce =
// (boost::get<unsigned char>(ptr()->e1) == CGAL_TD_CV_MIN_END) ?
// ARR_MIN_END : ARR_MAX_END;
//
// return Curve_end(*cv_ptr, ce);
//}
//CGAL_TD_INLINE Curve_end curve_end_for_rem_vtx() const
//{
// CGAL_precondition(!is_active());
// CGAL_precondition(type() == TD_VERTEX);
// CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != NULL);
// CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != NULL);
// X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
// CGAL_assertion(cv_ptr != NULL);
//
// Arr_curve_end ce =
// (boost::get<unsigned char>(ptr()->e1) == CGAL_TD_CV_MIN_END) ?
// ARR_MIN_END : ARR_MAX_END;
//
// return Curve_end(*cv_ptr, ce);
//}
//CGAL_TD_INLINE X_monotone_curve_2& curve_for_rem_he() const
//{
// CGAL_precondition(!is_active() && type() == TD_EDGE);
//
// CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != NULL);
// X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
// CGAL_assertion(cv_ptr != NULL);
// return *cv_ptr;
//}
///*! Access trapezoid type. */
//CGAL_TD_INLINE Type type() const
//{
// switch(ptr()->e4 & CGAL_TD_TYPE_MASK)
// {
// case CGAL_TD_TRAPEZOID:
// return TD_TRAPEZOID;
// case CGAL_TD_EDGE:
// return TD_EDGE;
// case CGAL_TD_VERTEX:
// return TD_VERTEX;
// default:
// CGAL_assertion(false);
// return TD_TRAPEZOID;
// }
// }
///*! Access trapezoid type flag. */
//CGAL_TD_INLINE unsigned char type_flag() const
// {
// return (ptr()->e4 & CGAL_TD_TYPE_MASK);
// }
//
///*! Access on boundaries flag. */
//CGAL_TD_INLINE unsigned char on_boundaries_flag() const
//{
// return (ptr()->e4 & CGAL_TD_ON_ALL_BOUNDARIES);
//}
//
///*! Access is on left boundary. */
//CGAL_TD_INLINE bool is_on_left_boundary() const
// {
// return (ptr()->e4 & CGAL_TD_ON_LEFT_BOUNDARY) != 0;
// }
///*! Access is on right boundary. */
//CGAL_TD_INLINE bool is_on_right_boundary() const
//{
// return (ptr()->e4 & CGAL_TD_ON_RIGHT_BOUNDARY) != 0;
// }
///*! Access is on bottom boundary. */
//CGAL_TD_INLINE bool is_on_bottom_boundary() const
//{
// return (ptr()->e4 & CGAL_TD_ON_BOTTOM_BOUNDARY) != 0;
// }
///*! Access is on top boundary. */
//CGAL_TD_INLINE bool is_on_top_boundary() const
//{
// return (ptr()->e4 & CGAL_TD_ON_TOP_BOUNDARY) != 0;
//}
//
///*! Access is on at least one boundary. */
//CGAL_TD_INLINE bool is_on_boundaries() const
//{
// return (ptr()->e4 & CGAL_TD_ON_ALL_BOUNDARIES) != 0;
//}
/*! Access left bottom neighbour. */
boost::optional<Td_map_item> lb() const { return ptr()->e5; }
boost::optional<Td_map_item> lb() const { return boost::none; }
/*! Access left top neighbour. */
boost::optional<Td_map_item> lt() const { return ptr()->e6; }
boost::optional<Td_map_item> lt() const { return boost::none; }
/*! Access right bottom neighbour. */
boost::optional<Td_map_item> rb() const { return ptr()->e7; }
boost::optional<Td_map_item> rb() const { return boost::none; }
/*! Access right top neighbour. */
boost::optional<Td_map_item> rt() const { return ptr()->e8; }
boost::optional<Td_map_item> rt() const { return boost::none; }
/*! Access DAG node. */
Dag_node* dag_node() const {return m_dag_node;}

View File

@ -1128,6 +1128,8 @@ public:
CGAL_precondition( is_active(item) );
CGAL_precondition( is_td_trapezoid(item) );
Td_active_trapezoid& tr (boost::get<Td_active_trapezoid>(item));
bool on_all_bndries = tr.is_on_left_boundary() && tr.is_on_right_boundary() && tr.is_on_bottom_boundary() && tr.is_on_top_boundary(); //MICHAL: remove this line
return
( tr.is_on_left_boundary() ||
(compare_curve_end_xy_2_object()
@ -1178,6 +1180,8 @@ public:
(inlcude all boundaries) */
bool is_in_closure (const Td_active_trapezoid& tr, const Curve_end& ce ) const
{
bool on_all_boundaries = tr.is_on_left_boundary() && tr.is_on_right_boundary() && tr.is_on_bottom_boundary() && tr.is_on_top_boundary(); //MICHAL: remove this line
// test left and right sides
if ((tr.is_on_left_boundary() ||
(compare_curve_end_xy_2_object()

View File

@ -21,6 +21,7 @@
#ifndef CGAL_TRAPEZOIDAL_DECOMPOSITION_2_H
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_H
#define CGAL_NO_TRAPEZOIDAL_DECOMPOSITION_2_OPTIMIZATION //MICHAL: need to removed this
#include <CGAL/Arr_tags.h>
@ -541,13 +542,13 @@ public:
{
Td_active_fictitious_vertex& v (boost::get<Td_active_fictitious_vertex>(*cand));
go_right = (traits->compare_curve_end_xy_2_object()
(v.left()->curve_end(),m_fixed) == SMALLER );
(v.vertex()->curve_end(),m_fixed) == SMALLER );
}
else
{
Td_active_vertex& v (boost::get<Td_active_vertex>(*cand));
go_right = (traits->compare_curve_end_xy_2_object()
(v.left()->curve_end(),m_fixed) == SMALLER );
(v.vertex()->curve_end(),m_fixed) == SMALLER );
}
}
else
@ -2403,7 +2404,7 @@ private:
if (traits->is_td_trapezoid(*item))
res = traits->is_inside(*item,ce);
}
if (locate_opt_swap(item) && traits->is_active(*item) )
if (!res && locate_opt_swap(item) && traits->is_active(*item) )
{
if (traits->is_td_vertex(*item))
{

View File

@ -53,7 +53,7 @@ Trapezoidal_decomposition_2<Td_traits>
Dag_node left_node, right_node;
if (traits->is_trapezoid(curr_item))
if (traits->is_td_trapezoid(curr_item))
{
Td_active_trapezoid& tr (boost::get<Td_active_trapezoid>(curr_item));
@ -248,13 +248,13 @@ void Trapezoidal_decomposition_2<Td_traits>
if (traits->is_fictitious_vertex(vtx_node.get_data()))
{
Td_active_fictitious_vertex& v(boost::get<Td_active_fictitious_vertex>(vtx_node.get_data()));
vtx_node.set_data(Td_inactive_fictitious_vertex(v.left()));
vtx_node.set_data(Td_inactive_fictitious_vertex(v.vertex()));
boost::apply_visitor(set_dag_node_visitor((Dag_node*)&vtx_node),vtx_node.get_data());
}
else
{
Td_active_vertex& v(boost::get<Td_active_vertex>(vtx_node.get_data()));
vtx_node.set_data(Td_inactive_vertex(v.left()));
vtx_node.set_data(Td_inactive_vertex(v.vertex()));
boost::apply_visitor(set_dag_node_visitor((Dag_node*)&vtx_node),vtx_node.get_data());
}
}
@ -484,7 +484,7 @@ void Trapezoidal_decomposition_2<Td_traits>
Td_active_vertex& v (boost::get<Td_active_vertex>(vtx_item));
Curve_end ce( v.left()->curve_end() );
Curve_end ce( v.vertex()->curve_end() );
Around_point_circulator circ(traits,ce,he_top_right ? v.rt() : v.lb());
if (circ.operator->())
@ -550,7 +550,7 @@ void Trapezoidal_decomposition_2<Td_traits>
Td_active_vertex& v (boost::get<Td_active_vertex>(vtx_item));
Curve_end ce( v.left()->curve_end() );
Curve_end ce( v.vertex()->curve_end() );
Around_point_circulator circ(traits, ce, he_top_right ? sep.rt() : sep.lb());
if (circ.operator->())
@ -2324,8 +2324,7 @@ Trapezoidal_decomposition_2<Td_traits>
#else
//location of the left endpoint of the edge we're inserting
boost::optional<Td_map_item>& locate1_res (locate(ce1,lt1));
item1 = (locate1_res) ? *locate1_res : boost::none;
item1 = locate(ce1,lt1);
#endif
@ -2354,8 +2353,7 @@ Trapezoidal_decomposition_2<Td_traits>
#else
// TODO(oren): locating the second endpoint. this is not necessary,
// and time consuming.
boost::optional<Td_map_item>& locate2_res(locate(ce2,lt2));
item2 = (locate2_res) ? *locate2_res : boost::none;
item2 = locate(ce2,lt2);
#endif

View File

@ -21,9 +21,9 @@
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_MISC_H
#include <CGAL/Handle.h>
#include <CGAL/Arr_point_location/Td_ninetuple.h>
#include <CGAL/Arr_point_location/Td_seventuple.h>
#include <CGAL/Arr_point_location/Td_fivetuple.h>
//#include <CGAL/Arr_point_location/Td_ninetuple.h>
//#include <CGAL/Arr_point_location/Td_seventuple.h>
//#include <CGAL/Arr_point_location/Td_fivetuple.h>
#ifndef CGAL_TD_DAG_H
#include <CGAL/Arr_point_location/Td_dag_node.h>