Commit 186804a3 authored by Sean McBride's avatar Sean McBride Committed by Kitware Robot

Merge topic 'PI314'

bcb9573e Replaced various 3.14s with vtkMath::Pi()
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: David E. DeMarle's avatarDavid E. DeMarle <dave.demarle@kitware.com>
Merge-request: !4651
parents d7964786 bcb9573e
......@@ -23,6 +23,7 @@
#include "vtkContextScene.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkNew.h"
#include "vtkMath.h"
#include "vtkAxis.h"
......@@ -57,7 +58,7 @@ int TestChartDouble(int, char *[])
{
double x(i * inc + 0.2);
table->SetValue(i, 0, x);
table->SetValue(i, 1, 1.0e-80 * (cos(x - 1.0) + sin(x - 3.14 / 4.0)));
table->SetValue(i, 1, 1.0e-80 * (cos(x - 1.0) + sin(x - vtkMath::Pi() / 4.0)));
table->SetValue(i, 2, 1.0e-80 * sin(x) * 1e-12);
table->SetValue(i, 3, 1.0e-80 * sin(x - 1.0));
}
......
......@@ -27,6 +27,7 @@
#include "vtkRenderWindowInteractor.h"
#include "vtkNew.h"
#include "vtkAxis.h"
#include "vtkMath.h"
//----------------------------------------------------------------------------
int TestChartDoubleColors(int, char *[])
......@@ -62,7 +63,7 @@ int TestChartDoubleColors(int, char *[])
{
double x(i * inc + 0.2);
table->SetValue(i, 0, x);
table->SetValue(i, 1, 1.0e-80 * (cos(x - 1.0) + sin(x - 3.14 / 4.0)));
table->SetValue(i, 1, 1.0e-80 * (cos(x - 1.0) + sin(x - vtkMath::Pi() / 4.0)));
table->SetValue(i, 2, 1.0e-80 * sin(x) * 1e-12);
table->SetValue(i, 3, 1.0e-80 * sin(x - 1.0));
table->SetValue(i, 4, cos(i * inc));
......
......@@ -25,6 +25,7 @@
#include "vtkSmartPointer.h"
#include "vtkTable.h"
#include "vtkTextProperty.h"
#include "vtkMath.h"
#include <string>
......@@ -74,7 +75,7 @@ int TestChartUnicode(int argc, char *argv[])
for (int i = 0; i < numPoints; ++i)
{
table->SetValue(i, 0, i * inc);
table->SetValue(i, 1, cos(i * inc) + sin(i * (inc - 3.14)));
table->SetValue(i, 1, cos(i * inc) + sin(i * (inc - vtkMath::Pi())));
}
// Add multiple line plots, setting the colors etc
......
8d4cf05a07727c251f1da3a54b92b9534cac0c9bea633e6492c67356bc423e50c7b8e32ebd2922be0cdb28fe20227fec1292832a19002871a434592baf83f538
d7dcf779de9c10500f15044ef4994ccb32ce80ab1cbd6d403d9577ce6f3782d5b1dcaed928c55094a8428ec6ad09ee983a8b001bf19bd32703edf0899e80467a
......@@ -8,6 +8,7 @@
#include "vtkNew.h"
#include "vtkStdString.h"
#include "vtkVariant.h"
#include "vtkMath.h"
template<typename T, typename V>
int UnitTestScalarValueKey(vtkInformation* info, T* key, const V& val)
......@@ -134,7 +135,7 @@ int UnitTestInformationKeys(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
int ok = 1;
vtkNew<vtkInformation> info;
vtkVariant tvval("foo");
double tdval = 3.14159;
double tdval = vtkMath::Pi();
vtkStdString tsval = "bar";
vtkInformationVariantKey* tvskey =
......
......@@ -30,6 +30,7 @@ PURPOSE. See the above copyright notice for more information.
#include "vtkMeanValueCoordinatesInterpolator.h"
#include "vtkCellData.h"
#include "vtkVector.h"
#include "vtkMath.h"
#include <map>
#include <set>
......@@ -1488,16 +1489,13 @@ void CalculateAngles(const vtkIdType* tri, vtkPoints* phPoints, const vtkPointId
right.Set(p2[0] - p0[0], p2[1] - p0[1], p2[2] - p0[2]);
left.Normalize(); right.Normalize();
#define PI 3.14159265358979323846
#define TO_DEGREES (180.0/PI);
double dot = left.Dot(right);
// rounding errors can occur in the vtkVector3d::Dot function,
// clamp to [-1, 1] (i.e. the input range for the acos function)
dot = min( 1.0, dot);
dot = max(-1.0, dot);
double angle = acos(dot)*TO_DEGREES;
double angle = acos(dot)*180.0/vtkMath::Pi();
minAngle = min(angle, minAngle);
maxAngle = max(angle, maxAngle);
......
......@@ -846,7 +846,7 @@ namespace {
vtkVector3d axis(0,0,0);
axis[largest] = 1.0;
// 3 degrees of sticky
if (fabs(in.Dot(axis)) > cos(3.1415926*snapAngle/180.0))
if (fabs(in.Dot(axis)) > cos(vtkMath::Pi()*snapAngle/180.0))
{
if (in.Dot(axis) < 0)
{
......
......@@ -1141,7 +1141,7 @@ namespace {
vtkVector3d axis(0,0,0);
axis[largest] = 1.0;
// 3 degrees of sticky
if (fabs(in.Dot(axis)) > cos(3.1415926*snapAngle/180.0))
if (fabs(in.Dot(axis)) > cos(vtkMath::Pi()*snapAngle/180.0))
{
if (in.Dot(axis) < 0)
{
......
......@@ -28,6 +28,7 @@
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkSphereSource.h"
#include "vtkMath.h"
// Test for multiblock data sets with field data arrays defined on
// only a subset of the blocks. The expected behavior is to have
......@@ -61,7 +62,7 @@ int TestMultiBlockPartialArrayFieldData(int argc, char* argv[])
data->SetNumberOfBlocks(numBlocks);
double radius = 10.0;
double deltaTheta = 2.0*3.1415926 / numBlocks;
double deltaTheta = 2.0*vtkMath::Pi() / numBlocks;
for (int i = 0; i < numBlocks; ++i)
{
double theta = i * deltaTheta;
......
......@@ -26,6 +26,7 @@
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkSphereSource.h"
#include "vtkMath.h"
// Test for multiblock data sets with field data arrays defined on
// only a subset of the blocks. The expected behavior is to have
......@@ -64,7 +65,7 @@ int TestMultiBlockPartialArrayPointData(int argc, char* argv[])
data->SetNumberOfBlocks(numBlocks);
double radius = 10.0;
double deltaTheta = 2.0*3.1415926 / numBlocks;
double deltaTheta = 2.0*vtkMath::Pi() / numBlocks;
for (int i = 0; i < numBlocks; ++i)
{
double theta = i * deltaTheta;
......
......@@ -710,7 +710,7 @@ void vtkRenderWindowInteractor::RecognizeGesture(vtkCommand::EventIds event)
thresh = 15.0;
}
double pinchDistance = fabs(newDistance - originalDistance);
double rotateDistance = newDistance*3.1415926*fabs(angleDeviation)/360.0;
double rotateDistance = newDistance*vtkMath::Pi()*fabs(angleDeviation)/360.0;
double panDistance = sqrt(trans[0]*trans[0] + trans[1]*trans[1]);
if (pinchDistance > thresh
&& pinchDistance > rotateDistance
......
......@@ -51,7 +51,7 @@ public:
#if 0 // trippy mode
float inputHSV[3];
double theTime = vtkTimerLog::GetUniversalTime();
double twopi = 2.0*3.1415926;
double twopi = 2.0*vtkMath::Pi();
inputHSV[0] = sin(twopi*fmod(theTime,3.0)/3.0)/4.0 + 0.25;
inputHSV[1] = sin(twopi*fmod(theTime,4.0)/4.0)/2.0 + 0.5;
......
......@@ -94,8 +94,8 @@ vtkEDLShading::vtkEDLShading()
for (int c = 0; c < 8; c++)
{
float x, y;
x = cos(2* 3.14159 * float (c)/8.);
y = sin(2*3.14159*float(c)/8.);
x = cos(2*vtkMath::Pi()*float(c)/8.);
y = sin(2*vtkMath::Pi()*float(c)/8.);
this->EDLNeighbours[c][0] = x / sqrt(x*x+y*y);
this->EDLNeighbours[c][1] = y / sqrt(x*x+y*y);
this->EDLNeighbours[c][2] = 0.;
......
......@@ -30,6 +30,7 @@
#include "vtkOpenGLState.h"
#include "vtkOpenGLVertexArrayObject.h"
#include "vtkTextureObject.h"
#include "vtkMath.h"
#include "vtkPointFillPassFS.h"
#include "vtkTextureObjectVS.h"
......@@ -43,7 +44,7 @@ vtkPointFillPass::vtkPointFillPass()
this->Pass1=nullptr;
this->Pass1Depth=nullptr;
this->QuadHelper = nullptr;
this->MinimumCandidateAngle = 1.5*3.1415926;
this->MinimumCandidateAngle = 1.5*vtkMath::Pi();
this->CandidatePointRatio = 0.99;
}
......
Markdown is supported
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