...
 
Commits (2)
  • Philipp Schäfer's avatar
    ART · 31172913
    Philipp Schäfer authored
    - added semi colons behind inline functions
    31172913
  • Philipp Schäfer's avatar
    ART · f1da5c4b
    Philipp Schäfer authored
    - changed shared_ptr<CRay>& to shared_ptr<CRay>
    f1da5c4b
......@@ -56,11 +56,11 @@ namespace ITAPropagationPathSim
const std::set< std::shared_ptr<CRay> >& NewRaysOfLastAdaptation() const { return vpNewRaysOfLastAdaptation; }
//! Simple adaptation method: Setting the limits to neighboring rays and shoots additional rays to double the angular resolution of the grid.
void ZoomIntoRay(const std::shared_ptr<CRay>& pRay);
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);
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);
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
......@@ -76,7 +76,7 @@ namespace ITAPropagationPathSim
*
* Also works for a 1D ray grid (NTheta == 1 or NPhi() == 1)
*/
void SetAdvancedRayGridLimits(const std::shared_ptr<CRay>& pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold);
void SetAdvancedRayGridLimits(const std::shared_ptr<CRay> pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold);
//! By comparing the vector from three rays to the receiver, this decides between which two rays the eigenray is located and returns their indices
std::vector<int> FindAdvancedRayGridLimits1D(const std::vector< std::shared_ptr<CRay> >& pRays, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold) const;
void DoubleRayResolution();
......
......@@ -60,7 +60,7 @@ namespace ITAPropagationPathSim
CRayGrid(const RayMatrix& rayMatrix, const std::vector<double>& thetaDeg, const std::vector<double>& phiDeg, const bool circularPhi = false);
void UpdateDependentRayContainers();
protected:
inline CRayGrid(bool circularPhi = false) : bCircularPhi(circularPhi) {}
inline CRayGrid(bool circularPhi = false) : bCircularPhi(circularPhi) {};
//! Creates new rays using the angles of initial directions and inserts them into the ray matrix
void InitRays();
public:
......@@ -78,41 +78,41 @@ namespace ITAPropagationPathSim
void FilterDirections(const std::vector<int>& thetaIdxVec, const std::vector<int>& phiIdxVec, const bool circularPhi = false);
//! Returns a vector with all rays having the same initial elevation as the given ray. Throws an exception if the ray is not part of this grid.
const RayVector& GetRaysWithSameTheta(const std::shared_ptr<CRay>& pRay);
const RayVector& GetRaysWithSameTheta(const std::shared_ptr<CRay> pRay);
//! Returns a vector with all rays having the same initial azimuth as the given ray. Throws an exception if the ray is not part of this grid.
RayVector GetRaysWithSamePhi(const std::shared_ptr<CRay>& pRay);
RayVector GetRaysWithSamePhi(const std::shared_ptr<CRay> pRay);
//---Indicing Functions---
protected:
int GetIndex(const std::shared_ptr<CRay>& pRay) const;
int GetIndex(const std::shared_ptr<CRay> pRay) const;
int IndexToThetaIndex(const int idx) const;
int IndexToPhiIndex(const int idx) const;
void GetNeighboringAngleIndices(const std::shared_ptr<CRay>& pRay, std::vector<int>& thetaIdxVec, std::vector<int>& phiIdxVec) const;
void GetNeighboringAngleIndices(const std::shared_ptr<CRay> pRay, std::vector<int>& thetaIdxVec, std::vector<int>& phiIdxVec) const;
//---Booleans---
protected:
bool IsPoleDirection(const double& thetaDeg) const;
bool HasPoleDirection(const std::shared_ptr<CRay>& pRay) const;
bool HasPoleDirection(const std::shared_ptr<CRay> pRay) const;
public:
//! Returns true if the phi angles are defined circular (covering a full circle)
inline bool IsCircular() const { return bCircularPhi; }
inline bool IsCircular() const { return bCircularPhi; };
bool IsEmpty() const;
bool Is2D() const;
bool Contains(const std::shared_ptr<CRay>& pRay) const;
bool Contains(const std::shared_ptr<CRay> pRay) const;
//---GET Functions---
protected:
inline const std::vector<std::shared_ptr<CRay>>& Rays() const { return vpRays; }
inline const RayMatrix& Matrix() const { return vvpRayMatrix; }
inline const std::vector<std::shared_ptr<CRay>>& Rays() const { return vpRays; };
inline const RayMatrix& Matrix() const { return vvpRayMatrix; };
public:
inline const std::vector<double>& ThetaDeg() const { return vdThetaDeg; }
inline const std::vector<double>& PhiDeg() const { return vdPhiDeg; }
inline int NTheta() const { return vdThetaDeg.size(); }
inline int NPhi() const { return vdPhiDeg.size(); }
inline int NRays() const { return vpRays.size(); }
inline const VistaVector3D& SourcePosition() const { return v3SourcePos; }
inline const std::set<std::shared_ptr<CRay>>& UniqueRays() const { return vpUniqueRays; }
inline const std::shared_ptr<CRay>& At(int idxTheta, int idxPhi) const { return vvpRayMatrix[idxTheta][idxPhi]; }
inline const std::vector<double>& ThetaDeg() const { return vdThetaDeg; };
inline const std::vector<double>& PhiDeg() const { return vdPhiDeg; };
inline int NTheta() const { return vdThetaDeg.size(); };
inline int NPhi() const { return vdPhiDeg.size(); };
inline int NRays() const { return vpRays.size(); };
inline const VistaVector3D& SourcePosition() const { return v3SourcePos; };
inline const std::set<std::shared_ptr<CRay>>& UniqueRays() const { return vpUniqueRays; };
inline const std::shared_ptr<CRay> At(int idxTheta, int idxPhi) const { return vvpRayMatrix[idxTheta][idxPhi]; };
//! Calculates and returns an approximation for the surface area of the wavefront at given time by spanning triangles between rays
double WavefrontSurface(const double& time) const;
......@@ -123,12 +123,12 @@ namespace ITAPropagationPathSim
/**
* Throws an exception if the given ray is not part of this ray grid.
*/
CRayGrid SurroundingGrid(const std::shared_ptr<CRay>& pRay) const;
CRayGrid SurroundingGrid(const std::shared_ptr<CRay> pRay) const;
//! Sets the boundaries of this ray grid to the rays surrounding the given ray (including this ray).
/**
* Throws an exception if the given ray is not part of this ray grid.
*/
void SetToSurroundingGrid(const std::shared_ptr<CRay>& pRay);
void SetToSurroundingGrid(const std::shared_ptr<CRay> pRay);
//! Creates a ray grid with the same initial ray directions but new rays
CRayGrid CopyWithNewRays() const;
......
......@@ -40,14 +40,14 @@ namespace ITAPropagationPathSim
VistaVector3D wavefrontNormal;
double timeStamp;
inline CRayElement() {}
inline CRayElement(const VistaVector3D& r, const VistaVector3D& n, const double& time) : position(r), wavefrontNormal(n), timeStamp(time) {}
inline CRayElement() {};
inline CRayElement(const VistaVector3D& r, const VistaVector3D& n, const double& time) : position(r), wavefrontNormal(n), timeStamp(time) {};
//! Does a linear interpolation from this element to the given one using a factor [0.0 1.0] and returns the new element.
CRayElement Interpolate(const CRayElement& target, const float fFraction) const;
};
//! Compares the timestamps of given CRayElements using the < operator
inline bool operator<(const CRayElement& lhs, const CRayElement& rhs) { return lhs.timeStamp < rhs.timeStamp; }
inline bool operator<(const CRayElement& lhs, const CRayElement& rhs) { return lhs.timeStamp < rhs.timeStamp; };
class ITA_PROPAGATION_PATH_SIM_API CRayReceiverData {
public:
......@@ -56,8 +56,8 @@ namespace ITAPropagationPathSim
int reflectionOrder;
VistaVector3D posMinDist;
inline CRayReceiverData() : idxMinDist(-1), distance(-1), reflectionOrder(-1), posMinDist(VistaVector3D()) {}
inline CRayReceiverData(int iMin, float dMin, int reflOrder, const VistaVector3D& rMin = VistaVector3D()) : idxMinDist(iMin), distance(dMin), reflectionOrder(reflOrder), posMinDist(rMin) {}
inline CRayReceiverData() : idxMinDist(-1), distance(-1), reflectionOrder(-1), posMinDist(VistaVector3D()) {};
inline CRayReceiverData(int iMin, float dMin, int reflOrder, const VistaVector3D& rMin = VistaVector3D()) : idxMinDist(iMin), distance(dMin), reflectionOrder(reflOrder), posMinDist(rMin) {};
};
class ITA_PROPAGATION_PATH_SIM_API CRay : public std::vector<CRayElement>
......@@ -78,29 +78,29 @@ namespace ITAPropagationPathSim
public:
#pragma region Get Functions
const std::vector<int>& ReflectionIndices() const { return iReflectionIndices; }
const std::vector<int>& ReflectionIndices() const { return iReflectionIndices; };
int NumPoints() const { return size(); }
const VistaVector3D& SourcePoint() const { return front().position; }
const VistaVector3D& InitialDirection() const { return front().wavefrontNormal; }
inline int NumPoints() const { return size(); }
inline const VistaVector3D& SourcePoint() const { return front().position; };
inline const VistaVector3D& InitialDirection() const { return front().wavefrontNormal; };
const VistaVector3D& LastPoint() const { return back().position; }
const VistaVector3D& LastWavefrontNormal() const { return back().wavefrontNormal; }
const double& LastTimeStamp() const { return back().timeStamp; }
inline const VistaVector3D& LastPoint() const { return back().position; };
inline const VistaVector3D& LastWavefrontNormal() const { return back().wavefrontNormal; };
inline const double& LastTimeStamp() const { return back().timeStamp; };
int ReflectionOrder() const { return iReflectionIndices.size(); }
inline int ReflectionOrder() const { return iReflectionIndices.size(); };
//! Returns the reflection order of the ray element with given index
int ReflectionOrder(const int idx) const;
//! Returns the spreading loss at end point of receiver. If this has not been calculated yet, this returns -1.
inline double SpreadingLoss() const { return dSpreadingLoss; }
inline double SpreadingLoss() const { return dSpreadingLoss; };
#pragma endregion
//! Appends a new element with position, wavefront normal and timestamp to the ray
void Append(const VistaVector3D& position, const VistaVector3D& wavefrontNormal, const double& timeStamp);
//! Appends a new element to the ray and adds its index to iReflectionIndices
void AppendReflection(const VistaVector3D& position, const VistaVector3D& wavefrontNormal, const double& timeStamp);
inline void SetSpreadingLoss(const double& spreadingLoss) { dSpreadingLoss = spreadingLoss; }
inline void SetSpreadingLoss(const double& spreadingLoss) { dSpreadingLoss = spreadingLoss; };
//! Returns true, if both rays have the same initial direction
bool SameDirection(const CRay& other) const;
......
......@@ -8,7 +8,7 @@ using namespace ITAPropagationPathSim::AtmosphericRayTracing;
using namespace ITAPropagationPathSim::AtmosphericRayTracing::EigenraySearch;
#pragma region CONSTRUCTOR / INITIATION
inline EigenraySearch::CAdaptiveRayGrid::CAdaptiveRayGrid(const CRayGrid& rayGrid) : CRayGrid(rayGrid)
EigenraySearch::CAdaptiveRayGrid::CAdaptiveRayGrid(const CRayGrid& rayGrid) : CRayGrid(rayGrid)
{
if (rayGrid.UniqueRays().size() <= 1)
ITA_EXCEPT_INVALID_PARAMETER("Ray Grid must atleast contain 2 unique rays");
......@@ -47,7 +47,7 @@ void CAdaptiveRayGrid::Reset(const CRayGrid& rayGrid)
#pragma region RAY ZOOMING - public
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pRay)
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay> pRay)
{
if(!Contains(pRay))
ITA_EXCEPT_INVALID_PARAMETER("Given ray is not part of the adaptive ray grid.");
......@@ -56,7 +56,7 @@ void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pRay)
DoubleRayResolution();
}
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold)
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay> pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold)
{
if (!Contains(pRay))
ITA_EXCEPT_INVALID_PARAMETER("Given ray is not part of the adapted grid.");
......@@ -66,7 +66,7 @@ void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pRay, const int
DoubleRayResolution();
}
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pZoomRay, const double& deltaTheta, const double& deltaPhi)
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay> pZoomRay, const double& deltaTheta, const double& deltaPhi)
{
const int idx = GetIndex(pZoomRay);
if (idx < 0)
......@@ -118,7 +118,7 @@ void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pZoomRay, const
#pragma endregion
#pragma region NEW RAY LIMITS - private
void CAdaptiveRayGrid::SetAdvancedRayGridLimits(const std::shared_ptr<CRay>& pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold)
void CAdaptiveRayGrid::SetAdvancedRayGridLimits(const std::shared_ptr<CRay> pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold)
{
if (NPhi() > 3) // There can be more than three rays if pRay is located at a pole
return;
......
......@@ -129,7 +129,7 @@ void CRayGrid::FilterDirections(const std::vector<int>& thetaIdxVec, const std::
UpdateDependentRayContainers();
}
const CRayGrid::RayVector& CRayGrid::GetRaysWithSameTheta(const std::shared_ptr<CRay>& pRay)
const CRayGrid::RayVector& CRayGrid::GetRaysWithSameTheta(const std::shared_ptr<CRay> pRay)
{
const int idxTheta = IndexToThetaIndex( GetIndex(pRay) );
if (idxTheta < 0)
......@@ -137,7 +137,7 @@ const CRayGrid::RayVector& CRayGrid::GetRaysWithSameTheta(const std::shared_ptr<
return vvpRayMatrix[idxTheta];
}
CRayGrid::RayVector CRayGrid::GetRaysWithSamePhi(const std::shared_ptr<CRay>& pRay)
CRayGrid::RayVector CRayGrid::GetRaysWithSamePhi(const std::shared_ptr<CRay> pRay)
{
const int idxPhi = IndexToPhiIndex(GetIndex(pRay));
if (idxPhi < 0)
......@@ -163,14 +163,14 @@ inline float DeterminantCofactor(const float matrix[][3], const int idx1, const
else
cofactor = -(-matrix[(idx1 + 1) % 3][(idx2 + 1) % 3] * matrix[(idx1 + 2) % 3][(idx2 + 2) % 3] + matrix[(idx1 + 1) % 3][(idx2 + 2) % 3] * matrix[(idx1 + 2) % 3][(idx2 + 1) % 3]);
return cofactor;
}
};
inline float Determinant(const float matrix[][3])
{
const float x = matrix[0][0] * DeterminantCofactor(matrix, 0, 0);
const float y = matrix[0][1] * DeterminantCofactor(matrix, 0, 1);
const float z = matrix[0][2] * DeterminantCofactor(matrix, 0, 2);
return x + y + z;
}
};
inline double SurfaceAreaOfRayTriangle(const std::vector<std::shared_ptr<CRay>>& rays, const double& time)
{
VistaVector3D p0 = rays[0]->AtTime(time).position;
......@@ -186,7 +186,7 @@ inline double SurfaceAreaOfRayTriangle(const std::vector<std::shared_ptr<CRay>>&
const float detZX = Determinant(matrixZX);
return 0.5 * std::sqrtf(detXY * detXY + detYZ * detYZ + detZX * detZX);
}
};
//---CLASS METHODS ---
//--------------------
......@@ -256,7 +256,7 @@ double CRayGrid::WavefrontSurfaceReference() const
// --- NEIGHBORING RAYS ---
// ------------------------
#pragma region NEIGHBORING RAYS - public
CRayGrid CRayGrid::SurroundingGrid(const std::shared_ptr<CRay>& pRay) const
CRayGrid CRayGrid::SurroundingGrid(const std::shared_ptr<CRay> pRay) const
{
if (!Contains(pRay))
ITA_EXCEPT_INVALID_PARAMETER("Given ray is not part of this ray grid.");
......@@ -284,7 +284,7 @@ CRayGrid CRayGrid::SurroundingGrid(const std::shared_ptr<CRay>& pRay) const
return CRayGrid(newRayMatrix, newThetaDeg, newPhiDeg, newGridHasCircularPhi);
}
void CRayGrid::SetToSurroundingGrid(const std::shared_ptr<CRay>& pRay)
void CRayGrid::SetToSurroundingGrid(const std::shared_ptr<CRay> pRay)
{
*this = SurroundingGrid(pRay);
}
......@@ -303,7 +303,7 @@ CRayGrid CRayGrid::CopyWithNewRays() const
// -------------------------
#pragma region INDICING - protected
int CRayGrid::GetIndex(const std::shared_ptr<CRay>& pRay) const
int CRayGrid::GetIndex(const std::shared_ptr<CRay> pRay) const
{
auto it = std::find(vpRays.cbegin(), vpRays.cend(), pRay);
if (it == vpRays.cend())
......@@ -326,7 +326,7 @@ int CRayGrid::IndexToPhiIndex(const int idx) const
return idx % NPhi();
}
void CRayGrid::GetNeighboringAngleIndices(const std::shared_ptr<CRay>& pRay, std::vector<int>& thetaIdxVec, std::vector<int>& phiIdxVec) const
void CRayGrid::GetNeighboringAngleIndices(const std::shared_ptr<CRay> pRay, std::vector<int>& thetaIdxVec, std::vector<int>& phiIdxVec) const
{
thetaIdxVec.clear();
phiIdxVec.clear();
......@@ -368,13 +368,13 @@ bool CRayGrid::IsPoleDirection(const double& thetaDeg) const
return abs(thetaDeg) < DBL_EPSILON || abs(thetaDeg - 180.0) < DBL_EPSILON;
}
bool CRayGrid::HasPoleDirection(const std::shared_ptr<CRay>& pRay) const
bool CRayGrid::HasPoleDirection(const std::shared_ptr<CRay> pRay) const
{
const VistaVector3D n0 = pRay->InitialDirection();
return abs(n0[Vista::X]) < FLT_EPSILON && abs(n0[Vista::Y]) < FLT_EPSILON; //x- and y- component are zero
}
inline bool CRayGrid::IsEmpty() const
bool CRayGrid::IsEmpty() const
{
return NTheta() == 0 || NPhi() == 0;
}
......@@ -384,7 +384,7 @@ bool CRayGrid::Is2D() const
return NTheta() > 1 && NPhi() > 1;
}
inline bool CRayGrid::Contains(const std::shared_ptr<CRay>& pRay) const
bool CRayGrid::Contains(const std::shared_ptr<CRay> pRay) const
{
return std::find(vpRays.cbegin(), vpRays.cend(), pRay) != vpRays.cend();
}
......
......@@ -164,7 +164,7 @@ inline VistaVector3D ClosestPointOnLineSegmentToReceiver(const VistaVector3D& se
const float dP1R = (segmentP1 - receiverPoint).GetLength();
const float dP2R = (segmentP2 - receiverPoint).GetLength();
return dP1R <= dP2R ? segmentP1 : segmentP2; // Return point of segment with minimum distance
}
};
void CRay::InterpolateToRealMinimumPosition(const VistaVector3D& receiverPos)
{
int& iMinReceiverDistance = mReceiverDistanceMap[&receiverPos].idxMinDist;
......