Fix proper rounding when generating arcs

We should allow for KiROUND to find the proper end point of the mid/end
elements when generating an arc from center/start/angle form
This commit is contained in:
Seth Hillbrand 2022-03-04 13:14:19 -08:00
parent ed7222b1e7
commit 1a7d4f30d9
1 changed files with 9 additions and 4 deletions

View File

@ -46,11 +46,16 @@ SHAPE_ARC::SHAPE_ARC( const VECTOR2I& aArcCenter, const VECTOR2I& aArcStartPoint
m_width( aWidth ) m_width( aWidth )
{ {
m_start = aArcStartPoint; m_start = aArcStartPoint;
m_mid = aArcStartPoint;
m_end = aArcStartPoint;
RotatePoint( m_mid, aArcCenter, -aCenterAngle / 2.0 ); VECTOR2D mid = aArcStartPoint;
RotatePoint( m_end, aArcCenter, -aCenterAngle ); VECTOR2D end = aArcStartPoint;
VECTOR2D center = aArcCenter;
RotatePoint( mid, center, -aCenterAngle / 2.0 );
RotatePoint( end, center, -aCenterAngle );
m_mid = VECTOR2I( KiROUND( mid.x ), KiROUND( mid.y ) );
m_end = VECTOR2I( KiROUND( end.x ), KiROUND( end.y ) );
update_bbox(); update_bbox();
} }