Pcbnew, DIALOG_GRAPHIC_ITEM_PROPERTIES: fix incorrect test for arcs.

It was due to mixing decidegrees and degrees, and seen for 180 deg arcs
Fixes #10841
https://gitlab.com/kicad/code/kicad/issues/10841
This commit is contained in:
jean-pierre charras 2022-02-14 09:46:57 +01:00
parent 0cb82a0985
commit 54a3ca06c0
1 changed files with 6 additions and 4 deletions

View File

@ -375,15 +375,16 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
if( m_startX.GetValue() == m_endX.GetValue() && m_startY.GetValue() == m_endY.GetValue() )
{
double arcAngleDeg = m_angle.GetDoubleValue()/10.0;
error_msgs.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f" ),
0.0, m_angle.GetDoubleValue() ) );
0.0, arcAngleDeg ) );
}
else
{
VECTOR2D start( m_startX.GetValue(), m_startY.GetValue() );
VECTOR2D end( m_endX.GetValue(), m_endY.GetValue() );
VECTOR2D center = CalcArcCenter( start, end, m_angle.GetDoubleValue() );
double arcAngleDeg = m_angle.GetDoubleValue()/10.0;
VECTOR2D center = CalcArcCenter( start, end, arcAngleDeg );
double radius = ( center - start ).EuclideanNorm();
double max_offset = std::max( std::abs( center.x ) + radius,
std::abs( center.y ) + radius );
@ -392,10 +393,11 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
|| center == start || center == end )
{
error_msgs.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f" ),
radius, m_angle.GetDoubleValue() ) );
radius, arcAngleDeg ) );
}
}
break;
case SHAPE_T::CIRCLE:
// Check radius.
if( m_endX.GetValue() == 0 )