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

ART - Rays

- now is derived from std::vector
parent a3468839
......@@ -40,25 +40,21 @@ namespace ITAPropagationPathSim
{
ITAGeo::CPropagationPath ToPropagationPath(const CRay& ray)
{
const std::vector<VistaVector3D> r = ray.SamplingPoints();
const std::vector<VistaVector3D> n = ray.WavefrontNormals();
const std::vector<double> t = ray.TimeStamps();
ITAGeo::CPropagationPath propagationPath;
propagationPath.reserve(ray.size() + 2 + ray.ReflectionOrder());
propagationPath.push_back(std::make_shared<ITAGeo::CEmitter>(r[0]));
for (int idx = 0; idx < r.size(); idx++)
propagationPath.push_back( std::make_shared<ITAGeo::CEmitter>(ray.SourcePoint()) );
for (int idx = 0; idx < ray.size(); idx++)
{
propagationPath.push_back(std::make_shared<ITAGeo::CInhomogeneity>(r[idx], n[idx], t[idx]));
propagationPath.push_back( std::make_shared<ITAGeo::CInhomogeneity>(ray[idx].position, ray[idx].wavefrontNormal, ray[idx].timeStamp));
if (ray.IsReflectionIdx(idx))
{
auto anchor = std::make_shared<ITAGeo::CSpecularReflection>(r[idx]);
auto anchor = std::make_shared<ITAGeo::CSpecularReflection>(ray[idx].position);
anchor->v3FaceNormal = VistaVector3D(0, 0, 1);
propagationPath.push_back(anchor);
}
}
propagationPath.push_back(std::make_shared<ITAGeo::CSensor>(r[r.size()-1]));
propagationPath.push_back( std::make_shared<ITAGeo::CSensor>(ray.LastPoint()) );
return propagationPath;
}
......
......@@ -35,22 +35,23 @@ namespace ITAPropagationPathSim
{
namespace AtmosphericRayTracing
{
//class ITA_PROPAGATION_PATH_SIM_API RayElement {
//public:
// VistaVector3D position;
// VistaVector3D wavefrontNormal;
// double timeStamp;
class ITA_PROPAGATION_PATH_SIM_API RayElement {
public:
VistaVector3D position;
VistaVector3D wavefrontNormal;
double timeStamp;
// RayElement(const VistaVector3D& r, const VistaVector3D& n, const double& time) : position(r), wavefrontNormal(n), timeStamp(time) {}
//};
RayElement() {}
RayElement(const VistaVector3D& r, const VistaVector3D& n, const double& time) : position(r), wavefrontNormal(n), timeStamp(time) {}
};
class ITA_PROPAGATION_PATH_SIM_API CRay
class ITA_PROPAGATION_PATH_SIM_API CRay : public std::vector<RayElement>
{
private:
std::vector<VistaVector3D> v3SamplingPoints;
std::vector<VistaVector3D> v3WavefrontNormals;
std::vector<double> dTimeStamps;
//std::vector<VistaVector3D> v3SamplingPoints;
//std::vector<VistaVector3D> v3WavefrontNormals;
//std::vector<double> dTimeStamps;
std::vector<unsigned int> iReflectionIndices;
public:
......@@ -60,18 +61,15 @@ namespace ITAPropagationPathSim
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; }
std::vector<unsigned int> RelectionIndices() const { return iReflectionIndices; }
const std::vector<unsigned int>& RelectionIndices() const { return iReflectionIndices; }
unsigned int NumPoints() const { return v3SamplingPoints.size(); }
VistaVector3D SourcePoint() const { return v3SamplingPoints[0]; }
VistaVector3D InitialDirection() const { return v3WavefrontNormals[0]; }
unsigned int NumPoints() const { return size(); }
const VistaVector3D& SourcePoint() const { return front().position; }
const VistaVector3D& InitialDirection() const { return front().wavefrontNormal; }
VistaVector3D LastPoint() const { return v3SamplingPoints[v3SamplingPoints.size()-1]; }
VistaVector3D LastWavefrontNormal() const { return v3WavefrontNormals[v3WavefrontNormals.size()-1]; }
double LastTimeStamp() const { return dTimeStamps[dTimeStamps.size()-1]; }
const VistaVector3D& LastPoint() const { return back().position; }
const VistaVector3D& LastWavefrontNormal() const { return back().wavefrontNormal; }
const double& LastTimeStamp() const { return back().timeStamp; }
unsigned int ReflectionOrder() const { return iReflectionIndices.size(); }
#pragma endregion
......
......@@ -17,16 +17,12 @@ CRay::CRay(const VistaVector3D& v3SourcePos, const double& thetaDeg, const doubl
}
CRay::CRay(const VistaVector3D& v3SourcePos, const VistaVector3D& v3Direction)
{
v3SamplingPoints.push_back(v3SourcePos);
v3WavefrontNormals.push_back(v3Direction.GetNormalized());
dTimeStamps.push_back(0);
Append(v3SourcePos, v3Direction.GetNormalized(), 0.0);
}
void CRay::Append(const VistaVector3D& position, const VistaVector3D& wavefrontNormal, const double& timeStamp)
{
v3SamplingPoints.push_back(position);
v3WavefrontNormals.push_back(wavefrontNormal);
dTimeStamps.push_back(timeStamp);
push_back( RayElement(position, wavefrontNormal, timeStamp) );
}
void CRay::AppendReflection(const VistaVector3D& position, const VistaVector3D& wavefrontNormal, const double& timeStamp)
{
......
......@@ -49,23 +49,23 @@ class CWorker
const int idxStartReflection = iReflectionIndices[reflectionOrder-2];
const int idxEndReflection = iReflectionIndices[reflectionOrder - 1];
double tOffset = pRay->TimeStamps()[idxEndReflection] - pRay->TimeStamps()[idxStartReflection];
VistaVector3D rXYOffset = pRay->SamplingPoints()[idxEndReflection] - pRay->SamplingPoints()[idxStartReflection];
double tOffset = pRay->at(idxEndReflection).timeStamp - pRay->at(idxStartReflection).timeStamp;
VistaVector3D rXYOffset = pRay->at(idxEndReflection).position - pRay->at(idxStartReflection).position;
for (int idx = idxStartReflection+1; idx < idxEndReflection; idx++)
{
const double t = pRay->TimeStamps()[idx] + tOffset;
const VistaVector3D r = pRay->SamplingPoints()[idx] + rXYOffset;
const VistaVector3D n = pRay->WavefrontNormals()[idx];
const double t = pRay->at(idx).timeStamp + tOffset;
const VistaVector3D r = pRay->at(idx).position + rXYOffset;
const VistaVector3D n = pRay->at(idx).wavefrontNormal;
pRay->Append(r, n, t);
if (rAbortCriterion.AbortRequested(pRay))
return;
}
const double t = pRay->TimeStamps()[idxEndReflection] + tOffset;
const VistaVector3D r = pRay->SamplingPoints()[idxEndReflection];
const VistaVector3D n = pRay->WavefrontNormals()[idxEndReflection];
const double t = pRay->at(idxEndReflection).timeStamp + tOffset;
const VistaVector3D r = pRay->at(idxEndReflection).position + rXYOffset;
const VistaVector3D n = pRay->at(idxEndReflection).wavefrontNormal;
pRay->AppendReflection(r, n, t);
}
void ExtendRayPeriodically()
......
......@@ -42,7 +42,7 @@ using namespace ITAPropagationPathSim::AtmosphericRayTracing::Simulation;
void runTest(const CStratifiedAtmosphere& atmosphere, const double& sourceAltitude, const VistaVector3D& rayDirection, const string& fileSuffix)
{
double tMax = 10;
double tMax = 15;
auto engine = Simulation::CEngine(CAbortAtMaxTime(tMax));
double dt = 0.01;
......
......@@ -39,7 +39,7 @@ art.source = [0 0 50]; %Can also be a single itaCoordinates
art.receiver = [0 0 0]; %Can also be a single itaCoordinates
art.dt = 0.01; %Integration variable [s]
art.tMax = 10; %Maximum time of tracing [s]
art.tMax = 15; %Maximum time of tracing [s]
art.bAdaptiveDt = true;
art.maxErrorV = 0.015;
......
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