Revert "Clean up various simplify steps"

This reverts commit 798e13f70d.
This commit is contained in:
Seth Hillbrand 2023-03-24 12:30:06 -07:00
parent b0b9e66fad
commit edf23c4c18
3 changed files with 10 additions and 42 deletions

View File

@ -1046,12 +1046,6 @@ public:
///< For \a aFastMode meaning, see function booleanOp
void Simplify( POLYGON_MODE aFastMode );
///< Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
///< @param aMaxError Smooths the output such that points less than aMaxError away from the line through
/// the two adjacent points will be removed
void Simplify( size_t aMaxError );
/**
* Convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s).
*
@ -1428,10 +1422,10 @@ private:
void booleanOp( ClipperLib::ClipType aType, const SHAPE_POLY_SET& aShape,
const SHAPE_POLY_SET& aOtherShape, POLYGON_MODE aFastMode );
void booleanOp( Clipper2Lib::ClipType aType, const SHAPE_POLY_SET& aOtherShape, size_t aMaxError = 0 );
void booleanOp( Clipper2Lib::ClipType aType, const SHAPE_POLY_SET& aOtherShape );
void booleanOp( Clipper2Lib::ClipType aType, const SHAPE_POLY_SET& aShape,
const SHAPE_POLY_SET& aOtherShape, size_t aMaxError = 0 );
const SHAPE_POLY_SET& aOtherShape );
/**
* Check whether the point \a aP is inside the \a aSubpolyIndex-th polygon of the polyset. If

View File

@ -721,14 +721,14 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType, const SHAPE_POLY_SET
}
void SHAPE_POLY_SET::booleanOp( Clipper2Lib::ClipType aType, const SHAPE_POLY_SET& aOtherShape, size_t aMaxError )
void SHAPE_POLY_SET::booleanOp( Clipper2Lib::ClipType aType, const SHAPE_POLY_SET& aOtherShape )
{
booleanOp( aType, *this, aOtherShape, aMaxError );
booleanOp( aType, *this, aOtherShape );
}
void SHAPE_POLY_SET::booleanOp( Clipper2Lib::ClipType aType, const SHAPE_POLY_SET& aShape,
const SHAPE_POLY_SET& aOtherShape, size_t aMaxError )
const SHAPE_POLY_SET& aOtherShape )
{
if( ( aShape.OutlineCount() > 1 || aOtherShape.OutlineCount() > 0 )
&& ( aShape.ArcCount() > 0 || aOtherShape.ArcCount() > 0 ) )
@ -765,8 +765,7 @@ void SHAPE_POLY_SET::booleanOp( Clipper2Lib::ClipType aType, const SHAPE_POLY_SE
c.AddSubject( paths );
c.AddClip( clips );
Clipper2Lib::Paths64 solution;
Clipper2Lib::PolyTree64 tree;
Clipper2Lib::PolyTree64 solution;
Clipper2Lib::ZCallback64 callback =
[&]( const Clipper2Lib::Point64 & e1bot, const Clipper2Lib::Point64 & e1top,
@ -829,24 +828,10 @@ void SHAPE_POLY_SET::booleanOp( Clipper2Lib::ClipType aType, const SHAPE_POLY_SE
c.SetZCallback( callback ); // register callback
if( aMaxError > 0 )
{
c.Execute( aType, Clipper2Lib::FillRule::NonZero, solution );
Clipper2Lib::Paths64 output = Clipper2Lib::SimplifyPaths( solution, aMaxError, false );
Clipper2Lib::Clipper64 c2;
c.Execute( aType, Clipper2Lib::FillRule::NonZero, solution );
c2.PreserveCollinear = false;
c2.ReverseSolution = false;
c2.AddSubject( output );
c2.Execute( Clipper2Lib::ClipType::Union, Clipper2Lib::FillRule::Positive, tree);
}
else
{
c.Execute( aType, Clipper2Lib::FillRule::NonZero, tree );
}
importTree( tree, zValues, arcBuffer );
tree.Clear(); // Free used memory (not done in dtor)
importTree( solution, zValues, arcBuffer );
solution.Clear(); // Free used memory (not done in dtor)
}
@ -1612,17 +1597,6 @@ void SHAPE_POLY_SET::Unfracture( POLYGON_MODE aFastMode )
}
void SHAPE_POLY_SET::Simplify( size_t aMaxError )
{
SHAPE_POLY_SET empty;
if( ADVANCED_CFG::GetCfg().m_UseClipper2 )
booleanOp( Clipper2Lib::ClipType::Union, empty, aMaxError );
else
booleanOp( ClipperLib::ctUnion, empty, PM_FAST );
}
void SHAPE_POLY_SET::Simplify( POLYGON_MODE aFastMode )
{
SHAPE_POLY_SET empty;

View File

@ -1299,7 +1299,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
}
}
aHoles.Simplify( m_maxError );
aHoles.Simplify( SHAPE_POLY_SET::PM_FAST );
}