Browse Source

Avoid minor overlaps

Some geometry creates 1-2nm overlaps.  These are not actually overlaps
because our collinear test can't correctly determine their
directionality, so we limit the overlap to at least 25 units (arbitrary)
to skip these chunks

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21946

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21930
pull/19/head
Seth Hillbrand 2 months ago
parent
commit
063430e488
  1. 7
      libs/kimath/src/geometry/shape_poly_set.cpp

7
libs/kimath/src/geometry/shape_poly_set.cpp

@ -1888,7 +1888,7 @@ bool SHAPE_POLY_SET::isExteriorWaist( const SEG& aSegA, const SEG& aSegB ) const
// Create perpendicular offset vector to check both sides
VECTOR2I segDir = e - s;
if( segDir.EuclideanNorm() > 0 )
if( segDir.EuclideanNorm() > 25 )
{
VECTOR2I perp = segDir.Perpendicular().Resize( 10 );
@ -1899,7 +1899,12 @@ bool SHAPE_POLY_SET::isExteriorWaist( const SEG& aSegA, const SEG& aSegB ) const
// Only return true if both sides are outside the polygon
// This is the case for non-fractured segments
if( !side1 && !side2 )
{
wxLogTrace( wxT( "collinear" ), wxT( "Found exterior waist between (%d,%d)-(%d,%d) and (%d,%d)-(%d,%d)" ),
aSegA.A.x, aSegA.A.y, aSegA.B.x, aSegA.B.y,
aSegB.A.x, aSegB.A.y, aSegB.B.x, aSegB.B.y );
return true;
}
}
return false;

Loading…
Cancel
Save