Skip to content
Snippets Groups Projects
Commit 4ddf862d authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Core: reuse our own code: Rectangular::getPosition

parent c4e2eebf
No related branches found
No related tags found
No related merge requests found
...@@ -35,14 +35,12 @@ RectangularPixel* RectangularPixel::clone() const ...@@ -35,14 +35,12 @@ RectangularPixel* RectangularPixel::clone() const
RectangularPixel* RectangularPixel::createZeroSizePixel(double x, double y) const RectangularPixel* RectangularPixel::createZeroSizePixel(double x, double y) const
{ {
kvector_t position = m_corner_pos + x * m_width + y * m_height; return new RectangularPixel(getPosition(x, y), kvector_t(), kvector_t());
kvector_t null_vector;
return new RectangularPixel(position, null_vector, null_vector);
} }
kvector_t RectangularPixel::getK(double x, double y, double wavelength) const kvector_t RectangularPixel::getK(double x, double y, double wavelength) const
{ {
kvector_t direction = m_corner_pos + x * m_width + y * m_height; kvector_t direction = getPosition(x, y);
double length = M_TWOPI / wavelength; double length = M_TWOPI / wavelength;
return normalizeLength(direction, length); return normalizeLength(direction, length);
} }
...@@ -56,7 +54,7 @@ double RectangularPixel::getIntegrationFactor(double x, double y) const ...@@ -56,7 +54,7 @@ double RectangularPixel::getIntegrationFactor(double x, double y) const
{ {
if (m_solid_angle == 0.0) if (m_solid_angle == 0.0)
return 1.0; return 1.0;
kvector_t position = m_corner_pos + x * m_width + y * m_height; kvector_t position = getPosition(x, y);
double length = position.mag(); double length = position.mag();
return std::abs(position.dot(m_normal)) / std::pow(length, 3) / m_solid_angle; return std::abs(position.dot(m_normal)) / std::pow(length, 3) / m_solid_angle;
} }
...@@ -73,7 +71,7 @@ kvector_t RectangularPixel::normalizeLength(const kvector_t direction, double le ...@@ -73,7 +71,7 @@ kvector_t RectangularPixel::normalizeLength(const kvector_t direction, double le
double RectangularPixel::calculateSolidAngle() const double RectangularPixel::calculateSolidAngle() const
{ {
kvector_t position = m_corner_pos + 0.5 * m_width + 0.5 * m_height; kvector_t position = getPosition(0.5, 0.5);
double length = position.mag(); double length = position.mag();
return std::abs(position.dot(m_normal)) / std::pow(length, 3); return std::abs(position.dot(m_normal)) / std::pow(length, 3);
} }
...@@ -6690,7 +6690,7 @@ Returns vector of unmasked detector indices. ...@@ -6690,7 +6690,7 @@ Returns vector of unmasked detector indices.
Create an IPixel for the given OutputData object and index. Create an IPixel for the given OutputData object and index.
"; ";
   
%feature("docstring") IDetector2D::getIndexOfSpecular "virtual size_t IDetector2D::getIndexOfSpecular(const Beam &beam) const =0 %feature("docstring") IDetector2D::indexOfSpecular "virtual size_t IDetector2D::indexOfSpecular(const Beam &beam) const =0
   
Returns index of pixel that contains the specular wavevector. If no pixel contains this specular wavevector, the number of pixels is returned. This corresponds to an overflow index. Returns index of pixel that contains the specular wavevector. If no pixel contains this specular wavevector, the number of pixels is returned. This corresponds to an overflow index.
"; ";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment