9 const double pi=2*acos(0);
11 bU.SetMagPhi(pitch,phi1);
15 uv=U*V, w0=(1-uv*uv)*pitch;
16 printf(
"Hex Grid base: U(%.3f,%3f), V(%.3f,%3f) U*V=%.3f\n",U.X(),V.Y(),U.X(),V.Y(),uv);
18 TVector2 snap(TVector2 &P,
int &ku,
int &kv){
21 double u=(a-b*uv)/w0, v=(b-a*uv)/w0;
22 double iu=floor(u), iv=floor(v);
27 TVector2 Psnap=TVector2(99999,99999);
31 TVector2 Q=ju*bU + jv*bV;
32 double dist2=(Q-P).Mod2();
34 if(maxD2<dist2)
continue;
51 const double pi=2*acos(0);
55 gStyle->SetOptStat(0);
57 TRandom3 *rnd=
new TRandom3;
58 c=
new TCanvas(
"bb",
"bb",600,600);
59 h=
new TH2F(
"aa",
"aa",10,0,Rmax,10,0,Rmax); h->Draw();
67 TVector2 P(3+j*.7,3+i*.7);
73 tm=
new TMarker(P.X(),P.Y(),5);
74 int off=kU%2 +2*(kV%2);
76 tm->Draw(); tm->SetMarkerColor(1+off);
89 TVector2 r=i*HL.bU + j*HL.bV;
91 if(r.X()<0 || r.Y()<0)
continue;
92 if(r.X()>r2 || r.Y()>r2)
continue;
93 el=
new TEllipse(r.X(),r.Y(),0.5);
97 int off=kU%2 +2*(kV%2);
98 el->SetFillColor(1+off);