mirror of https://github.com/CGAL/cgal
Fix compilation errors
This commit is contained in:
parent
a2fc6e1830
commit
2b7bd7c4b8
|
|
@ -53,7 +53,19 @@ public:
|
|||
typedef typename internal::vector<Node>::iterator Self_iterator;
|
||||
typedef typename Traits::Point_2 Point_2;
|
||||
|
||||
using internal::vector< Rotation_tree_node_2<Traits_> >::push_back;
|
||||
using internal::vector< Rotation_tree_node_2<Traits_> >::push_back;
|
||||
|
||||
class Less {
|
||||
typename Traits::Less_xy_2 less;
|
||||
typedef typename Traits::Point_2 Point;
|
||||
public:
|
||||
Less(typename Traits::Less_xy_2 less) : less(less) {}
|
||||
|
||||
template <typename Point_like>
|
||||
bool operator()(const Point_like& p1, const Point_like& p2) {
|
||||
return less(Point(p1), Point(p2));
|
||||
}
|
||||
};
|
||||
|
||||
// constructor
|
||||
template<class ForwardIterator>
|
||||
|
|
@ -62,8 +74,8 @@ public:
|
|||
for (ForwardIterator it = first; it != beyond; it++)
|
||||
push_back(*it);
|
||||
|
||||
std::sort(this->begin(), this->end(),
|
||||
boost::bind(Traits().less_xy_2_object(), _2, _1));
|
||||
Less less (Traits().less_xy_2_object());
|
||||
std::sort(this->begin(), this->end(), less);
|
||||
std::unique(this->begin(), this->end());
|
||||
|
||||
// front() is the point with the largest x coordinate
|
||||
|
|
@ -166,3 +178,8 @@ private:
|
|||
#include <CGAL/Partition_2/Rotation_tree_2_impl.h>
|
||||
|
||||
#endif // CGAL_ROTATION_TREE_H
|
||||
|
||||
// For the Emacs editor:
|
||||
// Local Variables:
|
||||
// c-basic-offset: 3
|
||||
// End:
|
||||
|
|
|
|||
|
|
@ -57,9 +57,11 @@ private:
|
|||
Circulator _p0, _p1, _p2;
|
||||
};
|
||||
|
||||
template <class Compare_x_2>
|
||||
template <class Traits>
|
||||
class Indirect_compare_x_2
|
||||
{
|
||||
typedef typename Traits::Compare_x_2 Compare_x_2;
|
||||
typedef typename Traits::Point_2 Point;
|
||||
public:
|
||||
Indirect_compare_x_2(const Compare_x_2& compare_x_2)
|
||||
: _compare_x_2(compare_x_2)
|
||||
|
|
@ -68,16 +70,18 @@ public:
|
|||
template <class Point_2_ptr>
|
||||
Comparison_result operator()(Point_2_ptr p1, Point_2_ptr p2)
|
||||
{
|
||||
return _compare_x_2(*p1, *p2);
|
||||
return _compare_x_2(Point(*p1), Point(*p2));
|
||||
}
|
||||
|
||||
private:
|
||||
Compare_x_2 _compare_x_2;
|
||||
};
|
||||
|
||||
template <class Compare_y_2>
|
||||
template <class Traits>
|
||||
class Indirect_compare_y_2
|
||||
{
|
||||
typedef typename Traits::Compare_y_2 Compare_y_2;
|
||||
typedef typename Traits::Point_2 Point;
|
||||
public:
|
||||
Indirect_compare_y_2(const Compare_y_2& compare_y_2)
|
||||
: _compare_y_2(compare_y_2)
|
||||
|
|
@ -86,16 +90,18 @@ public:
|
|||
template <class Point_2_ptr>
|
||||
Comparison_result operator()(Point_2_ptr p1, Point_2_ptr p2)
|
||||
{
|
||||
return _compare_y_2(*p1, *p2);
|
||||
return _compare_y_2(Point(*p1), Point(*p2));
|
||||
}
|
||||
|
||||
private:
|
||||
Compare_y_2 _compare_y_2;
|
||||
};
|
||||
|
||||
template <class Orientation_2>
|
||||
template <class Traits>
|
||||
class Indirect_orientation_2
|
||||
{
|
||||
typedef typename Traits::Orientation_2 Orientation_2;
|
||||
typedef typename Traits::Point_2 Point;
|
||||
public:
|
||||
Indirect_orientation_2(const Orientation_2& orientation_2)
|
||||
: _orientation_2(orientation_2)
|
||||
|
|
@ -104,7 +110,7 @@ public:
|
|||
template <class Point_2_ptr>
|
||||
Orientation operator()(Point_2_ptr p1, Point_2_ptr p2, Point_2_ptr p3)
|
||||
{
|
||||
return _orientation_2(*p1, *p2, *p3);
|
||||
return _orientation_2(Point(*p1), Point(*p2), Point(*p3));
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -139,9 +145,9 @@ public:
|
|||
typedef Indirect_segment<Circulator> Segment_2;
|
||||
typedef Indirect_triangle<Circulator> Triangle_2;
|
||||
|
||||
typedef Indirect_orientation_2<typename Traits::Orientation_2> Orientation_2;
|
||||
typedef Indirect_compare_x_2<typename Traits::Compare_x_2> Compare_x_2;
|
||||
typedef Indirect_compare_y_2<typename Traits::Compare_y_2> Compare_y_2;
|
||||
typedef Indirect_orientation_2<Traits> Orientation_2;
|
||||
typedef Indirect_compare_x_2<Traits> Compare_x_2;
|
||||
typedef Indirect_compare_y_2<Traits> Compare_y_2;
|
||||
typedef Construct_indirect_segment_2<Circulator> Construct_segment_2;
|
||||
typedef Construct_circulator_2<Circulator> Construct_point_2;
|
||||
|
||||
|
|
@ -181,3 +187,8 @@ private:
|
|||
}
|
||||
|
||||
#endif // CGAL_TRIANGULATION_INDIRECT_TRAITS_2_H
|
||||
|
||||
// For the Emacs editor
|
||||
// Local Variables:
|
||||
// c-basic-offset: 3
|
||||
// End:
|
||||
|
|
|
|||
|
|
@ -227,20 +227,21 @@ Vertex_visibility_graph_2<Traits>::left_turn_to_parent(
|
|||
Tree_iterator q,
|
||||
Tree& tree)
|
||||
{
|
||||
typedef typename Traits::Point_2 Point;
|
||||
if (tree.parent_is_p_infinity(q))
|
||||
{
|
||||
return (less_xy_2(*p, *q));
|
||||
return (less_xy_2(Point(*p), Point(*q)));
|
||||
}
|
||||
else if (orientation_2(*p, *q, *(*q).parent()) == COLLINEAR &&
|
||||
(collinear_ordered_2(*p, *q, *(*q).parent()) ||
|
||||
collinear_ordered_2(*p, *q, *(*q).parent())))
|
||||
else if (orientation_2(Point(*p), Point(*q), Point(*q->parent())) == COLLINEAR &&
|
||||
(collinear_ordered_2(Point(*p), Point(*q), Point(*q->parent())) ||
|
||||
collinear_ordered_2(Point(*p), Point(*q), Point(*q->parent()))))
|
||||
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return left_turn_2(*p, *q, *(*q).parent());
|
||||
return left_turn_2(Point(*p), Point(*q), Point(*q->parent()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,25 @@ bool is_simple_2(ForwardIterator first,
|
|||
return is_simple_polygon(first, last, traits);
|
||||
}
|
||||
|
||||
namespace internal { namespace Polygon_2 {
|
||||
|
||||
template <typename Traits>
|
||||
class Compare_vertices {
|
||||
typedef typename Traits::Less_xy_2 Less_xy_2;
|
||||
typedef typename Traits::Point_2 Point_2;
|
||||
Less_xy_2 less;
|
||||
public:
|
||||
Compare_vertices(Less_xy_2 less) : less(less) {}
|
||||
|
||||
// `Point_like` derives from `Point_2`
|
||||
template <typename Point_like>
|
||||
bool operator()(const Point_like& p1, const Point_like& p2) {
|
||||
return less(Point_2(p1), Point_2(p2));
|
||||
}
|
||||
}; // end Compare_vertices
|
||||
|
||||
} // end namespace Polygon_2
|
||||
} // end namespace internal
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
// left_vertex_2
|
||||
|
|
@ -64,7 +83,9 @@ ForwardIterator left_vertex_2(ForwardIterator first,
|
|||
const PolygonTraits&traits)
|
||||
{
|
||||
CGAL_polygon_precondition(first != last);
|
||||
return std::min_element(first, last, traits.less_xy_2_object());
|
||||
internal::Polygon_2::Compare_vertices<PolygonTraits>
|
||||
less(traits.less_xy_2_object());
|
||||
return std::min_element(first, last, less);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
|
|
@ -78,7 +99,9 @@ ForwardIterator right_vertex_2(ForwardIterator first,
|
|||
const PolygonTraits &traits)
|
||||
{
|
||||
CGAL_polygon_precondition(first != last);
|
||||
return std::max_element(first, last, traits.less_xy_2_object());
|
||||
internal::Polygon_2::Compare_vertices<PolygonTraits>
|
||||
less(traits.less_xy_2_object());
|
||||
return std::max_element(first, last, less);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
|
|
@ -423,3 +446,7 @@ Orientation orientation_2(ForwardIterator first,
|
|||
} //namespace CGAL
|
||||
|
||||
/// \endcond
|
||||
|
||||
// Local Variables:
|
||||
// c-basic-offset: 4
|
||||
// End:
|
||||
|
|
|
|||
Loading…
Reference in New Issue