106 for (
unsigned int i = 0; i <
MatRes.size(); i++)
124 const array< array<double, 3>, 3 >& Jv =
dynamic_cast<meteoLin*
>(
_weather)->getJacobMatrix();
132 y.
pos = ((s * (c * c / omega)) + v);
135 n.
x = (
decimal)(- omega / c * Dc.
x - Jv[0][0] * s.
x - Jv[0][1] * s.
y - Jv[0][2] * s.
z);
136 n.
y = (
decimal)(- omega / c * Dc.
y - Jv[1][0] * s.
x - Jv[1][1] * s.
y - Jv[1][2] * s.
z);
137 n.
z = (
decimal)(- omega / c * Dc.
z - Jv[2][0] * s.
x - Jv[2][1] * s.
y - Jv[2][2] * s.
z);
139 n.
x += (
decimal)((Jv[0][1] - Jv[1][0]) * s.
y + (Jv[0][2] - Jv[2][0]) * s.
z);
140 n.
y += (
decimal)((Jv[1][2] - Jv[2][1]) * s.
z + (Jv[1][0] - Jv[0][1]) * s.
x);
141 n.
z += (
decimal)((Jv[2][0] - Jv[0][2]) * s.
x + (Jv[2][1] - Jv[1][2]) * s.
y);
178 while ((static_cast<unsigned int>(cpt_tps) <
temps.size()) && (travel_length <
dmax))
190 y.
etapes.push_back(ySuiv);
213 for (
unsigned int ns = 0; ns <
sources.size(); ++ns)
219 for (
unsigned int k = 0; k <
nbRay; ++k)
223 s0 = n0 / (
decimal)((dynamic_cast<meteoLin*>(
_weather)->cTemp(source, grad) + (dynamic_cast<meteoLin*>(
_weather)->cWind(source) * n0)));
242 k1 =
EqRay(current_step) *
h;
243 k2 =
EqRay(current_step + k1 * 0.5) *
h;
244 k3 =
EqRay(current_step + k2 * 0.5) *
h;
245 k4 =
EqRay(current_step + k3) *
h;
247 return current_step + ((k1 + k2 * 2.f + k3 * 2.f + k4) * (1.f / 6.f));
288 double tmp = u * nExt_plan;
307 double uu1 = u * SA1;
308 double uu2 = u * SA2;
309 double uu3 = u * SA3;
311 if ((uu1 < 0) && (uu2 < 0) && (uu3 < 0))
320 double u1 = u * (SA1 ^ SA2);
321 double u2 = u * (SA2 ^ SA3);
322 double u3 = u * (SA3 ^ SA1);
324 if ((u1 >= 0) || (u2 >= 0) || (u3 >= 0))
335 double l = SA1 * nExt_plan;
370 for (r = 0;
static_cast<unsigned int>(r) <
_plan.size(); ++r)
411 if ((Imin.x != Y_t0.
pos.
x) || (Imin.y != Y_t0.
pos.
y) || (Imin.z != Y_t0.
pos.
z))
428 current.
rencontre.insert(pair<int, int>(timer, rmin));
436 for (
unsigned int ns = 0; ns <
sources.size(); ++ns)
438 for (
unsigned int nr = 0; nr <
recepteurs.size(); ++nr)
444 return result * 1.2f;
454 for (
unsigned int i = 0 ; i <
nbRay ; i++)
457 unsigned int numRay, nbEvent;
461 para >> numRay >> c1 >> anglePhi >> c2 >> angleTheta;
462 vec3 angles(anglePhi, angleTheta, 0);
463 tableau_norm.push_back(angles);
467 double x, y, z, bidon;
469 for (
unsigned int j = 0; j < nbEvent; j++)
471 para >> x >> c1 >> y >> c2 >> z >> c3 >> bidon;
492 return (
decimal)(2 * atan((-4 * a * c * d + sqrt(16 * a2 * c2 * d2 + 4 * (a2 * d2 + a2 * h2 - 2 * c * h * a) * (a2 * d2 + a2 * h2 - 2 * c * h * a))) / (2 * (a2 * d2 + a2 * h2 - 2 * c * h * a))));
499 ostringstream nom_var;
505 ofstream fic_out(nom_var.str().c_str());
507 for (
unsigned int i = 0; i <
MatRes.size(); i++)
509 for (
unsigned int j = 0; j <
nbRay; ++j)
511 for (
unsigned int k = 0; k <
MatRes[i][j].etapes.size(); ++k)
513 fic_out <<
MatRes[i][j].etapes[k].pos.x <<
" " 514 <<
MatRes[i][j].etapes[k].pos.y <<
" " 515 <<
MatRes[i][j].etapes[k].pos.z << endl;
518 fic_out << endl << endl;
int nbReflex
Reflections number.
vector< vec3 * > _plan
List of objects defined by 3 points.
virtual vec3 getSample()
Return the sample.
Sampler * _sampler
Pointer to a ray generator.
void setSize(const unsigned int taille)
Set the steps vector size.
meteo * _weather
Pointer to weather.
void init_sampler()
Initialize ray generator.
decimal TMax
Maximal propagation time.
decimal finalAnglePhi
Final shot angle according phi.
Describes analytical ray curve tracing.
string ray_fileName
Filename of file containing angles of rays.
decimal finalAngleTheta
Final shot angle according theta.
unsigned int nbRay
Launched rays number.
void createTemps()
Build the time vector (different times solved)
decimal distance(const base_vec3 &a_vector) const
Compute the distance between two points pointed by *this and a_vector.
base_vec3< decimal > vec3
void RemplirMat()
Fill the MatRes matrix containing the ray curves.
decimal initialAngleTheta
Initial shot angle according theta.
void save()
Save rays to a file.
vector< RayCourb * > MatRes
Array containing the resulting rays for each source.
decimal h
Discretization step.
A Sampler class for longitudinal sampling.
Class to define linear gradient for wind and sound speed.
vec3 valideIntersection(const vec3 &S, const vec3 &R, const vec3 *A, int &reflexion, const vec3 &nExt_plan, const vec3 &SR)
Compute the intersection point between a plane and a line.
3D vector Vector defined with 3 float numbers
decimal dmax
Maximal distance traveled by the rays.
vector< Step > etapes
Time steps vector.
base_t length(void) const
void purgeMatRes()
Clear the memory of MatRes object.
vector< vec3 > sources
Sources vector.
void loadRayFile(vector< vec3 > &tableau_norm)
Read the file containing the starting angles of the rays.
void intersection(const unsigned int &timer, RayCourb ¤t, Step &Y_t0, Step &Y_t1)
Step compute_next_step(const Step ¤t_step)
Compute next step taking account of the weather.
vector< int > position
List of the indices of points where reflection happens (time step number)
decimal angle_depart(const decimal &a, const decimal &c, const decimal &d, const decimal &h)
Compute the shooting angle ray in order to travel the given minimal distance.
decimal initialAnglePhi
Initial shot angle according phi.
vector< decimal > temps
[0:h:TMax] Vector containing the different times solved
map< int, int > rencontre
Tuple (time step, encountered face)
vector< vec3 > recepteurs
Receptors vector.
decimal distance_max()
Compute and return the maximal distance between sources and receptors.
Step EqRay(const Step &y0)
Function to define the eikonal equation.
unsigned int _launchType
Launch type with 1:horizontal / 2:vertical / 3:spherical / 4:file.
virtual void init()
Initialize the sample.
Describe a step in the ray path.
bool wantOutFile
True if an output file is wanted.
A Sampler class for latitude sampling.
RayCourb RK4(const Step &y0)
Fourth order Runge-Kutta algorithm.
Class to describe a ray curve.