LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
test.cpp
Go to the documentation of this file.
1 /*
2  Verifies correctness of the bounding box
3 
4  TODO: Add OK/FAIL messages to verify correctness automatically
5 */
6 
7 
8 #include <iostream>
9 #include "BoundingBox.h"
10 #include <stdio.h>
11 
12 int main(int argc, char ** argv)
13 {
14  int x = 0;
15  RStarBoundingBox<1> b[20];
16 
17  // line tests
18  b[x++].edges[0] = std::make_pair(0, 2);
19  b[x++].edges[0] = std::make_pair(1, 3);
20  b[x++].edges[0] = std::make_pair(0, 4);
21  b[x++].edges[0] = std::make_pair(1, 3);
22  b[x++].edges[0] = std::make_pair(0, 1);
23  b[x++].edges[0] = std::make_pair(1, 3);
24  b[x++].edges[0] = std::make_pair(0, 1);
25  b[x++].edges[0] = std::make_pair(2, 3);
26  b[x++].edges[0] = std::make_pair(0, 1);
27  b[x++].edges[0] = std::make_pair(0, 1);
28 
29  // point tests
30  b[x++].edges[0] = std::make_pair(0, 0);
31  b[x++].edges[0] = std::make_pair(1, 3);
32  b[x++].edges[0] = std::make_pair(1, 1);
33  b[x++].edges[0] = std::make_pair(1, 3);
34  b[x++].edges[0] = std::make_pair(2, 2);
35  b[x++].edges[0] = std::make_pair(1, 3);
36  b[x++].edges[0] = std::make_pair(3, 3);
37  b[x++].edges[0] = std::make_pair(1, 3);
38  b[x++].edges[0] = std::make_pair(4, 4);
39  b[x++].edges[0] = std::make_pair(1, 3);
40 
41  for (int i = 0; i < x/2; i++)
42  {
43  int i1 = i*2, i2 = i*2+1;
44 
45  printf("%s %s %s\n", b[i1].ToString().c_str(), b[i1].encloses(b[i2]) ? "encloses" : "does not enclose", b[i2].ToString().c_str());
46 
47  printf("%s %s %s\n", b[i2].ToString().c_str(), b[i2].encloses(b[i1]) ? "encloses" : "does not enclose", b[i1].ToString().c_str());
48 
49  printf("%s %s %s (%f)\n", b[i1].ToString().c_str(), b[i1].overlaps(b[i2]) ? "overlaps" : "does not overlap", b[i2].ToString().c_str(), b[i1].overlap(b[i2]));
50 
51  printf("%s %s %s (%f)\n\n", b[i2].ToString().c_str(), b[i2].overlaps(b[i1]) ? "overlaps" : "does not overlap", b[i1].ToString().c_str(), b[i2].overlap(b[i1]));
52  }
53 
54 
55 }
Float_t x
Definition: compare.C:6
printf("%d Experimental points found\n", nlines)
int main(int argc, char **argv)
Definition: test.cpp:12
std::pair< double, double > edges[dimensions]