From c716b59783637e3177bab5366cdc6200cb1435fc Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 27 Jun 2018 22:36:57 +0200 Subject: [PATCH] Fix swapped numerator and denominator in the equation tan(a/2) = sin(a) / (1 + cos(a)), so 1/tan(a/2) = 1 / sin(a) * (1 + cos(a)) See #18142. --- src/common/graphcmn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/graphcmn.cpp b/src/common/graphcmn.cpp index 6e3e013bbf..a48d03c37d 100644 --- a/src/common/graphcmn.cpp +++ b/src/common/graphcmn.cpp @@ -487,7 +487,7 @@ void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, bool drawClockwiseArc = v1.GetCrossProduct(v2) < 0; alpha = wxDegToRad(alpha); - wxDouble distT = r / (1.0 + cos(alpha)) * sin(alpha); // = r / tan(a/2) = r / sin(a/2) * cos(a/2) + wxDouble distT = r / sin(alpha) * (1.0 + cos(alpha)); // = r / tan(a/2) = r / sin(a/2) * cos(a/2) wxDouble distC = r / sin(alpha / 2.0); wxASSERT_MSG( distT <= v1Length && distT <= v2Length, wxS("Radius is too big to fit the arc to given points") );