Skip to content
Permalink
Browse files

Fix incorrect vertexAngle calculation for circular strings

Angle was always perpendicular to the tangent, instead of
tangential to the curve
  • Loading branch information
nyalldawson committed Sep 19, 2017
1 parent 0fba03f commit bb3170f5574329721149cd3ecb9bca7f32304c69
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/core/geometry/qgsgeometryutils.cpp
@@ -617,14 +617,18 @@ double QgsGeometryUtils::circleTangentDirection( const QgsPoint &tangentPoint, c
double p1Angle = QgsGeometryUtils::ccwAngle( cp1.y() - mY, cp1.x() - mX );
double p2Angle = QgsGeometryUtils::ccwAngle( cp2.y() - mY, cp2.x() - mX );
double p3Angle = QgsGeometryUtils::ccwAngle( cp3.y() - mY, cp3.x() - mX );
double angle = 0;
if ( circleClockwise( p1Angle, p2Angle, p3Angle ) )
{
return lineAngle( tangentPoint.x(), tangentPoint.y(), mX, mY );
angle = lineAngle( tangentPoint.x(), tangentPoint.y(), mX, mY ) - M_PI_2;
}
else
{
return lineAngle( mX, mY, tangentPoint.x(), tangentPoint.y() );
angle = lineAngle( mX, mY, tangentPoint.x(), tangentPoint.y() ) - M_PI_2;
}
if ( angle < 0 )
angle += 2 * M_PI;
return angle;
}

void QgsGeometryUtils::segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3, QgsPointSequence &points, double tolerance, QgsAbstractGeometry::SegmentationToleranceType toleranceType, bool hasZ, bool hasM )

0 comments on commit bb3170f

Please sign in to comment.
You can’t perform that action at this time.