本文整理汇总了C++中Traits::less_xy_2_object方法的典型用法代码示例。如果您正苦于以下问题:C++ Traits::less_xy_2_object方法的具体用法?C++ Traits::less_xy_2_object怎么用?C++ Traits::less_xy_2_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Traits
的用法示例。
在下文中一共展示了Traits::less_xy_2_object方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: res
OutputIterator
ch_bykat_with_threshold(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 std::vector< Point_2 >::iterator
PointIterator;
typedef typename Traits::Equal_2 Equal_2;
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);
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;
PointIterator Pbegin, Pend;
P.push_back(Point_2() );
std::copy(first,last,std::back_inserter(P));
P.push_back(Point_2() );
Pbegin = successor(P.begin());
Pend = predecessor(P.end());
ch_we_point(Pbegin, Pend, 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( Pbegin );
Left_turn_2 left_turn = ch_traits.left_turn_2_object();
R.push_back( l = std::partition( Pbegin, Pend,
bind_1(bind_1(left_turn, a), b) ) );
r = std::partition( l, Pend, bind_1(bind_1(left_turn,b),a) );
Less_dist less_dist = ch_traits.less_signed_distance_to_line_2_object();
for (;;)
{
if ( l != r)
{
if ( r-l > CGAL_ch_THRESHOLD )
{
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
{
std::swap( a, *--l);
std::swap( b, *++r);
if ( ch_traits.less_xy_2_object()(*l,*r) )
{
std::sort(successor(l), r,
ch_traits.less_xy_2_object() );
}
else
{
std::sort(successor(l), r,
swap_1(ch_traits.less_xy_2_object()) );
}
ch__ref_graham_andrew_scan(l, successor(r), res, ch_traits);
std::swap( a, *l);
std::swap( b, *r);
if ( L.empty() ) break;
a = b;
b = H.back(); H.pop_back();
l = L.back(); L.pop_back();
r = R.back(); R.pop_back();
}
}
else
{
*res = a; ++res;
if ( L.empty() ) break;
//.........这里部分代码省略.........