Skip to content

Commit

Permalink
Simplify code looking for closer vertex snap
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/geos/trunk@3814 5242fede-7e19-0410-aef8-94bd7d2200fb
  • Loading branch information
Sandro Santilli committed Jun 7, 2013
1 parent 6b0b7a5 commit 7421daf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/operation/overlay/snap/LineStringSnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ LineStringSnapper::findSnapForVertex(const Coordinate& pt,
{
Coordinate::ConstVect::const_iterator end = snapPts.end();
Coordinate::ConstVect::const_iterator candidate = end;
double minDist;
double minDist = snapTolerance;

// TODO: use std::find_if
for ( Coordinate::ConstVect::const_iterator
Expand All @@ -195,12 +195,10 @@ cerr << " points are equal, returning not-found " << endl;
cerr << " distance from snap point " << snapPt << ": " << dist << endl;
#endif

if ( dist < snapTolerance )
if ( dist < minDist )
{
if ( candidate == end || dist < minDist ) {
minDist = dist;
candidate = it;
}
minDist = dist;
candidate = it;
}
}

Expand Down

0 comments on commit 7421daf

Please sign in to comment.