Beispiel #1
0
int main( int argc, char **argv )
{
  int num_sample=100000;
  int t0=clock();
  InitRandom(100000);
  int t1=clock();

  ///Initialization performance
  printf("** Time elapsed for initialization of %d sample is %d\n \n",num_sample,t1-t0);
  Hash2D.Set(Allocated.begin(),Allocated.end());

  ///Box Query performance
  t0=clock();
  MyScalarType avg_test=TestBox(num_sample);
  t1=clock();
  printf("** Time elapsed for %d BOX queries is %d\n, average found %5.5f \n \n",num_sample,t1-t0,avg_test);
  

  ///Intersecting segment performance
  t0=clock();
  MyScalarType avg_int=TestIntersection(num_sample);
  t1=clock();
  printf("** Time elapsed for %d INTERSECTION queries is %d\n, average found %5.5f \n \n",num_sample,t1-t0,avg_int);
	
  ///closest test
  t0=clock();
  MyScalarType avg_clos=TestClosest(num_sample);
  t1=clock();
  printf("** Time elapsed for %d CLOSEST queries is %d\n, average found %5.5f \n \n",num_sample,t1-t0,avg_clos);
	
 ///reinitialize structure
  MyMark.mark=0;
  Hash2D.Clear();
  int n_test=1000;
  InitRandom(n_test,100,0.1);
  Hash2D.Set(Allocated.begin(),Allocated.end());

  int tested_int=TestCorrectIntersect(n_test);
  printf("** Correct Intersect on %d test are %d \n",n_test,tested_int);
	
  int tested_clos=TestCorrectClosest(n_test);
  printf("** Correct Closest on %d test are %d \n",n_test,tested_clos);

  return 0;
}
Beispiel #2
0
int main( int argc, char **argv )
{
  (void) argc;
  (void) argv;
  int num_sample=20000;
  int t0=clock();

  printf("** Random Initialization ** \n");
  fflush(stdout);
  InitRandom(num_sample,100,0.3);
  int t1=clock();

  ///Initialization performance
  printf("** Time elapsed for initialization of %d sample is %d\n \n",num_sample,t1-t0);
  Grid2D.Set(AllocatedSeg.begin(),AllocatedSeg.end());
  fflush(stdout);

  //Box Query correctness
  TestBox(num_sample);
  TestClosest(num_sample);
  TestRay(num_sample);

  return 0;
}