for(int j = 1 ; j < number_of_rays ; j++)
{
// int a = Incident_angles.at(j-1) + Angle_Difference;
Incident_angles.insert(j, Incident_angles.at(j-1) + Angle_Difference);
//qDebug() << "InCIDENT ANGLE = " << Incident_angles.at(j);
}
for (int j = 0; j < number_of_rays; j++)
{
SRP_X_Cordinate.clear();
SRP_Y_Cordinate.clear();
int factor = -1;
counter = 0;
SRP_X_Cordinate.insert(0,0);
SRP_Y_Cordinate.insert(0,source_depth);
Actual_Incident_Angle = Incident_angles.at(j);
//qDebug() << "InCIDENT ANGLE = " << Incident_angles.at(j);
if (Incident_angles.at(j) > 90)
{
factor = -factor;
Actual_Incident_Angle = 180 - Incident_angles.at(j);
//qDebug() << "Actual_Incident_Angle" << Actual_Incident_Angle;
}
if (SRP_Y_Cordinate.at(0) > 0)
{
if (Incident_angles.at(j)!= 90)
{
Theta_1 = Actual_Incident_Angle*pi/180;
SRP_X_Cordinate.append(( SRP_X_Cordinate.at(counter) + difference_depth*tan(Theta_1)));
SRP_Y_Cordinate.append((SRP_Y_Cordinate.at(counter) + factor*difference_depth));
//qDebug() << "Inside not equal to 90";
double C1 = Calculate_velocity(SRP_Y_Cordinate.at(counter));// + factor*0.001);
double C2 = Calculate_velocity(SRP_Y_Cordinate.at(counter+1));// + factor*0.001);
double t = Temp_Time + (sqrt(pow((SRP_X_Cordinate.at(counter) - SRP_X_Cordinate.at(counter+1)),2) + pow((SRP_Y_Cordinate.at(counter) - SRP_Y_Cordinate.at(counter+1)),2)))/C1;
Ray_Time.insert(counter, t);
Temp_Time = Ray_Time.at(counter);
Theta_2 = Calculate_Angle(C1, C2, Theta_1);
counter = counter + 1;
while( SRP_X_Cordinate.at(counter) < max_range)
{
qDebug()<<"Theta_1 = "<< Theta_1;
qDebug()<<"Theta_2 = "<< Theta_2;
qDebug()<<"C1 = "<< C1;
qDebug()<<"C2 = "<< C2;
if(Theta_2 < (pi/2 - 0.001))
{
Theta_1 = Theta_2;
SRP_Y_Cordinate.append((SRP_Y_Cordinate.at(counter) + factor*difference_depth));
SRP_X_Cordinate.append((counter+1, SRP_X_Cordinate.at(counter) + difference_depth*tan(Theta_1)));
if( SRP_Y_Cordinate.at(counter+1) > 0.001 && SRP_Y_Cordinate.at(counter+1) < max_depth)
{
//qDebug()<<"SRP_X_Cordinate.at(counter) theta<90- - .01 = "<< SRP_Y_Cordinate.at(counter);
C1 = C2;
C2 = Calculate_velocity(SRP_Y_Cordinate.at(counter+1));// + factor*0.001);
Ray_Time.insert(counter, Temp_Time + (sqrt(pow((SRP_X_Cordinate.at(counter) - SRP_X_Cordinate.at(counter+1)),2) + pow((SRP_Y_Cordinate.at(counter) - SRP_Y_Cordinate.at(counter+1)),2)))/C1);
Temp_Time = Ray_Time.at(counter);
Theta_2 = Calculate_Angle(C1, C2, Theta_1);
}
else
{
//qDebug()<<"SRP_X_Cordinate.at(counter) theta<90- - .01 else cond = "<< SRP_Y_Cordinate.at(counter);
Theta_2 = Theta_1;
C2 = Calculate_velocity(SRP_Y_Cordinate.at(counter + 1));// + factor*0.001);
factor = - factor;
Ray_Time.insert(counter, Temp_Time + (sqrt(pow((SRP_X_Cordinate.at(counter) - SRP_X_Cordinate.at(counter+1)),2) + pow((SRP_Y_Cordinate.at(counter) - SRP_Y_Cordinate.at(counter+1)),2)))/C2);
}
}
else if(Theta_2 > (pi/2 + 0.0001))
{
qDebug()<<"SRP_X_Cordinate.at(counter) theta>90- - .01 = ";
factor = - factor;
Theta_1 = pi - Theta_2;
SRP_Y_Cordinate.append((SRP_Y_Cordinate.at(counter) + factor*difference_depth));
SRP_X_Cordinate.append((SRP_X_Cordinate.at(counter) + difference_depth*tan(Theta_1)));
C1 = C2;
C2 = Calculate_velocity(SRP_Y_Cordinate.at(counter+1));// + factor*0.001);
Ray_Time.insert(counter, Temp_Time + (sqrt(pow((SRP_X_Cordinate.at(counter) - SRP_X_Cordinate.at(counter+1)),2) + pow((SRP_Y_Cordinate.at(counter) - SRP_Y_Cordinate.at(counter+1)),2)))/C1);
Temp_Time = Ray_Time.at(counter);
Theta_2 = Calculate_Angle(C1, C2, Theta_1);
}
else
{
factor = - factor;
Theta_1 = 89*pi/180;
//qDebug()<<"SRP_X_Cordinate.at(counter) theta<90- - .01 = else condition "<< SRP_Y_Cordinate.at(counter);
SRP_Y_Cordinate.append((SRP_Y_Cordinate.at(counter) + factor*difference_depth));
SRP_X_Cordinate.append((SRP_X_Cordinate.at(counter) + difference_depth*tan(Theta_1)));
C1 = C2;
C2 = Calculate_velocity(SRP_Y_Cordinate.at(counter+1));// + factor*0.001);
Ray_Time.insert(counter, Temp_Time + (sqrt(pow((SRP_X_Cordinate.at(counter) - SRP_X_Cordinate.at(counter+1)),2) + pow((SRP_Y_Cordinate.at(counter) - SRP_Y_Cordinate.at(counter+1)),2)))/C1);
Temp_Time = Ray_Time.at(counter);
Theta_2 = Calculate_Angle(C1, C2, Theta_1);
}
// qDebug()<<"SRP_X_Cordinate.at(counter) theta<90- - .01 else cond = "<< SRP_Y_Cordinate.at(counter);
counter = counter + 1;
}
/* for( int r = 0; r< counter-1;r++)
{
Ray_Distance.insert(j, Ray_Distance.at(j) + sqrt(pow((SRP_X_Cordinate.at(r) - SRP_X_Cordinate.at(r+1)),2) + pow((SRP_Y_Cordinate.at(r) - SRP_Y_Cordinate.at(r+1)),2)));
}*/
}
else
{
counter = 1;
SRP_X_Cordinate.insert(1,max_range);
SRP_Y_Cordinate.insert(1,source_depth);
}
}
SRP_2D_X_Cordinate.insert(j,SRP_X_Cordinate);
SRP_2D_Y_Cordinate.insert(j,SRP_Y_Cordinate);
//qDebug()<<" counter "<< counter;
Data_points.insert(j,counter);
} /////////////////// END FOR /////////////////////////////////