Subversion Repositories f9daq

Compare Revisions

Regard whitespace Rev 72 → Rev 73

/lightguide/trunk/src/userFunctions.cpp
111,11 → 111,6
 
//------------------------------------------------------------------------------------------
 
 
TVector3 p_pol0(0.0, 0.0, 1.0);
void SetPol(double x, double y, double z)
{p_pol0.SetXYZ(x,y,z);}
 
// Test function
// creates an optical boundary surface
// shows the propagation of light ray
123,11 → 118,11
// and surface normal (blue)
void PolTest(double theta = 0.0)
{
int p_type = 1;
int p_type = SURF_REFRA;
double p_n1 = parameters.getN1();
double p_n2 = parameters.getN2();
theta = 3.141593*theta/180.0; if(theta < 1e-6) theta = 1e-6;
TVector3 p_pol;
theta = 3.141593*theta/180.0;
if(theta < 1e-6) theta = 1e-6;
Init();
134,31 → 129,33
double cx = 0.0;
TVector3 vodnik_edge[4];
double t = 3.0;
vodnik_edge[0].SetXYZ(cx, t,-t); vodnik_edge[1].SetXYZ(cx, t, t);
vodnik_edge[2].SetXYZ(cx,-t, t); vodnik_edge[3].SetXYZ(cx,-t,-t);
/*
#define SURF_DUMMY 0
#define SURF_REFRA 1
#define SURF_REFLE 2
#define SURF_TOTAL 3
#define SURF_IMPER 4
*/
CSurface *surf = new CSurface(p_type, vodnik_edge, p_n1, p_n2, 0.96); //surf->FlipN();
vodnik_edge[0].SetXYZ(cx, t,-t);
vodnik_edge[1].SetXYZ(cx, t, t);
vodnik_edge[2].SetXYZ(cx,-t, t);
vodnik_edge[3].SetXYZ(cx,-t,-t);
 
CSurface *surf = new CSurface(p_type, vodnik_edge, p_n1, p_n2, 0.96);
surf->FlipN();
surf->SetFresnel(1);
surf->Draw();
CRay *ray = new CRay(cx, 0.0, 0.0, TMath::Cos(theta), 0.0, TMath::Sin(theta));
ray->SetColor(kBlack);
ray->SetColor(kRed);
//p_pol = rotatey(p_pol0, -theta);
p_pol = p_pol0; p_pol.RotateY(-theta);
TVector3 sE(0,1,0);
TVector3 pE(0,0,1);
TVector3 p_pol = pE;
p_pol.RotateY(-theta);
//printf("p_pol = "); printv(p_pol);
ray->SetPolarization(p_pol);
ray->setPolarization(p_pol);
ray->DrawS(cx, -5.0);
CRay *out = new CRay; out->SetColor(kRed);
CRay *out = new CRay;
out->SetColor(kBlack);
TVector3 *inters = new TVector3;
surf->PropagateRay(*ray, out, inters);
printf(" n1 = %f, n2 = %f\n", p_n1, p_n2);
//if(fate == 1) out->DrawS(cx, 5.0);
out->DrawS(cx, 5.0);
166,11 → 163,13
incidentPolarization->SetColor(kGreen);
incidentPolarization->Set(ray->GetR(), p_pol);
incidentPolarization->DrawS(cx, 1.0);
printf(" GREEN: polarization vector\n");
CRay *surfaceNormal = new CRay;
surfaceNormal->SetColor(kBlue);
surfaceNormal->Set(ray->GetR(), surf->GetN());
surfaceNormal->DrawS(cx, 1.0);
printf(" BLUE: surface normal vector\n");
}
 
void ptt()