Skip to content

Commit b8a62f4

Browse files
committedNov 29, 2017
More tweaks to leftOf logic
1 parent ebe16f1 commit b8a62f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/core/geometry/qgslinestring.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ double QgsLineString::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt,
943943
// where we can perform the check
944944
if ( left != 0 )
945945
{
946-
if ( qgsDoubleNear( testDist, leftOfDist ) && ( left < 0 ) != prevLeftOf )
946+
if ( qgsDoubleNear( testDist, leftOfDist ) && left != prevLeftOf && prevLeftOf != 0 )
947947
{
948948
// we have two possible segments each with equal distance to point, but they disagree
949949
// on whether or not the point is to the left of them.
@@ -964,6 +964,7 @@ double QgsLineString::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt,
964964
{
965965
*leftOf = left;
966966
leftOfDist = testDist;
967+
prevLeftOf = 0;
967968
}
968969
}
969970
}

0 commit comments

Comments
 (0)
Please sign in to comment.