PNS: Modify MarkObstacles logic to select shorter

When routing where we hit multiple obstacles, we choose the shortest
path to allow overlapping hits to choose the shorter path, thus giving a
better chance of returning true for the DRC-compliant path.

Fixes #3773 | https://gitlab.com/kicad/code/kicad/issues/3773
This commit is contained in:
Seth Hillbrand 2020-01-16 19:54:51 -08:00
parent f1fcf3f1dc
commit 38f13ef481
1 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router * KiRouter - a push-and-(sometimes-)shove PCB router
* *
* Copyright (C) 2013-2017 CERN * Copyright (C) 2013-2017 CERN
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -452,7 +452,10 @@ bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead )
if( ( nearest - aP ).EuclideanNorm() < newHead.Width() + cl ) if( ( nearest - aP ).EuclideanNorm() < newHead.Width() + cl )
{ {
buildInitialLine( nearest, newHead ); buildInitialLine( nearest, newHead );
if ( newHead.CLine().Length() > bestHead.CLine().Length() )
// We want the shortest line here to ensure we don't break a clearance
// rule on larger, overlapping items (e.g. vias)
if( newHead.CLine().Length() < bestHead.CLine().Length() )
{ {
bestHead = newHead; bestHead = newHead;
hasBest = true; hasBest = true;