Fix incorrect Rotate() functions for shapes circles and arcs.

VECTOR2I::Rotate( double aAngle ) returns a rotated point, but does change
the object itself.

Fixes #4810
https://gitlab.com/kicad/code/kicad/issues/4810
This commit is contained in:
jean-pierre charras 2020-07-06 13:50:55 +02:00
parent 0d8c6d43a8
commit 5d5706b8be
2 changed files with 7 additions and 4 deletions

View File

@ -106,7 +106,9 @@ public:
void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
{
// That was easy....
m_center -= aCenter;
m_center = m_center.Rotate( aAngle );
m_center += aCenter;
}
bool IsSolid() const override

View File

@ -279,13 +279,14 @@ void SHAPE_ARC::Rotate( double aAngle, const VECTOR2I& aCenter )
m_end -= aCenter;
m_mid -= aCenter;
m_start.Rotate( aAngle );
m_end.Rotate( aAngle );
m_mid.Rotate( aAngle );
m_start = m_start.Rotate( aAngle );
m_end = m_end.Rotate( aAngle );
m_mid = m_mid.Rotate( aAngle );
m_start += aCenter;
m_end += aCenter;
m_mid += aCenter;
update_bbox();
}