raygrid.h
Go to the documentation of this file.
1 // This is NOT a real header file but may be includeded in tests as code
2 
3 ray_pair_vector_t make_raypairs(double width=100, double height=100,
4  double pitch_mag = 3, double angle=60.0*M_PI/180.0);
5 ray_pair_vector_t make_raypairs(double width, double height, double pitch_mag,
6  double angle)
7 {
8  ray_pair_vector_t raypairs;
9 
10  // corners
11  const Vector ll(0,0,0), lr(0,0,width), ul(0,height,0), ur(0,height,width);
12 
13  // wire directions
14  const Vector eckx(1,0,0);
15  const Vector why(0,1,0);
16  const Vector zee(0,0,1);
17 
18  // /-wires
19  const Vector du(0, cos(angle), sin(angle));
20  const Vector pu = eckx.cross(du).norm();
21  Vector pjumpu = 0.5*pitch_mag*pu;
22  double mjumpu2 = pjumpu.dot(pjumpu);
23  const Ray rayu0(ul + why*mjumpu2/(why.dot(pjumpu)),
24  ul + zee*mjumpu2/(zee.dot(pjumpu)));
25  pjumpu = 1.5*pitch_mag*pu;
26  mjumpu2 = pjumpu.dot(pjumpu);
27  const Ray rayu1(ul + why*mjumpu2/(why.dot(pjumpu)),
28  ul + zee*mjumpu2/(zee.dot(pjumpu)));
29 
30  // \-wires
31  const Vector dv(0, cos(angle), -sin(angle));
32  const Vector pv = eckx.cross(dv).norm();
33  Vector pjumpv = 0.5*pitch_mag*pv;
34  double mjumpv2 = pjumpv.dot(pjumpv);
35  const Ray rayv0(ll + why*mjumpv2/(why.dot(pjumpv)),
36  ll + zee*mjumpv2/(zee.dot(pjumpv)));
37  pjumpv = 1.5*pitch_mag*pv;
38  mjumpv2 = pjumpv.dot(pjumpv);
39  const Ray rayv1(ll + why*mjumpv2/(why.dot(pjumpv)),
40  ll + zee*mjumpv2/(zee.dot(pjumpv)));
41 
42 
43 
44  // |-wires
45  const Vector dw = why;
46  const Vector pw = zee;
47  const Vector pjumpw = pitch_mag*pw;
48  const Ray rayw0(ll + 0.0*pjumpw, ul + 0.0*pjumpw);
49  const Ray rayw1(ll + 1.0*pjumpw, ul + 1.0*pjumpw);
50 
51 
52 
53  // horizontal bounds
54  raypairs.push_back(make_pair( Ray(ll, lr), Ray(ul, ur) ));
55 
56  // vertical bounds
57  raypairs.push_back(make_pair( Ray(ll, ul), Ray(lr, ur) ));
58 
59  // pitch1
60  raypairs.push_back(make_pair( rayu0, rayu1) );
61 
62  // pitch2
63  raypairs.push_back(make_pair( rayv0, rayv1) );
64 
65  // pitch3
66  raypairs.push_back(make_pair( rayw0, rayw1) );
67  return raypairs;
68 }
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition: Point.h:21
const double width
const double height
std::vector< ray_pair_t > ray_pair_vector_t
Definition: Point.h:27
std::vector< float > Vector
ray_pair_vector_t make_raypairs(double width=100, double height=100, double pitch_mag=3, double angle=60.0 *M_PI/180.0)
Definition: raygrid.h:5