From 6d12a0c95b265ba3b606b01fbf7facca289395ac Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 24 Oct 2020 16:27:32 +0200 Subject: [PATCH] OPENGL_GAL, DrawArcSegment(): do not modify the radius of arc. The radius correction does not fix correctly approximation errors, and creates serious issues for thin arcs: - control point outside the arc - HitTest active area outside the arc shown on screen - Cairo and opengl gives different arc positions. - the formula used in radius correction is probably incorrect. --- common/gal/opengl/opengl_gal.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 07cb3ee0fc..a37a0acf51 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -844,9 +844,17 @@ void OPENGL_GAL::DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadius, d // Bigger arcs need smaller alpha increment to make them look smooth const double alphaIncrement = std::min( 1e6 / aRadius, 2.0 * M_PI / CIRCLE_POINTS ); + // Code disabled because it creates serious issues: + // - The arc is inside the polygonization error, but the interior of arc is also important + // and putting error inside the arc creates significant errors inside this arc + // - for thin arcs the control points are not even inside the arc, and HitTest is + // not even working + // I am also pretty sure the formula is incorrect. (JPC) +#if 0 // Draw entirely within the real arc boundary (ie: put all polygonization error inside) double correctionFactor = cos( M_PI / (double) CIRCLE_POINTS ); aRadius *= correctionFactor; +#endif Save(); currentManager->Translate( aCenterPoint.x, aCenterPoint.y, 0.0 );