本文整理汇总了C++中Traits::equal_2_object方法的典型用法代码示例。如果您正苦于以下问题:C++ Traits::equal_2_object方法的具体用法?C++ Traits::equal_2_object怎么用?C++ Traits::equal_2_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Traits
的用法示例。
在下文中一共展示了Traits::equal_2_object方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: res
OutputIterator
ch_bykat(InputIterator first, InputIterator last,
OutputIterator result,
const Traits& ch_traits)
{
typedef typename Traits::Point_2 Point_2;
typedef typename Traits::Left_turn_2 Left_turn_2;
typedef typename Traits::Less_signed_distance_to_line_2 Less_dist;
typedef typename Traits::Equal_2 Equal_2;
Left_turn_2 left_turn = ch_traits.left_turn_2_object();
Less_dist less_dist = ch_traits.less_signed_distance_to_line_2_object();
Equal_2 equal_points = ch_traits.equal_2_object();
if (first == last) return result;
std::vector< Point_2 > P; // Points in subsets
std::vector< Point_2 > H; // right endpoints of subproblems
P.reserve(16);
H.reserve(16);
typedef typename std::vector< Point_2 >::iterator PointIterator;
std::vector< PointIterator > L; // start of subset range
std::vector< PointIterator > R; // end of subset range
L.reserve(16);
R.reserve(16);
PointIterator l;
PointIterator r;
Point_2 a,b,c;
std::copy(first,last,std::back_inserter(P));
ch_we_point(P.begin(), P.end(), l, r, ch_traits);
a = *l;
b = *r;
if (equal_points(a,b))
{
*result = a; ++result;
return result;
}
#if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \
|| defined(NDEBUG)
OutputIterator res(result);
#else
Tee_for_output_iterator<OutputIterator,Point_2> res(result);
#endif // no postconditions ...
H.push_back( a );
L.push_back( P.begin() );
R.push_back( l = std::partition( P.begin(), P.end(),
bind_1(bind_1(left_turn,a),b) ) );
r = std::partition( l, P.end(), bind_1(bind_1(left_turn,b),a) );
for (;;)
{
if ( l != r)
{
c = *std::min_element( l, r, bind_1(bind_1(less_dist, a), b));
H.push_back( b );
L.push_back( l );
R.push_back( l = std::partition(l, r,
bind_1(bind_1(left_turn,b),c)));
r = std::partition(l, r, bind_1(bind_1(left_turn,c),a));
b = c;
}
else
{
*res = a; ++res;
if ( L.empty() ) break;
a = b;
b = H.back(); H.pop_back();
l = L.back(); L.pop_back();
r = R.back(); R.pop_back();
}
}
CGAL_ch_postcondition( \
is_ccw_strongly_convex_2( res.output_so_far_begin(), \
res.output_so_far_end(), \
ch_traits));
CGAL_ch_expensive_postcondition( \
ch_brute_force_check_2( \
P.begin(), P.end(), \
res.output_so_far_begin(), res.output_so_far_end(), \
ch_traits));
#if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \
|| defined(NDEBUG)
return res;
#else
return res.to_output_iterator();
#endif // no postconditions ...
}