[geos-commits] [SCM] GEOS branch master updated. 23a581b295756c030ba5de3f8168663aff20759f
git at osgeo.org
git at osgeo.org
Sun Sep 15 12:38:08 PDT 2019
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 23a581b295756c030ba5de3f8168663aff20759f (commit)
via bc739b48403bd962de630f82ff5f559bf47fada6 (commit)
from a6edac73e4c958d27369f8750133cab1c453275d (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 23a581b295756c030ba5de3f8168663aff20759f
Author: Daniel Baston <dbaston at gmail.com>
Date: Sun Sep 15 15:31:19 2019 -0400
Avoid unneeded Coordinate copies in MinimumBoundingCircle
diff --git a/src/algorithm/MinimumBoundingCircle.cpp b/src/algorithm/MinimumBoundingCircle.cpp
index a689541..5227d73 100644
--- a/src/algorithm/MinimumBoundingCircle.cpp
+++ b/src/algorithm/MinimumBoundingCircle.cpp
@@ -252,13 +252,13 @@ MinimumBoundingCircle::computeCirclePoints()
Coordinate
MinimumBoundingCircle::lowestPoint(std::vector<Coordinate>& pts)
{
- Coordinate min = pts[0];
- for(auto pt : pts) {
- if(pt.y < min.y) {
- min = pt;
+ const Coordinate* min = &(pts[0]);
+ for(const auto& pt : pts) {
+ if(pt.y < min->y) {
+ min = &pt;
}
}
- return min;
+ return *min;
}
@@ -269,7 +269,7 @@ MinimumBoundingCircle::pointWitMinAngleWithX(std::vector<Coordinate>& pts, Coord
double minSin = std::numeric_limits<double>::max();
Coordinate minAngPt;
minAngPt.setNull();
- for(auto p : pts) {
+ for(const auto& p : pts) {
if(p == P) {
continue;
@@ -300,9 +300,9 @@ Coordinate
MinimumBoundingCircle::pointWithMinAngleWithSegment(std::vector<Coordinate>& pts, Coordinate& P, Coordinate& Q)
{
double minAng = std::numeric_limits<double>::max();
- Coordinate minAngPt;
- minAngPt.setNull();
- for(auto p : pts) {
+ const Coordinate* minAngPt = nullptr;
+
+ for(const auto& p : pts) {
if(p == P) {
continue;
}
@@ -313,10 +313,10 @@ MinimumBoundingCircle::pointWithMinAngleWithSegment(std::vector<Coordinate>& pts
double ang = Angle::angleBetween(P, p, Q);
if(ang < minAng) {
minAng = ang;
- minAngPt = p;
+ minAngPt = &p;
}
}
- return minAngPt;
+ return *minAngPt;
}
commit bc739b48403bd962de630f82ff5f559bf47fada6
Author: Daniel Baston <dbaston at gmail.com>
Date: Sun Sep 15 15:37:02 2019 -0400
Fix typo in a6edac73
Caused test failure in MinimumDiameter
diff --git a/src/algorithm/MinimumDiameter.cpp b/src/algorithm/MinimumDiameter.cpp
index e53ef17..9aa73bc 100644
--- a/src/algorithm/MinimumDiameter.cpp
+++ b/src/algorithm/MinimumDiameter.cpp
@@ -155,7 +155,7 @@ void
MinimumDiameter::computeMinimumDiameter()
{
// check if computation is cached
- if(minWidthPt.isNull()) {
+ if(!minWidthPt.isNull()) {
return;
}
if(isConvex) {
-----------------------------------------------------------------------
Summary of changes:
src/algorithm/MinimumBoundingCircle.cpp | 22 +++++++++++-----------
src/algorithm/MinimumDiameter.cpp | 2 +-
2 files changed, 12 insertions(+), 12 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list