SHAPE_ARC::GetCentralAngle(): ensure a 360 deg arc angle is always returned as 360 deg.

An arc having the same start and end points can be 0 or 360 deg arc.
In Kicad it is always 360 deg arc (i.e. a circle)
Fixes #13182
https://gitlab.com/kicad/code/kicad/issues/13182
This commit is contained in:
jean-pierre charras 2022-12-17 14:47:26 +01:00
parent 22bece0922
commit cd7cab9794
1 changed files with 6 additions and 0 deletions

View File

@ -438,6 +438,12 @@ double SHAPE_ARC::GetLength() const
double SHAPE_ARC::GetCentralAngle() const
{
// Arcs with same start and end points can be 0 deg or 360 deg arcs.
// However, they are expected to be circles.
// So return 360 degrees as central arc:
if( m_start == m_end )
return 360.0;
VECTOR2I center = GetCenter();
VECTOR2I p0 = m_start - center;
VECTOR2I p1 = m_mid - center;