[geos-commits] [SCM] GEOS branch master updated. 089f87756b5230b61c34648c3126b8dca9b98c32
git at osgeo.org
git at osgeo.org
Tue Jan 14 07:04:59 PST 2020
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, master has been updated
via 089f87756b5230b61c34648c3126b8dca9b98c32 (commit)
from a096c8324e78558b5fd029e8c80acc743df4acab (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 089f87756b5230b61c34648c3126b8dca9b98c32
Author: Marian Krivos <nezmar at tutok.sk>
Date: Fri Jan 10 19:00:57 2020 +0100
Rename geos::M_PI to less intrusive MATH_PI (that don't collide with standard <cmath> name
diff --git a/doc/example.cpp b/doc/example.cpp
index bc1f324..678e821 100644
--- a/doc/example.cpp
+++ b/doc/example.cpp
@@ -443,7 +443,7 @@ do_all()
geoms->push_back(create_rectangle(-5, -5, 10, 10)); // a square
geoms->push_back(create_rectangle(-5, -5, 10, 20)); // a rectangle
// The upper-right quarter of a vertical ellipse
- geoms->push_back(create_arc(0, 0, 10, 20, 0, M_PI / 2));
+ geoms->push_back(create_arc(0, 0, 10, 20, 0, MATH_PI / 2));
geoms->push_back(create_sinestar(10, 10, 100, 5, 2).release()); // a sine star
#endif
diff --git a/include/geos/constants.h b/include/geos/constants.h
index 8a07b28..7d4bb61 100644
--- a/include/geos/constants.h
+++ b/include/geos/constants.h
@@ -32,14 +32,11 @@ typedef __int64 int64;
#include <cinttypes>
-#ifdef M_PI
-#undef M_PI
-#endif
typedef int64_t int64;
namespace geos {
-constexpr double M_PI = 3.14159265358979323846;
+constexpr double MATH_PI = 3.14159265358979323846;
diff --git a/src/geom/util/SineStarFactory.cpp b/src/geom/util/SineStarFactory.cpp
index 5abcfc7..d96225c 100644
--- a/src/geom/util/SineStarFactory.cpp
+++ b/src/geom/util/SineStarFactory.cpp
@@ -65,7 +65,7 @@ SineStarFactory::createSineStar() const
// the angle for the current arm - in [0,2Pi]
// (each arm is a complete sine wave cycle)
- double armAng = 2 * M_PI * armAngFrac;
+ double armAng = 2 * MATH_PI * armAngFrac;
// the current length of the arm
double armLenFrac = (cos(armAng) + 1.0) / 2.0;
@@ -73,7 +73,7 @@ SineStarFactory::createSineStar() const
double curveRadius = insideRadius + armMaxLen * armLenFrac;
// the current angle of the curve
- double ang = i * (2 * M_PI / nPts);
+ double ang = i * (2 * MATH_PI / nPts);
double x = curveRadius * cos(ang) + centreX;
double y = curveRadius * sin(ang) + centreY;
pts[iPt++] = coord(x, y);
diff --git a/src/operation/buffer/BufferParameters.cpp b/src/operation/buffer/BufferParameters.cpp
index 852b62a..4b66a59 100644
--- a/src/operation/buffer/BufferParameters.cpp
+++ b/src/operation/buffer/BufferParameters.cpp
@@ -125,7 +125,7 @@ BufferParameters::setQuadrantSegments(int quadSegs)
double
BufferParameters::bufferDistanceError(int quadSegs)
{
- double alpha = M_PI / 2.0 / quadSegs;
+ double alpha = MATH_PI / 2.0 / quadSegs;
return 1 - cos(alpha / 2.0);
}
diff --git a/src/util/GeometricShapeFactory.cpp b/src/util/GeometricShapeFactory.cpp
index 9f5b231..3d9b234 100644
--- a/src/util/GeometricShapeFactory.cpp
+++ b/src/util/GeometricShapeFactory.cpp
@@ -161,8 +161,8 @@ GeometricShapeFactory::createArc(double startAng, double angExtent)
env.reset();
double angSize = angExtent;
- if(angSize <= 0.0 || angSize > 2 * M_PI) {
- angSize = 2 * M_PI;
+ if(angSize <= 0.0 || angSize > 2 * MATH_PI) {
+ angSize = 2 * MATH_PI;
}
double angInc = angSize / (nPts - 1);
@@ -191,8 +191,8 @@ GeometricShapeFactory::createArcPolygon(double startAng, double angExtent)
env.reset();
double angSize = angExtent;
- if(angSize <= 0.0 || angSize > 2 * M_PI) {
- angSize = 2 * M_PI;
+ if(angSize <= 0.0 || angSize > 2 * MATH_PI) {
+ angSize = 2 * MATH_PI;
}
double angInc = angSize / (nPts - 1);
diff --git a/tests/unit/capi/GEOSDistanceTest.cpp b/tests/unit/capi/GEOSDistanceTest.cpp
index 229ecba..0b8cef1 100644
--- a/tests/unit/capi/GEOSDistanceTest.cpp
+++ b/tests/unit/capi/GEOSDistanceTest.cpp
@@ -92,7 +92,7 @@ random_polygon(double x, double y, double r, size_t num_points)
for(size_t i = 0; i < num_points; i++) {
- angle[i] = 2 * geos::M_PI * std::rand() / RAND_MAX;
+ angle[i] = 2 * geos::MATH_PI * std::rand() / RAND_MAX;
radius[i] = r * std::rand() / RAND_MAX;
}
-----------------------------------------------------------------------
Summary of changes:
doc/example.cpp | 2 +-
include/geos/constants.h | 5 +----
src/geom/util/SineStarFactory.cpp | 4 ++--
src/operation/buffer/BufferParameters.cpp | 2 +-
src/util/GeometricShapeFactory.cpp | 8 ++++----
tests/unit/capi/GEOSDistanceTest.cpp | 2 +-
6 files changed, 10 insertions(+), 13 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list