Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More tweaks to leftOf logic
  • Loading branch information
nyalldawson committed Nov 29, 2017
1 parent ebe16f1 commit b8a62f4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/geometry/qgslinestring.cpp
Expand Up @@ -943,7 +943,7 @@ double QgsLineString::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt,
// where we can perform the check
if ( left != 0 )
{
if ( qgsDoubleNear( testDist, leftOfDist ) && ( left < 0 ) != prevLeftOf )
if ( qgsDoubleNear( testDist, leftOfDist ) && left != prevLeftOf && prevLeftOf != 0 )
{
// we have two possible segments each with equal distance to point, but they disagree
// on whether or not the point is to the left of them.
Expand All @@ -964,6 +964,7 @@ double QgsLineString::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt,
{
*leftOf = left;
leftOfDist = testDist;
prevLeftOf = 0;
}
}
}
Expand Down

0 comments on commit b8a62f4

Please sign in to comment.