Ensure appended arcs are valid arcs (start, mid, end cannot be collinear)
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9380
This commit is contained in:
parent
4b8ca18bf7
commit
9e557d84c6
|
@ -1052,6 +1052,16 @@ void SHAPE_LINE_CHAIN::Append( const SHAPE_LINE_CHAIN& aOtherLine )
|
|||
|
||||
void SHAPE_LINE_CHAIN::Append( const SHAPE_ARC& aArc )
|
||||
{
|
||||
SEG startToEnd( aArc.GetP0(), aArc.GetP1() );
|
||||
|
||||
if( startToEnd.Distance( aArc.GetArcMid() ) < 1 )
|
||||
{
|
||||
// Not really a valid arc. Add as a straight line segment instead
|
||||
Append( aArc.GetP0() );
|
||||
Append( aArc.GetP1() );
|
||||
}
|
||||
else
|
||||
{
|
||||
SHAPE_LINE_CHAIN chain = aArc.ConvertToPolyline();
|
||||
|
||||
// @todo should the below 4 LOC be moved to SHAPE_ARC::ConvertToPolyline ?
|
||||
|
@ -1061,6 +1071,7 @@ void SHAPE_LINE_CHAIN::Append( const SHAPE_ARC& aArc )
|
|||
sh.first = 0;
|
||||
|
||||
Append( chain );
|
||||
}
|
||||
|
||||
assert( m_shapes.size() == m_points.size() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue