kd trees demo

This commit is contained in:
Eli Packer 2003-08-06 07:37:12 +00:00
parent 647744aa7d
commit 8b3bc6d07d
3 changed files with 19 additions and 4 deletions

View File

@ -84,14 +84,14 @@ int main(int argc,char *argv[])
read_data(argv,prec,seg_list);
for(int i = 1;i < 11;++i) {
std::cout << " kd trees parameter is " << i << std::endl;
std::cout << "Input number of kd trees : " << i << std::endl;
CGAL::Timer t;
t.start();
CGAL::snap_rounding_2<Sr_traits,std::list<Segment_2>::const_iterator,
std::list<std::list<Point_2> > >
(seg_list.begin(),seg_list.end(),output_list,prec,true,false,i);
t.stop();
std::cout << "*** time : " << t.time() << "\n\n";
std::cout << "total time : " << t.time() << "\n\n";
}
delete(is_ptr);

View File

@ -505,7 +505,6 @@ void Snap_rounding_2<Rep_,OutputContainer>::
std::list<X_curve> subcurves;
// get intersection points (with endpoints)
PointList mypointlist;
@ -681,7 +680,6 @@ void snap_rounding_2(
InputIterator begin,
InputIterator end,
OutputContainer& output_container,
//std::list<std::list<typename Rep_::Point_2> >& output_container,
typename Rep_::FT pixel_size,
bool do_isr = true,
bool int_output = true,
@ -690,6 +688,7 @@ void snap_rounding_2(
std::list<Segment_data<Rep_> > seg_list;
Multiple_kd_tree<Rep_,Hot_Pixel<Rep_> *> *mul_kd_tree;
output_container.clear();
// copy segments list
while(begin != end) {
seg_list.push_back(Segment_data<Rep_>(begin->source(),

View File

@ -325,15 +325,31 @@ public:
check_kd(kd_counter,number_of_trees,seg_list,directions);
int ind = 0;
#ifdef KD_DEBUG
int number_of_actual_kd_trees = 0;
#endif
for(NT angle = 0;angle < half_pi;angle += half_pi / number_of_trees) {
if(kd_counter[ind] >= (double)number_of_segments /
(double)number_of_trees / 2.0) {
kd = create_kd_tree(angle);
kd_trees_list.push_back(kd);
#ifdef KD_DEBUG
++number_of_actual_kd_trees;
#endif
}
++ind;
}
#ifdef KD_DEBUG
std::cout << "Actual number of kd-trees created : " <<
number_of_actual_kd_trees << std::endl;
#endif
}
Point_2 small_x_point(Point_2 p1,Point_2 p2)