diff --git a/common/geometry/shape_arc.cpp b/common/geometry/shape_arc.cpp index 136223d58d..a3b7959a08 100644 --- a/common/geometry/shape_arc.cpp +++ b/common/geometry/shape_arc.cpp @@ -256,7 +256,11 @@ const SHAPE_LINE_CHAIN SHAPE_ARC::ConvertToPolyline( double aAccuracy ) const for( int i = 0; i <= n ; i++ ) { - double a = sa + m_centralAngle * (double) i / (double) n; + double a = sa; + + if( n != 0 ) + sa += m_centralAngle * (double) i / (double) n; + double x = c.x + r * cos( a * M_PI / 180.0 ); double y = c.y + r * sin( a * M_PI / 180.0 ); diff --git a/qa/common/geometry/test_shape_arc.cpp b/qa/common/geometry/test_shape_arc.cpp index 9e3f6342d5..ee18dc8d37 100644 --- a/qa/common/geometry/test_shape_arc.cpp +++ b/qa/common/geometry/test_shape_arc.cpp @@ -314,10 +314,8 @@ bool ArePolylinePointsNearCircle( return GEOM_TEST::ArePointsNearCircle( points, aCentre, aRad, aTolEnds ); } -#ifdef HAVE_EXPECTED_FAILURES -// Failure in zero-radius case -BOOST_AUTO_TEST_CASE( ArcToPolyline, *boost::unit_test::expected_failures( 1 ) ) +BOOST_AUTO_TEST_CASE( ArcToPolyline ) { const std::vector cases = { { @@ -373,7 +371,5 @@ BOOST_AUTO_TEST_CASE( ArcToPolyline, *boost::unit_test::expected_failures( 1 ) ) } } -#endif // HAVE_EXPECTED_FAILURES - BOOST_AUTO_TEST_SUITE_END()