/// Returns 2 theta (scattering angle w.r.t. to beam direction). double DetectorInfo::twoTheta(const size_t index) const { const Kernel::V3D samplePos = samplePosition(); const Kernel::V3D beamLine = samplePos - sourcePosition(); if (beamLine.nullVector()) { throw Kernel::Exception::InstrumentDefinitionError( "Source and sample are at same position!"); } return getDetector(index).getTwoTheta(samplePos, beamLine); }
/// Returns signed 2 theta (signed scattering angle w.r.t. to beam direction). double DetectorInfo::signedTwoTheta(const size_t index) const { const Kernel::V3D samplePos = samplePosition(); const Kernel::V3D beamLine = samplePos - sourcePosition(); if (beamLine.nullVector()) { throw Kernel::Exception::InstrumentDefinitionError( "Source and sample are at same position!"); } // Get the instrument up axis. const Kernel::V3D &instrumentUpAxis = m_instrument->getReferenceFrame()->vecPointingUp(); return getDetector(index) .getSignedTwoTheta(samplePos, beamLine, instrumentUpAxis); }
int Line::setLine(const Kernel::V3D &O, const Kernel::V3D &D) /** sets the line given the Origne and direction @param O :: origin @param D :: direction @retval 0 :: Direction == 0 ie no line @retval 1 :: on success */ { if (D.nullVector()) return 0; Origin = O; Direct = D; Direct.normalize(); return 1; }