From 767072b07ab0366375621d2e1a300cec9e344bf5 Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Fri, 9 Jan 2015 21:33:03 +0200 Subject: [PATCH] Fix for issue #23 - fix conversion of ndiv to int so that right number of iterations are done. --- src/nanosvg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nanosvg.h b/src/nanosvg.h index cb80236..14a890f 100644 --- a/src/nanosvg.h +++ b/src/nanosvg.h @@ -1887,7 +1887,8 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args, t[4] = cx; t[5] = cy; // Split arc into max 90 degree segments. - ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 0.5f); + // The loop assumes an iteration per end point (including start and end), this +1. + ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f); hda = (da / (float)ndivs) / 2.0f; kappa = fabsf(4.0f / 3.0f * (1.0f - cosf(hda)) / sinf(hda)); if (da < 0.0f)