PNS: Remove offsets from hull generation

This is likely an old workaround to numerical precision issues
in the DRC system that no longer exist.  Removing this is necessary
for "exact" hull generation to produce walkaround results that
look nice (paths falling exactly on the grid lines)

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

(cherry picked from commit 5d4e2aa595)
This commit is contained in:
Jon Evans 2022-06-03 17:22:15 -04:00
parent 9a2950cca1
commit 3747369aaa
2 changed files with 6 additions and 7 deletions

View File

@ -49,7 +49,7 @@ static const SHAPE_LINE_CHAIN buildHullForPrimitiveShape( const SHAPE* aShape, i
const SHAPE_RECT* rect = static_cast<const SHAPE_RECT*>( aShape );
return OctagonalHull( rect->GetPosition(),
rect->GetSize(),
cl + 1,
cl,
0 );
}
@ -59,7 +59,7 @@ static const SHAPE_LINE_CHAIN buildHullForPrimitiveShape( const SHAPE* aShape, i
int r = circle->GetRadius();
return OctagonalHull( circle->GetCenter() - VECTOR2I( r, r ),
VECTOR2I( 2 * r, 2 * r ),
cl + 1,
cl,
2.0 * ( 1.0 - M_SQRT1_2 ) * ( r + cl ) );
}

View File

@ -65,7 +65,7 @@ const SHAPE_LINE_CHAIN OctagonalHull( const VECTOR2I& aP0, const VECTOR2I& aSize
const SHAPE_LINE_CHAIN ArcHull( const SHAPE_ARC& aSeg, int aClearance, int aWalkaroundThickness )
{
int d = aSeg.GetWidth() / 2 + aClearance + aWalkaroundThickness / 2 + HULL_MARGIN
int d = aSeg.GetWidth() / 2 + aClearance + aWalkaroundThickness / 2
+ SHAPE_ARC::DefaultAccuracyForPCB();
int x = (int) ( 2.0 / ( 1.0 + M_SQRT2 ) * d ) / 2;
@ -144,7 +144,7 @@ const SHAPE_LINE_CHAIN ArcHull( const SHAPE_ARC& aSeg, int aClearance, int aWalk
const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
int aWalkaroundThickness )
{
int cl = aClearance + aWalkaroundThickness / 2 + HULL_MARGIN;
int cl = aClearance + aWalkaroundThickness / 2;
int d = aSeg.GetWidth() / 2 + cl;
int x = (int)( 2.0 / ( 1.0 + M_SQRT2 ) * d );
@ -155,7 +155,7 @@ const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
{
return OctagonalHull( a - VECTOR2I( aSeg.GetWidth() / 2, aSeg.GetWidth() / 2 ),
VECTOR2I( aSeg.GetWidth(), aSeg.GetWidth() ),
cl + 1,
cl,
2.0 * ( 1.0 - M_SQRT1_2 ) * d );
}
@ -191,7 +191,6 @@ static void MoveDiagonal( SEG& aDiagonal, const SHAPE_LINE_CHAIN& aVertices, int
int dist;
aVertices.NearestPoint( aDiagonal, dist );
dist -= HULL_MARGIN;
VECTOR2I moveBy = ( aDiagonal.A - aDiagonal.B ).Perpendicular().Resize( dist - aClearance );
aDiagonal.A += moveBy;
aDiagonal.B += moveBy;
@ -201,7 +200,7 @@ static void MoveDiagonal( SEG& aDiagonal, const SHAPE_LINE_CHAIN& aVertices, int
const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_SIMPLE& aConvex, int aClearance )
{
// this defines the horizontal and vertical lines in the hull octagon
BOX2I box = aConvex.BBox( aClearance + HULL_MARGIN );
BOX2I box = aConvex.BBox( aClearance );
box.Normalize();
SEG topline = SEG( VECTOR2I( box.GetX(), box.GetY() + box.GetHeight() ),