本文整理汇总了C++中SegmentList::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ SegmentList::erase方法的具体用法?C++ SegmentList::erase怎么用?C++ SegmentList::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SegmentList
的用法示例。
在下文中一共展示了SegmentList::erase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filter_self_intersection
static void filter_self_intersection( const GeometrySet<Dim>& input, GeometrySet<Dim>& output )
{
{
typedef std::list< CollectionElement<typename Point_d<Dim>::Type> > PointList;
PointList points;
std::copy( input.points().begin(), input.points().end(), std::back_inserter( points ) );
typename PointList::iterator it = points.begin();
while ( it != points.end() ) {
bool intersectsA = false;
for ( typename PointList::iterator it2 = points.begin(); it2 != points.end(); ++it2 ) {
if ( it == it2 ) {
continue;
}
PrimitiveHandle<Dim> pa1( &it->primitive() );
PrimitiveHandle<Dim> pa2( &it2->primitive() );
if ( CGAL::do_overlap( it->primitive().bbox(), it2->primitive().bbox() ) &&
algorithm::intersects( pa1, pa2 ) ) {
intersectsA = true;
GeometrySet<Dim> temp;
algorithm::intersection( pa1, pa2, temp );
std::copy( temp.points().begin(), temp.points().end(), std::back_inserter( points ) );
// erase it2
points.erase( it2 );
break;
}
}
if ( ! intersectsA ) {
output.addPrimitive( it->primitive() );
}
// suppress A
it = points.erase( it );
}
}
{
typedef std::list< CollectionElement<typename Segment_d<Dim>::Type> > SegmentList;
SegmentList segments;
std::copy( input.segments().begin(), input.segments().end(), std::back_inserter( segments ) );
typename SegmentList::iterator it = segments.begin();
while ( it != segments.end() ) {
bool intersectsA = false;
for ( typename SegmentList::iterator it2 = segments.begin(); it2 != segments.end(); ++it2 ) {
if ( it == it2 ) {
continue;
}
PrimitiveHandle<Dim> pa1( &it->primitive() );
PrimitiveHandle<Dim> pa2( &it2->primitive() );
if ( CGAL::do_overlap( it->primitive().bbox(), it2->primitive().bbox() ) &&
algorithm::intersects( pa1, pa2 ) ) {
intersectsA = true;
GeometrySet<Dim> temp;
algorithm::intersection( pa1, pa2, temp );
std::copy( temp.segments().begin(), temp.segments().end(), std::back_inserter( segments ) );
// erase it2
segments.erase( it2 );
break;
}
}
if ( ! intersectsA ) {
output.addPrimitive( it->primitive() );
}
// suppress A
it = segments.erase( it );
}
}
}