Skip to content

Commit

Permalink
Refs #10828 Don't use qmath in slit calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Jeffery committed Jan 27, 2015
1 parent a221f82 commit d4f2299
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Code/Mantid/MantidQt/MantidWidgets/src/SlitCalculator.cpp
@@ -1,5 +1,5 @@
#include "MantidQtMantidWidgets/SlitCalculator.h"
#include <qmath.h>
#include <math.h>

namespace MantidQt
{
Expand All @@ -19,16 +19,15 @@ namespace MantidQt
void SlitCalculator::on_recalculate_triggered()
{
//Gather input
const double PI = 2*qAsin(1);
const double s1s2 = ui.spinSlit1Slit2->value();
const double s2sa = ui.spinSlit2Sample->value();
const double res = ui.spinResolution->value();
const double footprint = ui.spinFootprint->value();
const double angle = ui.spinAngle->value();

//Calculate values
const double s1 = 2 * (s1s2 + s2sa) * qTan(res * angle * PI / 180) - footprint * qSin(angle * PI / 180);
const double s2 = s1s2 * (footprint * qSin(angle * PI / 180) + s1) / (s1s2 + s2sa) - s1;
const double s1 = 2 * (s1s2 + s2sa) * tan(res * angle * M_PI / 180) - footprint * sin(angle * M_PI / 180);
const double s2 = s1s2 * (footprint * sin(angle * M_PI / 180) + s1) / (s1s2 + s2sa) - s1;

//Update output
ui.slit1Text->setText(QString::number(s1,'f',3));
Expand Down

0 comments on commit d4f2299

Please sign in to comment.