router: fix SegmentHull() corner case when it 'chamfers' more than the clearance permits (corner case for 0-length segments, which we use
for representing holes)
(cherry picked from commit 56df462474
)
This commit is contained in:
parent
4694a2622e
commit
4d5b5d3791
|
@ -170,7 +170,7 @@ const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
|
|||
|
||||
int cl = aClearance + aWalkaroundThickness / 2;
|
||||
double d = (double)aSeg.GetWidth() / 2.0 + cl;
|
||||
double x = KiROUND( 2.0 / ( 1.0 + M_SQRT2 ) * d );
|
||||
double x = 2.0 / ( 1.0 + M_SQRT2 ) * d;
|
||||
int dr = KiROUND( d );
|
||||
int xr = KiROUND( x );
|
||||
int xr2 = KiROUND( x / 2.0 );
|
||||
|
@ -179,7 +179,7 @@ const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
|
|||
VECTOR2I b = aSeg.GetSeg().B;
|
||||
int len = aSeg.GetSeg().Length();
|
||||
|
||||
if ( !IsSegment45Degree( aSeg.GetSeg() ) && len <= kinkThreshold )
|
||||
if ( !IsSegment45Degree( aSeg.GetSeg() ) && len <= kinkThreshold && len > 0 )
|
||||
{
|
||||
|
||||
int w = b.x - a.x;
|
||||
|
@ -191,10 +191,12 @@ const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
|
|||
|
||||
if( a == b )
|
||||
{
|
||||
int xx2 = KiROUND( 2.0 * ( 1.0 - M_SQRT2 ) * d );
|
||||
|
||||
return OctagonalHull( a - VECTOR2I( aSeg.GetWidth() / 2, aSeg.GetWidth() / 2 ),
|
||||
VECTOR2I( aSeg.GetWidth(), aSeg.GetWidth() ),
|
||||
cl,
|
||||
xr );
|
||||
xx2 );
|
||||
}
|
||||
|
||||
VECTOR2I dir = b - a;
|
||||
|
|
Loading…
Reference in New Issue