geometry: SHAPE_LINE_CHAIN::Simplify() now correctly simplifies last 3 colinear vertices

This commit is contained in:
Tomasz Wlostowski 2021-02-23 22:48:02 +01:00
parent 028f209126
commit f7f5e67f56
1 changed files with 4 additions and 4 deletions

View File

@ -1019,17 +1019,17 @@ SHAPE_LINE_CHAIN& SHAPE_LINE_CHAIN::Simplify( bool aRemoveColinear )
|| SEG( p0, p1 ).Collinear( SEG( p1, pts_unique[n + 2] ) ) ) )
n++;
}
m_points.push_back( p0 );
m_shapes.push_back( shapes_unique[i] );
if( n > i )
i = n;
if( n == np )
if( n == np - 2 )
{
m_points.push_back( pts_unique[n - 1] );
m_shapes.push_back( shapes_unique[n - 1] );
m_points.push_back( pts_unique[np - 1] );
m_shapes.push_back( shapes_unique[np - 1] );
return *this;
}