Skip to content

Commit 034c7db

Browse files
committed
Make sure the curve point is always on the segmentized curve
1 parent e6f1439 commit 034c7db

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/core/geometry/qgscircularstringv2.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,21 @@ void QgsCircularStringV2::segmentize( const QgsPointV2& p1, const QgsPointV2& p2
537537
if ( hasM )
538538
pointWkbType = QgsWKBTypes::addM( pointWkbType );
539539

540+
//make sure the curve point p2 is part of the segmentized vertices. But only if p1 != p3
541+
bool addP2 = true;
542+
if ( qgsDoubleNear( p1.x(), p3.x() ) && qgsDoubleNear( p1.y(), p3.y() ) )
543+
{
544+
addP2 = false;
545+
}
546+
540547
for ( double angle = a1 + increment; clockwise ? angle > a3 : angle < a3; angle += increment )
541548
{
549+
if (( addP2 && clockwise && angle < a2 ) || ( addP2 && !clockwise && angle > a2 ) )
550+
{
551+
points.append( p2 );
552+
addP2 = false;
553+
}
554+
542555
x = centerX + radius * cos( angle );
543556
y = centerY + radius * sin( angle );
544557

0 commit comments

Comments
 (0)