This commit is contained in:
Efi Fogel 2012-06-30 23:35:30 +00:00
parent 6aa13f3091
commit 29491b5f56
4 changed files with 72 additions and 111 deletions

View File

@ -151,7 +151,7 @@ public:
* arrangement (a vertex, halfedge, or face handle). * arrangement (a vertex, halfedge, or face handle).
* \return The nearest landmark point. * \return The nearest landmark point.
*/ */
virtual Point_2 closest_landmark (Point_2 p, Object &obj) virtual Point_2 closest_landmark (const Point_2 p, Object &obj)
{ {
CGAL_assertion(updated); CGAL_assertion(updated);
return (nn.find_nearest_neighbor(p, obj)); return (nn.find_nearest_neighbor(p, obj));

View File

@ -51,7 +51,7 @@ namespace CGAL {
* when one of the four sides is on the parameter space boundary. * when one of the four sides is on the parameter space boundary.
* Each trapezoid has at most four neighbouring trapezoids. * Each trapezoid has at most four neighbouring trapezoids.
*/ */
template <class Td_traits_> template <typename Td_traits_>
class Td_active_trapezoid : public Handle class Td_active_trapezoid : public Handle
{ {
public: public:
@ -128,8 +128,9 @@ public:
const Td_map_item& _rb, const Td_map_item& _rb,
const Td_map_item& _rt, const Td_map_item& _rt,
Dag_node* _p_node) Dag_node* _p_node)
: left_v(_left_v),right_v(_right_v),bottom_he(_bottom_he),top_he(_top_he), : left_v(_left_v), right_v(_right_v),
lb(_lb),lt(_lt),rb(_rb),rt(_rt),p_node(_p_node) bottom_he(_bottom_he), top_he(_top_he),
lb(_lb), lt(_lt), rb(_rb), rt(_rt), p_node(_p_node)
{ } { }
~Data() { } ~Data() { }
@ -150,24 +151,23 @@ public:
Data* ptr() const { return (Data*)(PTR); } Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG #ifndef CGAL_TD_DEBUG
#ifdef CGAL_PM_FRIEND_CLASS #ifdef CGAL_PM_FRIEND_CLASS
protected: protected:
#else #else
public: // workaround public: // workaround
#endif #endif
#else //CGAL_TD_DEBUG #else //CGAL_TD_DEBUG
public: public:
#endif //CGAL_TD_DEBUG #endif //CGAL_TD_DEBUG
//Dag_node* m_dag_node; //pointer to the search structure (DAG) node //Dag_node* m_dag_node; //pointer to the search structure (DAG) node
/*! Initialize the trapezoid's neighbours. */ /*! Initialize the trapezoid's neighbours. */
inline void init_neighbours(boost::optional<Td_map_item&> lb, boost::optional<Td_map_item&> lt, inline void init_neighbours(boost::optional<Td_map_item&> lb,
boost::optional<Td_map_item&> rb, boost::optional<Td_map_item&> rt) boost::optional<Td_map_item&> lt,
boost::optional<Td_map_item&> rb,
boost::optional<Td_map_item&> rt)
{ {
set_lb((lb) ? *lb : Td_map_item(0)); set_lb((lb) ? *lb : Td_map_item(0));
set_lt((lt) ? *lt : Td_map_item(0)); set_lt((lt) ? *lt : Td_map_item(0));
@ -186,26 +186,18 @@ public:
// CGAL_assertion(!p || **p == *this); // CGAL_assertion(!p || **p == *this);
// //
//#endif //#endif
} }
/*! Set the trapezoid's left (Vertex_const_handle). */ /*! Set the trapezoid's left (Vertex_const_handle). */
inline void set_left(Vertex_const_handle v) inline void set_left(Vertex_const_handle v) { ptr()->left_v = v; }
{
ptr()->left_v = v;
}
/*! Set the trapezoid's right (Vertex_const_handle). */ /*! Set the trapezoid's right (Vertex_const_handle). */
inline void set_right(Vertex_const_handle v) inline void set_right(Vertex_const_handle v) { ptr()->right_v = v; }
{
ptr()->right_v = v;
}
/*! Set the trapezoid's bottom (Halfedge_const_handle). */ /*! Set the trapezoid's bottom (Halfedge_const_handle). */
inline void set_bottom(Halfedge_const_handle he) inline void set_bottom(Halfedge_const_handle he)
{ {
if (!is_on_bottom_boundary() && if (!is_on_bottom_boundary() && (bottom()->direction() != he->direction()))
bottom()->direction() != he->direction())
{ {
ptr()->bottom_he = he->twin(); ptr()->bottom_he = he->twin();
} }
@ -218,8 +210,7 @@ public:
/*! Set the trapezoid's top (Halfedge_const_handle). */ /*! Set the trapezoid's top (Halfedge_const_handle). */
inline void set_top(Halfedge_const_handle he) inline void set_top(Halfedge_const_handle he)
{ {
if (!is_on_top_boundary() && if (!is_on_top_boundary() && (top()->direction() != he->direction()))
top()->direction() != he->direction())
{ {
ptr()->top_he = he->twin(); ptr()->top_he = he->twin();
} }
@ -252,12 +243,12 @@ public:
{ {
//define the initial trapezoid: left, right, btm, top are at infinity. //define the initial trapezoid: left, right, btm, top are at infinity.
// has no neighbours // has no neighbours
PTR = new Data PTR = new Data(Traits::empty_vtx_handle(),
(Traits::empty_vtx_handle(),
Traits::empty_vtx_handle(), Traits::empty_vtx_handle(),
Traits::empty_he_handle(), Traits::empty_he_handle(),
Traits::empty_he_handle(), Traits::empty_he_handle(),
Td_map_item(0), Td_map_item(0) , Td_map_item(0) , Td_map_item(0), NULL); Td_map_item(0), Td_map_item(0) ,
Td_map_item(0), Td_map_item(0), NULL);
//m_dag_node = 0; //m_dag_node = 0;
} }
@ -271,8 +262,9 @@ public:
boost::optional<Td_map_item&> rt = boost::none, boost::optional<Td_map_item&> rt = boost::none,
Dag_node* node = 0) Dag_node* node = 0)
{ {
PTR = new Data (l, r, b, t, (lb) ? *lb : Td_map_item(0), (lt) ? *lt : Td_map_item(0), PTR = new Data(l, r, b, t, (lb) ? *lb : Td_map_item(0),
(rb) ? *rb : Td_map_item(0), (rt) ? *rt : Td_map_item(0), node); (lt) ? *lt : Td_map_item(0), (rb) ? *rb : Td_map_item(0),
(rt) ? *rt : Td_map_item(0), node);
//m_dag_node = node; //m_dag_node = node;
} }
@ -292,20 +284,20 @@ public:
* operator= should not copy m_dag_node (or otherwise update * operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace) * Dag_node::replace)
*/ */
inline Self& operator= (const Self& t2) inline Self& operator=(const Self& t2)
{ {
Handle::operator=(t2); Handle::operator=(t2);
return *this; return *this;
} }
/*! Operator==. */ /*! Operator==. */
inline bool operator== (const Self& t2) const inline bool operator==(const Self& t2) const
{ {
return (ptr() == t2.ptr()); return (ptr() == t2.ptr());
} }
/*! Operator!=. */ /*! Operator!=. */
inline bool operator!= (const Self& t2) const inline bool operator!=(const Self& t2) const
{ {
return !(operator==(t2)); return !(operator==(t2));
} }
@ -316,83 +308,54 @@ public:
/// \name Access methods. /// \name Access methods.
//@{ //@{
inline Self& self() inline Self& self() { return *this; }
{
return *this;
}
inline const Self& self() const inline const Self& self() const { return *this; }
{
return *this;
}
/*! Access the trapezoid id (PTR). */ /*! Access the trapezoid id (PTR). */
inline unsigned long id() const inline unsigned long id() const { return (unsigned long) PTR; }
{
return (unsigned long) PTR;
}
/*! Access trapezoid left. /*! Access trapezoid left.
* filters out the infinite case which returns predefined dummy values * filters out the infinite case which returns predefined dummy values
*/ */
inline Vertex_const_handle left() const inline Vertex_const_handle left() const { return ptr()->left_v; }
{
return ptr()->left_v;
}
/*! Access trapezoid right. /*! Access trapezoid right.
* filters out the infinite case which returns predefined dummy values * filters out the infinite case which returns predefined dummy values
*/ */
inline Vertex_const_handle right () const inline Vertex_const_handle right() const { return ptr()->right_v; }
{
return ptr()->right_v;
}
/*! Access trapezoid bottom. /*! Access trapezoid bottom.
* filters out the infinite case which returns predefined dummy values * filters out the infinite case which returns predefined dummy values
*/ */
inline Halfedge_const_handle bottom () const inline Halfedge_const_handle bottom() const { return ptr()->bottom_he; }
{
return ptr()->bottom_he;
}
/*! Access trapezoid top. /*! Access trapezoid top.
* filters out the infinite case which returns predefined dummy values * filters out the infinite case which returns predefined dummy values
*/ */
inline Halfedge_const_handle top () const inline Halfedge_const_handle top() const { return ptr()->top_he; }
{
return ptr()->top_he;
}
/*! Access is on left boundary. */ /*! Access is on left boundary. */
inline bool is_on_left_boundary() const inline bool is_on_left_boundary() const
{ { return (left() == Traits::empty_vtx_handle()); }
return (left() == Traits::empty_vtx_handle());
}
/*! Access is on right boundary. */ /*! Access is on right boundary. */
inline bool is_on_right_boundary() const inline bool is_on_right_boundary() const
{ { return (right() == Traits::empty_vtx_handle()); }
return (right() == Traits::empty_vtx_handle());
}
/*! Access is on bottom boundary. */ /*! Access is on bottom boundary. */
inline bool is_on_bottom_boundary() const inline bool is_on_bottom_boundary() const
{ { return (bottom() == Traits::empty_he_handle()); }
return (bottom() == Traits::empty_he_handle());
}
/*! Access is on top boundary. */ /*! Access is on top boundary. */
inline bool is_on_top_boundary() const inline bool is_on_top_boundary() const
{ { return (top() == Traits::empty_he_handle()); }
return (top() == Traits::empty_he_handle());
}
/*! Access is on at least one boundary. */ /*! Access is on at least one boundary. */
inline bool is_on_boundaries() const inline bool is_on_boundaries() const
{ {
return (is_on_left_boundary() || is_on_right_boundary() || return (is_on_left_boundary() || is_on_right_boundary() ||
is_on_bottom_boundary() || is_on_top_boundary() ); is_on_bottom_boundary() || is_on_top_boundary());
} }
/*! Access left bottom neighbour. */ /*! Access left bottom neighbour. */
@ -459,8 +422,6 @@ public:
} }
CGAL_assertion(is_on_right_boundary() == right.is_on_right_boundary()); CGAL_assertion(is_on_right_boundary() == right.is_on_right_boundary());
} }
}; };
} //namespace CGAL } //namespace CGAL

View File

@ -51,7 +51,7 @@
#define CGAL_TD_DEFAULT_SIZE_THRESHOLD 12 #define CGAL_TD_DEFAULT_SIZE_THRESHOLD 12
#ifndef _MSC_VER #ifndef _MSC_VER
#if !defined __GNUC__ || __GNUC__>2 || __GNUC__==2 && __GNUC_MINOR__>=95 #if !defined __GNUC__ || __GNUC__> 3 || ((__GNUC__== 3) && (__GNUC_MINOR__> 4))
#define CGAL_PM_FRIEND_CLASS #define CGAL_PM_FRIEND_CLASS
#endif #endif
#endif #endif

View File

@ -1135,8 +1135,8 @@ public:
} }
Comparison_result comp_x_on_bnd(const Point_2&, Comparison_result comp_x_on_bnd(const Point_2&,
const X_monotone_curve_2& xcv, const X_monotone_curve_2& /* xcv */,
Arr_curve_end ce, Arr_curve_end /* ce */,
Arr_use_dummy_tag) const Arr_use_dummy_tag) const
{ {
CGAL_error(); CGAL_error();
@ -1153,10 +1153,10 @@ public:
return m_base->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2); return m_base->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2);
} }
Comparison_result comp_x_on_bnd(const X_monotone_curve_2& Comparison_result comp_x_on_bnd(const X_monotone_curve_2& /* xcv1 */,
xcv1, Arr_curve_end ce1, Arr_curve_end /* ce1 */,
const X_monotone_curve_2& xcv2, const X_monotone_curve_2& /* xcv2 */,
Arr_curve_end ce2, Arr_curve_end /* ce2 */,
Arr_use_dummy_tag) const Arr_use_dummy_tag) const
{ {
CGAL_error(); CGAL_error();