Skip to content

Commit 203f975

Browse files
committed
Change full circle interpretation, fixes #15116
1 parent 3b1d4e2 commit 203f975

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/core/geometry/qgscircularstringv2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ void QgsCircularStringV2::sumUpArea( double& sum ) const
879879
//segment is a full circle, p2 is the center point
880880
if ( p1 == p3 )
881881
{
882-
double r2 = QgsGeometryUtils::sqrDistance2D( p1, p2 );
882+
double r2 = QgsGeometryUtils::sqrDistance2D( p1, p2 ) / 2.0;
883883
sum += M_PI * r2;
884884
continue;
885885
}

src/core/geometry/qgsgeometryutils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ void QgsGeometryUtils::circleCenterRadius( const QgsPointV2& pt1, const QgsPoint
359359
//closed circle
360360
if ( qgsDoubleNear( pt1.x(), pt3.x() ) && qgsDoubleNear( pt1.y(), pt3.y() ) )
361361
{
362-
centerX = pt2.x();
363-
centerY = pt2.y();
364-
radius = sqrt( pow( pt2.x() - pt1.x(), 2.0 ) + pow( pt2.y() - pt1.y(), 2.0 ) );
362+
centerX = ( pt1.x() + pt2.x() ) / 2.0;
363+
centerY = ( pt1.y() + pt2.y() ) / 2.0;
364+
radius = sqrt( pow( centerX - pt1.x(), 2.0 ) + pow( centerY - pt1.y(), 2.0 ) );
365365
return;
366366
}
367367

0 commit comments

Comments
 (0)