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:
parent
0cb82a0985
commit
54a3ca06c0
|
@ -375,15 +375,16 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
|
||||||
|
|
||||||
if( m_startX.GetValue() == m_endX.GetValue() && m_startY.GetValue() == m_endY.GetValue() )
|
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" ),
|
error_msgs.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f" ),
|
||||||
0.0, m_angle.GetDoubleValue() ) );
|
0.0, arcAngleDeg ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VECTOR2D start( m_startX.GetValue(), m_startY.GetValue() );
|
VECTOR2D start( m_startX.GetValue(), m_startY.GetValue() );
|
||||||
VECTOR2D end( m_endX.GetValue(), m_endY.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 radius = ( center - start ).EuclideanNorm();
|
||||||
double max_offset = std::max( std::abs( center.x ) + radius,
|
double max_offset = std::max( std::abs( center.x ) + radius,
|
||||||
std::abs( center.y ) + radius );
|
std::abs( center.y ) + radius );
|
||||||
|
@ -392,10 +393,11 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
|
||||||
|| center == start || center == end )
|
|| center == start || center == end )
|
||||||
{
|
{
|
||||||
error_msgs.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f" ),
|
error_msgs.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f" ),
|
||||||
radius, m_angle.GetDoubleValue() ) );
|
radius, arcAngleDeg ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::CIRCLE:
|
case SHAPE_T::CIRCLE:
|
||||||
// Check radius.
|
// Check radius.
|
||||||
if( m_endX.GetValue() == 0 )
|
if( m_endX.GetValue() == 0 )
|
||||||
|
|
Loading…
Reference in New Issue