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

ART - Eigenray Worker

- removed unused methods
- fixed a bug where external Watcher of simulation engine was not set properly
parent 136f974c
......@@ -12,10 +12,9 @@ using namespace ITAPropagationPathSim::AtmosphericRayTracing;
#pragma region WORKERBASE
EigenraySearch::CWorkerBase::CWorkerBase(const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition, const Simulation::Settings& simSettings, const RayTracingAbortSettings& abortSettings)
: v3SourcePosition(sourcePosition), v3ReceiverPosition(receiverPosition), rayTracingAbortSettings(abortSettings), v3MirroredReceiverPosition(receiverPosition)
: v3SourcePosition(sourcePosition), v3ReceiverPosition(receiverPosition), rayTracingAbortSettings(abortSettings), v3MirroredReceiverPosition(receiverPosition), simulationEngine(Simulation::CEngine(*this))
{
simulationEngine.settings = simSettings;
simulationEngine.externalWatcher = *this;
v3MirroredReceiverPosition[Vista::Z] = -v3MirroredReceiverPosition[Vista::Z];
}
......@@ -28,49 +27,13 @@ void EigenraySearch::CWorkerBase::FinalizeRay(RayPtr& pRay) const
pRay->FinalizeMinimumReceiverDistances();
}
const VistaVector3D& EigenraySearch::CWorkerBase::VirtualReceiverPosition(const int reflectionOrder) const
{
if (reflectionOrder % 2 != 0) //On uneven reflection order
return v3MirroredReceiverPosition;
return v3ReceiverPosition;
}
inline VistaVector3D ClosestPointOnLineSegmentToReceiver(const VistaVector3D& segmentP1, const VistaVector3D& segmentP2, const VistaVector3D& receiverPoint)
{
const VistaVector3D normal = (segmentP2 - segmentP1).GetNormalized();
VistaVector3D intersectionPoint = segmentP1 + normal.Dot(receiverPoint - segmentP1) * normal; //intersection with line (not necessarily segment)
if ((segmentP1 - intersectionPoint).Dot(segmentP2 - intersectionPoint) < 0) //Point inside segment
return intersectionPoint;
float d1 = (segmentP1 - receiverPoint).GetLength();
float d2 = (segmentP2 - receiverPoint).GetLength();
return d1 < d2 ? segmentP1 : segmentP2;
}
void EigenraySearch::CWorkerBase::InterpolateToRealMinimumPosition(const RayPtr& pRay, const VistaVector3D& receiverPos, int& iMinReceiverDistanceIdx, float& dMin, VistaVector3D& rMin)
{
const VistaVector3D& rTmpMin = pRay->at(iMinReceiverDistanceIdx).position;
VistaVector3D rAfter = rTmpMin;
if (iMinReceiverDistanceIdx < pRay->size() - 1)
rAfter = ClosestPointOnLineSegmentToReceiver(rTmpMin, pRay->at(iMinReceiverDistanceIdx + 1).position, receiverPos);
VistaVector3D rBefore = rTmpMin;
if (iMinReceiverDistanceIdx > 0)
rBefore = ClosestPointOnLineSegmentToReceiver(rTmpMin, pRay->at(iMinReceiverDistanceIdx + 1).position, receiverPos);
rMin = rAfter;
dMin = (rAfter - receiverPos).GetLength();
const float dMinBefore = (rAfter - receiverPos).GetLength();
if (dMinBefore < dMin)
{
iMinReceiverDistanceIdx--;
rMin = rBefore;
dMin = dMinBefore;
}
}
EigenraySearch::RayPtr EigenraySearch::CWorkerBase::FindMinimumDistanceRay(const std::set<RayPtr>& rays, const int reflectionOrder)
{
float dMin = _FMAX;
......
......@@ -77,7 +77,6 @@ namespace ITAPropagationPathSim
const VistaVector3D& VirtualReceiverPosition(const int reflectionOrder) const;
RayPtr FindMinimumDistanceRay(const std::set<RayPtr>& rays, const int reflectionOrder);
void InterpolateToRealMinimumPosition(const RayPtr& pRay, const VistaVector3D& receiverPos, int& iMinReceiverDistanceIdx, float& dMin, VistaVector3D& rMin);
};
//! Does a rough search for potential eigenrays directions for multiple reflection orders
......
Supports Markdown
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