Commit 05b9f407 authored by Kyle Lutz's avatar Kyle Lutz Committed by Code Review
Browse files

Merge topic 'pi-precision' into master

fa50ef90 Fix precision issues when using vtkMath::Pi()
parents 8bd0d55d fa50ef90
......@@ -15,7 +15,7 @@
#include "vtkCylindricalTransform.h"
#include "vtkObjectFactory.h"
#include "vtkMath.h"
#include <math.h>
#include <cmath>
#include <stdlib.h>
vtkStandardNewMacro(vtkCylindricalTransform);
......@@ -102,7 +102,7 @@ void vtkRectangularToCylindrical(const T inPoint[3], T outPoint[3])
else
{
// Change range to [0, 2*Pi], otherwise the same as atan2(y, x)
outPoint[1] = static_cast<T>(vtkMath::Pi() + atan2(-y, -x));
outPoint[1] = T(vtkMath::DoublePi()) + atan2(-y, -x);
}
outPoint[2] = z;
}
......
......@@ -2973,7 +2973,7 @@ int vtkMath::PointIsWithinBounds(double point[3], double bounds[6], double delta
//----------------------------------------------------------------------------
double vtkMath::GaussianAmplitude(const double variance, const double distanceFromMean)
{
return 1./(sqrt(2.*vtkMath::Pi() * variance)) * exp(-(pow(distanceFromMean,2))/(2.*variance));
return 1./(sqrt(2.*vtkMath::DoublePi() * variance)) * exp(-(pow(distanceFromMean,2))/(2.*variance));
}
//----------------------------------------------------------------------------
......
......@@ -15,7 +15,7 @@
#include "vtkSphericalTransform.h"
#include "vtkObjectFactory.h"
#include "vtkMath.h"
#include <math.h>
#include <cmath>
#include <stdlib.h>
vtkStandardNewMacro(vtkSphericalTransform);
......@@ -112,7 +112,7 @@ void vtkRectangularToSpherical(const T inPoint[3], T outPoint[3])
else
{
// Change range to [0, 2*Pi], otherwise the same as atan2(y, x)
outPoint[2] = vtkMath::Pi() + atan2(-y, -x);
outPoint[2] = T(vtkMath::DoublePi()) + atan2(-y, -x);
}
}
......
Supports Markdown
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