Commit 4f1feba6 authored by Simon Heybrock's avatar Simon Heybrock Committed by GitHub
Browse files

Merge pull request #19531 from mantidproject/FasterGetPhi

Simplify function Detector::getPhi()
parents 0cf05e40 bbb8ad5a
...@@ -92,13 +92,16 @@ double Detector::getSignedTwoTheta(const V3D &observer, const V3D &axis, ...@@ -92,13 +92,16 @@ double Detector::getSignedTwoTheta(const V3D &observer, const V3D &axis,
return angle; return angle;
} }
/// Get the phi angle between the detector with reference to the origin /** Get the phi angle between the detector with reference to the origin
///@return The angle * This function will not be supported in Instrument-2.0 due to its ambiguity.
* DO NOT USE IN NEW CODE
* @return The angle
*/
double Detector::getPhi() const { double Detector::getPhi() const {
double phi = 0.0, dummy; const Kernel::V3D pos = this->getPos();
this->getPos().getSpherical(dummy, dummy, phi); return std::atan2(pos[1], pos[0]);
return phi * M_PI / 180.0;
} }
/** /**
* Calculate the phi angle between detector and beam, and then offset. * Calculate the phi angle between detector and beam, and then offset.
* @param offset in radians * @param offset in radians
......
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