Commit f3a01308 authored by Sean McBride's avatar Sean McBride
Browse files

BUG: fixed bug #12693, changed PI to use vtkMath pi

Change-Id: Ibbc4b63433a87892ed31d09b58b34b71116d34a9
parent ce84d11e
......@@ -101,7 +101,6 @@ using namespace std;
#define MAX_VARS 100
#define DEFAULT_LAYER_THICKNESS 10
double PI = 3.141592;
//----------------------------------------------------------------------------
......@@ -663,7 +662,7 @@ void vtkMPASReader::SetDefaults() {
this->IncludeTopography = false;
this->DoBugFix = false;
this->CenterRad = CenterLon * PI / 180.0;
this->CenterRad = CenterLon * vtkMath::DoublePi() / 180.0;
this->PointX = NULL;
this->PointY = NULL;
......@@ -1118,7 +1117,7 @@ void vtkMPASReader::ShiftLonData()
// need to shift over the point so center is at PI
if (this->PointX[j] < 0)
{
this->PointX[j] += 2*PI;
this->PointX[j] += 2*vtkMath::DoublePi();
}
}
}
......@@ -1128,18 +1127,18 @@ void vtkMPASReader::ShiftLonData()
for (int j = this->PointOffset; j < this->NumberOfPoints + this->PointOffset; j++)
{
// need to shift over the point if centerLon dictates
if (this->CenterRad < PI)
if (this->CenterRad < vtkMath::DoublePi())
{
if (this->PointX[j] > (this->CenterRad + PI))
if (this->PointX[j] > (this->CenterRad + vtkMath::DoublePi()))
{
this->PointX[j] = -((2*PI) - this->PointX[j]);
this->PointX[j] = -((2*vtkMath::DoublePi()) - this->PointX[j]);
}
}
else if (this->CenterRad > PI)
else if (this->CenterRad > vtkMath::DoublePi())
{
if (this->PointX[j] < (this->CenterRad - PI))
if (this->PointX[j] < (this->CenterRad - vtkMath::DoublePi()))
{
this->PointX[j] += 2*PI;
this->PointX[j] += 2*vtkMath::DoublePi();
}
}
}
......@@ -1162,12 +1161,12 @@ int vtkMPASReader::AddMirrorPoint(int index, double dividerX)
// add on east
if (X < dividerX)
{
X += 2*PI;
X += 2*vtkMath::DoublePi();
}
else
{
// add on west
X -= 2*PI;
X -= 2*vtkMath::DoublePi();
}
this->PointX[this->CurrentExtraPoint] = X;
......@@ -1408,8 +1407,8 @@ void vtkMPASReader::OutputPoints(bool init)
if (ProjectLatLon)
{
x = this->PointX[j] * 180.0 / PI;
y = this->PointY[j] * 180.0 / PI;
x = this->PointX[j] * 180.0 / vtkMath::DoublePi();
y = this->PointY[j] * 180.0 / vtkMath::DoublePi();
z = 0.0;
}
else
......@@ -2219,7 +2218,7 @@ void vtkMPASReader::SetCenterLon(int val)
{
vtkDebugMacro( << "SetCenterLon: set to " << CenterLon << endl);
CenterLon = val;
this->CenterRad = CenterLon * PI / 180.0;
this->CenterRad = CenterLon * vtkMath::DoublePi() / 180.0;
vtkDebugMacro( << "this->CenterRad set to " << this->CenterRad << endl);
if (ProjectLatLon)
{
......
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