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,15 +1052,26 @@ void SHAPE_LINE_CHAIN::Append( const SHAPE_LINE_CHAIN& aOtherLine )
|
|||
|
||||
void SHAPE_LINE_CHAIN::Append( const SHAPE_ARC& aArc )
|
||||
{
|
||||
SHAPE_LINE_CHAIN chain = aArc.ConvertToPolyline();
|
||||
SEG startToEnd( aArc.GetP0(), aArc.GetP1() );
|
||||
|
||||
// @todo should the below 4 LOC be moved to SHAPE_ARC::ConvertToPolyline ?
|
||||
chain.m_arcs.push_back( aArc );
|
||||
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();
|
||||
|
||||
for( auto& sh : chain.m_shapes )
|
||||
sh.first = 0;
|
||||
// @todo should the below 4 LOC be moved to SHAPE_ARC::ConvertToPolyline ?
|
||||
chain.m_arcs.push_back( aArc );
|
||||
|
||||
Append( chain );
|
||||
for( auto& sh : chain.m_shapes )
|
||||
sh.first = 0;
|
||||
|
||||
Append( chain );
|
||||
}
|
||||
|
||||
assert( m_shapes.size() == m_points.size() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue