router: fix 'Bowen knot'-looking hulls for 0-length segments

This commit is contained in:
Tomasz Wlostowski 2023-01-09 23:21:58 +01:00
parent 0595440d79
commit d07d6c9a30
1 changed files with 36 additions and 31 deletions

View File

@ -193,6 +193,8 @@ const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
}
*/
if( a != b )
{
if ( !IsSegment45Degree( aSeg.GetSeg() ) )
{
if ( len <= kinkThreshold && len > 0 )
@ -232,15 +234,18 @@ const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
b.y = a.y + h;
}
}
}
if( a == b )
{
int xx2 = KiROUND( 2.0 * ( 1.0 - M_SQRT2 ) * d );
int xx2 = KiROUND( 2.0 * ( 1.0 - M_SQRT1_2 ) * d );
return OctagonalHull( a - VECTOR2I( aSeg.GetWidth() / 2, aSeg.GetWidth() / 2 ),
auto ohull = OctagonalHull( a - VECTOR2I( aSeg.GetWidth() / 2, aSeg.GetWidth() / 2 ),
VECTOR2I( aSeg.GetWidth(), aSeg.GetWidth() ),
cl,
xx2 );
return ohull;
}
VECTOR2I dir = b - a;