Skip to content

Commit e5b1c67

Browse files
committed
Fix incorrect 'left of' calculation when finding nearest point
to circular string
1 parent fd3a38f commit e5b1c67

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/core/geometry/qgscircularstring.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,8 @@ double QgsCircularString::closestPointOnArc( double x1, double y1, double x2, do
873873

874874
if ( leftOf )
875875
{
876-
*leftOf = clockwise ? sqrDistance > radius : sqrDistance < radius;
876+
double sqrDistancePointToCenter = ( pt.x() - centerX ) * ( pt.x() - centerX ) + ( pt.y() - centerY ) * ( pt.y() - centerY );
877+
*leftOf = clockwise ? sqrDistancePointToCenter > radius * radius : sqrDistancePointToCenter < radius * radius;
877878
}
878879

879880
return sqrDistance;

0 commit comments

Comments
 (0)