From 623a90de7b50ade6dc17694b7062ceeb55d61f62 Mon Sep 17 00:00:00 2001 From: Michal Szczecinski Date: Tue, 16 Mar 2021 12:00:00 +0100 Subject: [PATCH] common shape: Fixed appendArc for negative values. Description: Fixed appendArc API for -90 angles. In that case it was drawn in wrong direction. @Examples ```cpp float x = 40.0, y = 40.0; auto shape1 = tvg::Shape::gen(); //OK shape1->appendArc(x + 50, y, 25, 0, -91, false); //NOK shape1->appendArc(x + 100, y, 25, 0, -90, false); //OK shape1->appendArc(x + 150, y, 25, 0, -89, false); ``` --- src/lib/tvgShape.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/tvgShape.cpp b/src/lib/tvgShape.cpp index 40b80ee4..efd1fdff 100644 --- a/src/lib/tvgShape.cpp +++ b/src/lib/tvgShape.cpp @@ -163,7 +163,7 @@ Result Shape::appendArc(float cx, float cy, float radius, float startAngle, floa auto nCurves = ceil(abs(sweep / M_PI_HALF)); auto sweepSign = (sweep < 0 ? -1 : 1); auto fract = fmodf(sweep, M_PI_HALF); - fract = (fabsf(fract) < std::numeric_limits::epsilon()) ? M_PI_HALF : fract; + fract = (fabsf(fract) < std::numeric_limits::epsilon()) ? M_PI_HALF * sweepSign : fract; //Start from here Point start = {radius * cos(startAngle), radius * sin(startAngle)};