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

ART - AdaptiveRayGrid

- added new ZoomIntoRay() method which allows to create new rays around a given one using a specified angular resolution
parent 5b0e9925
......@@ -59,6 +59,8 @@ namespace ITAPropagationPathSim
void ZoomIntoRay(const std::shared_ptr<CRay>& pRay);
//! Advanced adaptation method: Further reduces the angular limits using additional information compared to simple method before doubling the angular resolution.
void ZoomIntoRay(const std::shared_ptr<CRay>& pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold);
//! Zooms into the given ray using a specific angular resolution by creating up to 8 new rays surrounding the given one.
void ZoomIntoRay(const std::shared_ptr<CRay>& pRay, const double& deltaTheta, const double& deltaPhi);
private:
//! Further reduces the limits of the ray grid using additional information on given rays and the receiver position
......
......@@ -65,6 +65,56 @@ void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pRay, const int
SetAdvancedRayGridLimits(pRay, idxMinDist, receiverPosition, threshold);
DoubleRayResolution();
}
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pZoomRay, const double& deltaTheta, const double& deltaPhi)
{
const int idx = GetIndex(pZoomRay);
if (idx < 0)
ITA_EXCEPT_INVALID_PARAMETER("Given ray is not part of the adapted grid.");
if (deltaTheta < 0 || deltaPhi < 0)
ITA_EXCEPT_INVALID_PARAMETER("Delta angles must be positive numbers.");
const double thetaDeg = vdThetaDeg[ IndexToThetaIndex(idx) ];
const double phiDeg = vdPhiDeg[ IndexToThetaIndex(idx) ];
int idxRayTheta = 1; int idxRayPhi = 1;
vdThetaDeg = { thetaDeg - deltaTheta, thetaDeg, thetaDeg + deltaTheta };
vdPhiDeg = { phiDeg - deltaPhi, phiDeg, phiDeg + deltaPhi };
if (vdThetaDeg.front() < 0)
{
vdThetaDeg.erase(vdThetaDeg.begin());
idxRayTheta = 0;
}
if (vdThetaDeg.back() > 180)
vdThetaDeg.pop_back();
RayMatrix newRayMatrix(NTheta(), RayVector(NPhi()));
vpNewRaysOfLastAdaptation.clear();
for (int idxTheta = 0; idxTheta < vdThetaDeg.size(); idxTheta++)
{
for (int idxPhi = 0; idxPhi < vdPhiDeg.size(); idxPhi++)
{
RayPtr pCurrentRay;
if (idxRayTheta == idxTheta && idxRayPhi == idxPhi)
pCurrentRay = pZoomRay;
else if ( IsPoleDirection(vdThetaDeg[idxTheta]) && (idxRayTheta==idxTheta || idxPhi > 0) )
{
if (idxTheta == idxRayTheta)
pCurrentRay = pZoomRay;
else
pCurrentRay = newRayMatrix[idxTheta].front();
}
else
{
pCurrentRay = std::make_shared<CRay>(v3SourcePos, vdThetaDeg[idxTheta], vdPhiDeg[idxPhi]);
vpNewRaysOfLastAdaptation.insert(pCurrentRay);
}
newRayMatrix[idxTheta][idxPhi] = pCurrentRay;
}
}
SetRayMatrix(newRayMatrix);
}
#pragma endregion
#pragma region NEW RAY LIMITS - private
......
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