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;
|
int cl = aClearance + aWalkaroundThickness / 2;
|
||||||
double d = (double)aSeg.GetWidth() / 2.0 + cl;
|
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 dr = KiROUND( d );
|
||||||
int xr = KiROUND( x );
|
int xr = KiROUND( x );
|
||||||
int xr2 = KiROUND( x / 2.0 );
|
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;
|
VECTOR2I b = aSeg.GetSeg().B;
|
||||||
int len = aSeg.GetSeg().Length();
|
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;
|
int w = b.x - a.x;
|
||||||
|
@ -191,10 +191,12 @@ const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
|
||||||
|
|
||||||
if( a == b )
|
if( a == b )
|
||||||
{
|
{
|
||||||
|
int xx2 = KiROUND( 2.0 * ( 1.0 - M_SQRT2 ) * d );
|
||||||
|
|
||||||
return OctagonalHull( a - VECTOR2I( aSeg.GetWidth() / 2, aSeg.GetWidth() / 2 ),
|
return OctagonalHull( a - VECTOR2I( aSeg.GetWidth() / 2, aSeg.GetWidth() / 2 ),
|
||||||
VECTOR2I( aSeg.GetWidth(), aSeg.GetWidth() ),
|
VECTOR2I( aSeg.GetWidth(), aSeg.GetWidth() ),
|
||||||
cl,
|
cl,
|
||||||
xr );
|
xx2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTOR2I dir = b - a;
|
VECTOR2I dir = b - a;
|
||||||
|
|
Loading…
Reference in New Issue