EDA_SHAPE::TransformShapeToPolygon() for filled SHAPE_T::POLY: use another algo:

previously, for aClearance/width > 0, a seg of segments (width = aClearance*2) was added
to the polygon shape. This is acceptable for polygons having not a log of vertices.
It does not work fine (bad shape, extremeny long calculation time) if there are
a **lot** of vertices.
Now the polygonal shape is just inflated by width/2. Much faster and better shape.
This commit is contained in:
jean-pierre charras 2023-08-18 12:58:48 +02:00
parent 1cbc6e33db
commit bc59ed08b4
1 changed files with 9 additions and 5 deletions

View File

@ -1562,18 +1562,22 @@ void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance
if( IsFilled() )
{
aBuffer.NewOutline();
for( int ii = 0; ii < m_poly.OutlineCount(); ++ii )
{
const SHAPE_LINE_CHAIN& poly = m_poly.Outline( ii );
SHAPE_POLY_SET tmp;
tmp.NewOutline();
for( int jj = 0; jj < (int) poly.GetPointCount(); ++jj )
aBuffer.Append( poly.GetPoint( jj ) );
tmp.Append( poly.GetPoint( jj ) );
if( width > 0 )
tmp.Inflate( width/2, SHAPE_POLY_SET::ROUND_ALL_CORNERS, aError, false);
aBuffer.Append( tmp );
}
}
if( width > 0 || !IsFilled() )
else
{
for( int ii = 0; ii < m_poly.OutlineCount(); ++ii )
{