mirror of https://github.com/CGAL/cgal
bug fix for convex hull Anderson variant example
The previous version did not output the last point of the convex hull to the result iterator. As a result, ch_graham_anderson.cpp did not output a correct convex hull in some cases.
This commit is contained in:
parent
8f18eb46f9
commit
05138b0802
|
|
@ -24,12 +24,13 @@ ch_graham_anderson( InputIterator first, InputIterator beyond,
|
||||||
typename std::vector< Point_2 >::iterator it =
|
typename std::vector< Point_2 >::iterator it =
|
||||||
std::min_element(V.begin(), V.end(), Less_xy_2());
|
std::min_element(V.begin(), V.end(), Less_xy_2());
|
||||||
std::sort( V.begin(), V.end(), boost::bind(Less_rotate_ccw_2(), *it, _1, _2) );
|
std::sort( V.begin(), V.end(), boost::bind(Less_rotate_ccw_2(), *it, _1, _2) );
|
||||||
if ( *(V.begin()) == *(V.rbegin()) )
|
if ( *(V.begin()) != *(V.rbegin()) )
|
||||||
{
|
{
|
||||||
*result = *(V.begin()); ++result;
|
result = CGAL::ch_graham_andrew_scan( V.begin(), V.end(), result, ch_traits);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return CGAL::ch_graham_andrew_scan( V.begin(), V.end(), result, ch_traits);
|
*result = *(V.rbegin()); ++result;
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue