Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Christian Butz
VTK
Commits
bcb9573e
Commit
bcb9573e
authored
Sep 08, 2018
by
Sean McBride
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced various 3.14s with vtkMath::Pi()
Had to update TestChartUnicode baseline to get it passing.
parent
ac9c897b
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
23 additions
and
18 deletions
+23
-18
Charts/Core/Testing/Cxx/TestChartDouble.cxx
Charts/Core/Testing/Cxx/TestChartDouble.cxx
+2
-1
Charts/Core/Testing/Cxx/TestChartDoubleColors.cxx
Charts/Core/Testing/Cxx/TestChartDoubleColors.cxx
+2
-1
Charts/Core/Testing/Cxx/TestChartUnicode.cxx
Charts/Core/Testing/Cxx/TestChartUnicode.cxx
+2
-1
Charts/Core/Testing/Data/Baseline/TestChartUnicode.png.sha512
...ts/Core/Testing/Data/Baseline/TestChartUnicode.png.sha512
+1
-1
Common/Core/Testing/Cxx/UnitTestInformationKeys.cxx
Common/Core/Testing/Cxx/UnitTestInformationKeys.cxx
+2
-1
Common/DataModel/vtkPolyhedron.cxx
Common/DataModel/vtkPolyhedron.cxx
+2
-4
Interaction/Widgets/vtkBoxRepresentation.cxx
Interaction/Widgets/vtkBoxRepresentation.cxx
+1
-1
Interaction/Widgets/vtkImplicitPlaneRepresentation.cxx
Interaction/Widgets/vtkImplicitPlaneRepresentation.cxx
+1
-1
Rendering/Core/Testing/Cxx/TestMultiBlockPartialArrayFieldData.cxx
.../Core/Testing/Cxx/TestMultiBlockPartialArrayFieldData.cxx
+2
-1
Rendering/Core/Testing/Cxx/TestMultiBlockPartialArrayPointData.cxx
.../Core/Testing/Cxx/TestMultiBlockPartialArrayPointData.cxx
+2
-1
Rendering/Core/vtkRenderWindowInteractor.cxx
Rendering/Core/vtkRenderWindowInteractor.cxx
+1
-1
Rendering/OpenGL2/Testing/Cxx/TestUserShader2.cxx
Rendering/OpenGL2/Testing/Cxx/TestUserShader2.cxx
+1
-1
Rendering/OpenGL2/vtkEDLShading.cxx
Rendering/OpenGL2/vtkEDLShading.cxx
+2
-2
Rendering/OpenGL2/vtkPointFillPass.cxx
Rendering/OpenGL2/vtkPointFillPass.cxx
+2
-1
No files found.
Charts/Core/Testing/Cxx/TestChartDouble.cxx
View file @
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
));
}
...
...
Charts/Core/Testing/Cxx/TestChartDoubleColors.cxx
View file @
bcb9573e
...
...
@@ -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
));
...
...
Charts/Core/Testing/Cxx/TestChartUnicode.cxx
View file @
bcb9573e
...
...
@@ -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
...
...
Charts/Core/Testing/Data/Baseline/TestChartUnicode.png.sha512
View file @
bcb9573e
8d4cf05a07727c251f1da3a54b92b9534cac0c9bea633e6492c67356bc423e50c7b8e32ebd2922be0cdb28fe20227fec1292832a19002871a434592baf83f538
d7dcf779de9c10500f15044ef4994ccb32ce80ab1cbd6d403d9577ce6f3782d5b1dcaed928c55094a8428ec6ad09ee983a8b001bf19bd32703edf0899e80467a
Common/Core/Testing/Cxx/UnitTestInformationKeys.cxx
View file @
bcb9573e
...
...
@@ -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
=
...
...
Common/DataModel/vtkPolyhedron.cxx
View file @
bcb9573e
...
...
@@ -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
);
...
...
Interaction/Widgets/vtkBoxRepresentation.cxx
View file @
bcb9573e
...
...
@@ -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
)
{
...
...
Interaction/Widgets/vtkImplicitPlaneRepresentation.cxx
View file @
bcb9573e
...
...
@@ -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
)
{
...
...
Rendering/Core/Testing/Cxx/TestMultiBlockPartialArrayFieldData.cxx
View file @
bcb9573e
...
...
@@ -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
;
...
...
Rendering/Core/Testing/Cxx/TestMultiBlockPartialArrayPointData.cxx
View file @
bcb9573e
...
...
@@ -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
;
...
...
Rendering/Core/vtkRenderWindowInteractor.cxx
View file @
bcb9573e
...
...
@@ -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
...
...
Rendering/OpenGL2/Testing/Cxx/TestUserShader2.cxx
View file @
bcb9573e
...
...
@@ -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;
...
...
Rendering/OpenGL2/vtkEDLShading.cxx
View file @
bcb9573e
...
...
@@ -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.
;
...
...
Rendering/OpenGL2/vtkPointFillPass.cxx
View file @
bcb9573e
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment