Skip to content
Snippets Groups Projects

Detector2D::indexOfSpecular newly implemented (#820)

Merged Wuttke, Joachim requested to merge i820 into main
3 files
+ 10
7
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -62,10 +62,13 @@ Pixel* Detector2D::createPixel(size_t index) const
@@ -62,10 +62,13 @@ Pixel* Detector2D::createPixel(size_t index) const
size_t Detector2D::indexOfSpecular(const Beam& beam) const
size_t Detector2D::indexOfSpecular(const Beam& beam) const
{
{
double alpha = beam.alpha_i();
const double alpha = beam.alpha_i();
double phi = beam.phi_i();
const double phi = beam.phi_i();
if (alpha + phi < 0)
return -1; // issue #820
const double u = tan(phi);
// return getGlobalIndex(
const double v = hypot(1., u * u) * tan(alpha);
 
 
if (axis(0).rangeComprises(u) && axis(1).rangeComprises(v))
 
return getGlobalIndex(axis(0).closestIndex(u), axis(1).closestIndex(v));
return totalSize();
return totalSize();
}
}
Loading