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

ART - RayGrid

- changed a few functions to be protected and added inline keywords
- added protected get method for ray matrix
- fixed bug where a float was tested with double epsilon
- added function to check for pole direction using a theta angle
parent 60540778
......@@ -78,27 +78,33 @@ namespace ITAPropagationPathSim
//! 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);
//---Helper Functions---
private:
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;
//---Booleans---
protected:
bool IsPoleDirection(const double& thetaDeg) const;
bool HasPoleDirection(const std::shared_ptr<CRay>& pRay) const;
public:
inline bool IsEmpty() const { return NTheta() == 0 || NPhi() == 0; }
inline bool Contains(const std::shared_ptr<CRay>& pRay) const { return std::find(vpRays.cbegin(), vpRays.cend(), pRay) == vpRays.cend(); }
//---GET Functions---
protected:
const std::vector<std::shared_ptr<CRay>>& Rays() const { return vpRays; }
inline const std::vector<std::shared_ptr<CRay>>& Rays() const { return vpRays; }
inline const RayMatrix& Matrix() const { return vvpRayMatrix; }
public:
const std::vector<double>& ThetaDeg() const { return vdThetaDeg; }
const std::vector<double>& PhiDeg() const { return vdPhiDeg; }
int NTheta() const { return vdThetaDeg.size(); }
int NPhi() const { return vdPhiDeg.size(); }
int NRays() const { return vpRays.size(); }
const VistaVector3D& SourcePosition() const { return v3SourcePos; }
std::set<std::shared_ptr<CRay>> UniqueRays() const { return vpUniqueRays; }
bool IsEmpty() const { return NTheta() == 0 || NPhi() == 0; }
bool Contains(const std::shared_ptr<CRay>& pRay) const { return std::find(vpRays.cbegin(), vpRays.cend(), pRay) == vpRays.cend(); }
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 std::set<std::shared_ptr<CRay>> UniqueRays() const { return vpUniqueRays; }
//! Returns a ray grid containing the rays surrounding the given ray (including this ray).
/**
......
......@@ -249,8 +249,13 @@ void CRayGrid::GetNeighboringAngleIndices(const std::shared_ptr<CRay>& pRay, std
}
#pragma endregion
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
{
const VistaVector3D n0 = pRay->InitialDirection();
return abs(n0[Vista::X]) < DBL_EPSILON && abs(n0[Vista::Y]) < DBL_EPSILON; //x- and y- component are zero
return abs(n0[Vista::X]) < FLT_EPSILON && abs(n0[Vista::Y]) < FLT_EPSILON; //x- and y- component are zero
}
\ No newline at end of file
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