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.
This commit is contained in:
jean-pierre charras 2020-10-24 16:27:32 +02:00
parent 1c848622d7
commit 6d12a0c95b
1 changed files with 8 additions and 0 deletions

View File

@ -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 // Bigger arcs need smaller alpha increment to make them look smooth
const double alphaIncrement = std::min( 1e6 / aRadius, 2.0 * M_PI / CIRCLE_POINTS ); 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) // Draw entirely within the real arc boundary (ie: put all polygonization error inside)
double correctionFactor = cos( M_PI / (double) CIRCLE_POINTS ); double correctionFactor = cos( M_PI / (double) CIRCLE_POINTS );
aRadius *= correctionFactor; aRadius *= correctionFactor;
#endif
Save(); Save();
currentManager->Translate( aCenterPoint.x, aCenterPoint.y, 0.0 ); currentManager->Translate( aCenterPoint.x, aCenterPoint.y, 0.0 );