Commit f10cb466 authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

Atmospheric Ray Tracing

-Renamed a few functions
-Rays now have functions to check whether a timestamp belongs to a reflection
parent 4a3a09d7
......@@ -53,6 +53,8 @@ namespace ITAPropagationPathSim
virtual ~CRay() {}
public:
#pragma region Get Functions
std::vector<VistaVector3D> SamplingPoints() const { return v3SamplingPoints; }
std::vector<VistaVector3D> WavefrontNormals() const { return v3WavefrontNormals; }
std::vector<double> TimeStamps() const { return dTimeStamps; }
......@@ -64,11 +66,14 @@ namespace ITAPropagationPathSim
VistaVector3D LastPoint() const { return v3SamplingPoints[v3SamplingPoints.size()]; }
VistaVector3D LastWavefrontNormal() const { return v3WavefrontNormals[v3WavefrontNormals.size()]; }
double MaxTime() const { return dTimeStamps[dTimeStamps.size()]; }
double LastTimeStamp() const { return dTimeStamps[dTimeStamps.size()]; }
unsigned int ReflectionOrder() const { return iReflectionIndices.size(); }
bool SameDirection(const CRay& other) { return InitialDirection() == other.InitialDirection(); }
#pragma endregion
bool SameDirection(const CRay& other) const { return InitialDirection() == other.InitialDirection(); }
bool IsReflectionIdx(const unsigned int& idx) const { return std::find(iReflectionIndices.begin(), iReflectionIndices.end(), idx) != iReflectionIndices.end(); }
void Append(const VistaVector3D& point, const VistaVector3D& wavefrontNormal, const double& timeStamp)
{
......
......@@ -41,7 +41,7 @@ namespace ITAPropagationPathSim
double dTMax;
public:
AbortAtMaxTime(double tMax = 30) : dTMax(tMax) {}
bool AbortRequested(const CRay& ray) const { return ray.MaxTime() >= dTMax; }
bool AbortRequested(const CRay& ray) const { return ray.LastTimeStamp() >= dTMax; }
};
enum ITA_PROPAGATION_PATH_SIM_API SolverMethod
......
......@@ -46,7 +46,7 @@ namespace ITAPropagationPathSim
CAdaptiveSolver(const SimulationSettings& settings) : rSettings(settings) {}
public:
double GetCurrentStepSize() const { return dCurrentDt; }
double CurrentStepSize() const { return dCurrentDt; }
//! Performs a single integration step based on the given simulation settings.
void Process(const VistaVector3D& r, const VistaVector3D& s, const ITAGeo::CStratifiedAtmosphere& atmosphere, VistaVector3D& rNew, VistaVector3D& sNew);
......
......@@ -4,6 +4,9 @@
#include "AdaptiveSolver.h"
#include <ITAPropagationPathSim/AtmosphericRayTracing/ODESolver/ODESolver.h>
// Vista includes
//#include <VistaInterProcComm/Concurrency/VistaThread.h>
// STD
#include <cmath>
......@@ -23,18 +26,18 @@ class CWorker
rRay(ray), rAbortCriterion(abortCriterion), mSolver(CAdaptiveSolver(simSettings)) {}
private:
bool ReflectionOccured(const double& rz1, const double& rz2) const
bool GroundReflectionOccured(const double& rz1, const double& rz2) const
{
return signbit(rz1) != signbit(rz2);
}
void GetReflectionPoint(const VistaVector3D& r1, const VistaVector3D& r2, const double& dt, VistaVector3D& rGround, double& dtGround)
void InterpolateToReflectionPoint(const VistaVector3D& r1, const VistaVector3D& r2, const double& dt, VistaVector3D& rReflection, double& dtReflection)
{
const VistaVector3D dr = r2 - r1;
const double timePortion = -r1[Vista::Z] / dr[Vista::Z];
rGround = r1 + dr * dt;
rGround[Vista::Z] = 0;
dtGround = dt * timePortion;
rReflection = r1 + dr * dt;
rReflection[Vista::Z] = 0;
dtReflection = dt * timePortion;
}
void ExtendRayByOnePeriod()
{
......@@ -76,7 +79,7 @@ class CWorker
VistaVector3D r = rRay.LastPoint();
double rz = r[Vista::Z];
VistaVector3D n = rRay.LastWavefrontNormal();
double time = rRay.MaxTime();
double time = rRay.LastTimeStamp();
VistaVector3D s = ODESolver::NormalToSlowness(n, rz, atmosphere);
......@@ -85,13 +88,13 @@ class CWorker
{
mSolver.Process(r, s, atmosphere, rNew, sNew);
n = ODESolver::SlownessToNormal(s);
const double dt = mSolver.GetCurrentStepSize();
const double dt = mSolver.CurrentStepSize();
if (ReflectionOccured(r[Vista::Z], rNew[Vista::Z]))
if (GroundReflectionOccured(r[Vista::Z], rNew[Vista::Z]))
{
VistaVector3D rGround;
double dtGround;
GetReflectionPoint(r, r, dt, rGround, dtGround);
InterpolateToReflectionPoint(r, rNew, dt, rGround, dtGround);
rRay.AppendReflection(rGround, n, time + dtGround);
if (rRay.ReflectionOrder() >= 2) //Ray is periodic
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment