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

ART - RayGrid

- added bool to (de)activate sorting of angle vectors
- fixed bug where ray angles where falsely sorted on CreateCopyWithNewRays()
parent 91da7763
......@@ -67,9 +67,9 @@ namespace ITAPropagationPathSim
//! Creates a set of rays using a source position and the given elevation and azimuth angles [°] for the inital directions. An optional bool indicates whether the azimuth angle covers the full 360°.
/**
* For each combination of theta and phi, one ray is created and stored.
* Note, that both vectors with angles will be sorted before creating the rays.
* Note, that both vectors with angles will be sorted before creating the rays if not specified otherwise.
*/
CRayGrid(const VistaVector3D& sourcePos, const std::vector<double>& thetaDeg, const std::vector<double>& phiDeg, const bool circularPhi = false);
CRayGrid(const VistaVector3D& sourcePos, const std::vector<double>& thetaDeg, const std::vector<double>& phiDeg, const bool circularPhi = false, const bool sortAngleVectors = true);
protected:
//! Updates the ray matrix and depenent vectors/set of rays.
......
......@@ -23,11 +23,14 @@ CRayGrid::CRayGrid(const RayMatrix& rayMatrix, const std::vector<double>& thetaD
m_v3SourcePos = m_vpRays.front()->SourcePoint();
}
CRayGrid::CRayGrid(const VistaVector3D& sourcePos, const std::vector<double>& thetaDeg, const std::vector<double>& phiDeg, const bool circularPhi /*= false*/)
CRayGrid::CRayGrid(const VistaVector3D& sourcePos, const std::vector<double>& thetaDeg, const std::vector<double>& phiDeg, const bool circularPhi /*= false*/, const bool sortAngleVectors /*= true*/)
: m_v3SourcePos(sourcePos), m_vdThetaDeg(thetaDeg), m_vdPhiDeg(phiDeg), m_bCircularPhi(circularPhi)
{
std::sort(m_vdPhiDeg.begin(), m_vdPhiDeg.end());
std::sort(m_vdThetaDeg.begin(), m_vdThetaDeg.end());
if (sortAngleVectors)
{
std::sort(m_vdPhiDeg.begin(), m_vdPhiDeg.end());
std::sort(m_vdThetaDeg.begin(), m_vdThetaDeg.end());
}
if (m_vdThetaDeg.front() < 0.0 || m_vdThetaDeg.back() > 180.0)
ITA_EXCEPT_INVALID_PARAMETER("Values for elevation angle theta are out of bounds [0, 180]");
......@@ -293,7 +296,7 @@ void CRayGrid::SetToSurroundingGrid(const std::shared_ptr<CRay> pRay)
#pragma region COPY - public
CRayGrid CRayGrid::CopyWithNewRays() const
{
return CRayGrid(m_v3SourcePos, m_vdThetaDeg, m_vdPhiDeg, m_bCircularPhi);
return CRayGrid(m_v3SourcePos, m_vdThetaDeg, m_vdPhiDeg, m_bCircularPhi, false);
}
#pragma endregion
......
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