mirror of https://github.com/CGAL/cgal
restore removed code
This commit is contained in:
parent
5ea8d36129
commit
884b2cf2ab
|
|
@ -345,10 +345,37 @@ void segment_tree( RandomAccessIter1 p_begin, RandomAccessIter1 p_end,
|
|||
const T inf = box_limits< T >::inf();
|
||||
const T sup = box_limits< T >::sup();
|
||||
|
||||
#if CGAL_BOX_INTERSECTION_DEBUG
|
||||
CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, level, -1);
|
||||
Counter<int> bla( level );
|
||||
CGAL_BOX_INTERSECTION_DUMP("range: [" << lo << "," << hi << ") dim "
|
||||
<< dim << std::endl )
|
||||
CGAL_BOX_INTERSECTION_DUMP("intervals: " )
|
||||
//dump_box_numbers( i_begin, i_end, traits );
|
||||
dump_intervals( i_begin, i_end, traits, dim );
|
||||
CGAL_BOX_INTERSECTION_DUMP("points: " )
|
||||
//dump_box_numbers( p_begin, p_end, traits );
|
||||
dump_points( p_begin, p_end, traits, dim );
|
||||
#endif
|
||||
|
||||
#if CGAL_SEGMENT_TREE_CHECK_INVARIANTS
|
||||
{
|
||||
// first: each point is inside segment [lo,hi)
|
||||
for( RandomAccessIter1 it = p_begin; it != p_end; ++it ) {
|
||||
CGAL_assertion( Lo_less( hi, dim )(*it) );
|
||||
CGAL_assertion( Lo_less( lo, dim )(*it) == false );
|
||||
}
|
||||
// second: each interval intersects segment [lo,hi)
|
||||
for( RandomAccessIter2 it = i_begin; it != i_end; ++it )
|
||||
CGAL_assertion( Hi_greater(lo,dim)(*it) && Lo_less(hi,dim)(*it));
|
||||
}
|
||||
#endif
|
||||
|
||||
if( p_begin == p_end || i_begin == i_end || lo >= hi )
|
||||
return;
|
||||
|
||||
if( dim == 0 ) {
|
||||
CGAL_BOX_INTERSECTION_DUMP( "dim = 0. scanning ... " << std::endl )
|
||||
one_way_scan( p_begin, p_end, i_begin, i_end,
|
||||
callback, traits, dim, in_order );
|
||||
return;
|
||||
|
|
@ -357,6 +384,7 @@ void segment_tree( RandomAccessIter1 p_begin, RandomAccessIter1 p_end,
|
|||
if( std::distance( p_begin, p_end ) < cutoff ||
|
||||
std::distance( i_begin, i_end ) < cutoff )
|
||||
{
|
||||
CGAL_BOX_INTERSECTION_DUMP( "scanning ... " << std::endl )
|
||||
modified_two_way_scan( p_begin, p_end, i_begin, i_end,
|
||||
callback, traits, dim, in_order );
|
||||
return;
|
||||
|
|
@ -366,7 +394,8 @@ void segment_tree( RandomAccessIter1 p_begin, RandomAccessIter1 p_end,
|
|||
std::partition( i_begin, i_end, Spanning( lo, hi, dim ) );
|
||||
|
||||
if( i_begin != i_span_end ) {
|
||||
|
||||
CGAL_BOX_INTERSECTION_DUMP( "checking spanning intervals ... "
|
||||
<< std::endl )
|
||||
// make two calls for roots of segment tree at next level.
|
||||
segment_tree( p_begin, p_end, i_begin, i_span_end, inf, sup,
|
||||
callback, traits, cutoff, dim - 1, in_order );
|
||||
|
|
@ -378,6 +407,10 @@ void segment_tree( RandomAccessIter1 p_begin, RandomAccessIter1 p_end,
|
|||
RandomAccessIter1 p_mid = split_points( p_begin, p_end, traits, dim, mi );
|
||||
|
||||
if( p_mid == p_begin || p_mid == p_end ) {
|
||||
CGAL_BOX_INTERSECTION_DUMP( "unable to split points! ")
|
||||
//dump_points( p_begin, p_end, traits, dim );
|
||||
CGAL_BOX_INTERSECTION_DUMP( "performing modified two_way_san ... "
|
||||
<< std::endl )
|
||||
modified_two_way_scan( p_begin, p_end, i_span_end, i_end,
|
||||
callback, traits, dim, in_order );
|
||||
return;
|
||||
|
|
@ -387,17 +420,21 @@ void segment_tree( RandomAccessIter1 p_begin, RandomAccessIter1 p_end,
|
|||
// separate left intervals.
|
||||
// left intervals have a low point strictly less than mi
|
||||
i_mid = std::partition( i_span_end, i_end, Lo_less( mi, dim ) );
|
||||
|
||||
CGAL_BOX_INTERSECTION_DUMP("->left" << std::endl )
|
||||
segment_tree( p_begin, p_mid, i_span_end, i_mid, lo, mi,
|
||||
callback, traits, cutoff, dim, in_order );
|
||||
// separate right intervals.
|
||||
// right intervals have a high point strictly higher than mi
|
||||
i_mid = std::partition( i_span_end, i_end, Hi_greater( mi, dim ) );
|
||||
|
||||
CGAL_BOX_INTERSECTION_DUMP("->right"<< std::endl )
|
||||
segment_tree( p_mid, p_end, i_span_end, i_mid, mi, hi,
|
||||
callback, traits, cutoff, dim, in_order );
|
||||
}
|
||||
|
||||
#if CGAL_BOX_INTERSECTION_DEBUG
|
||||
#undef CGAL_BOX_INTERSECTION_DUMP
|
||||
#endif
|
||||
#undef CGAL_BOX_INTERSECTION_DEBUG
|
||||
|
||||
} // end namespace Box_intersection_d
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue