本文整理汇总了C++中ConvexHull::graham_scan方法的典型用法代码示例。如果您正苦于以下问题:C++ ConvexHull::graham_scan方法的具体用法?C++ ConvexHull::graham_scan怎么用?C++ ConvexHull::graham_scan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConvexHull
的用法示例。
在下文中一共展示了ConvexHull::graham_scan方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: graham_merge
ConvexHull graham_merge(ConvexHull a, ConvexHull b) {
ConvexHull result;
// we can avoid the find pivot step because of top_point_first
if(b.boundary[0] <= a.boundary[0])
std::swap(a, b);
result.boundary = a.boundary;
result.boundary.insert(result.boundary.end(),
b.boundary.begin(), b.boundary.end());
/** if we modified graham scan to work top to bottom as proposed in lect754.pdf we could replace the
angle sort with a simple merge sort type algorithm. furthermore, we could do the graham scan
online, avoiding a bunch of memory copies. That would probably be linear. -- njh*/
result.angle_sort();
result.graham_scan();
return result;
}