Fix errors in calculating tuning length.

Fix mismatched parameter passing in TOPOLOGY::followTrivialPath()
and TOPOLOGY::AssembleTrivialPath().
Fix logic error in PNS::JOINT::IsLineCorner().
Handle VVIAs in PNS::JOINT::IsNonFanoutVia().

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10614
This commit is contained in:
Jeff Young 2023-09-23 18:33:32 +01:00
parent 902e5df2e8
commit be532e96d6
4 changed files with 33 additions and 15 deletions

View File

@ -130,7 +130,7 @@ public:
{
via = static_cast<const VIA*>( item );
hasNonVirtualVia = !via->IsVirtual();
hasNonVirtualVia |= !via->IsVirtual();
}
else if( item->Kind() == SEGMENT_T || item->Kind() == ARC_T )
{
@ -155,11 +155,28 @@ public:
bool IsNonFanoutVia() const
{
int vias = m_linkedItems.Count( VIA_T );
int segs = m_linkedItems.Count( SEGMENT_T );
segs += m_linkedItems.Count( ARC_T );
int vias = 0;
int segs = 0;
int realItems = 0;
return ( m_linkedItems.Size() == 3 && vias == 1 && segs == 2 );
for( const ITEM* item : m_linkedItems.CItems() )
{
if( item->Kind() == VIA_T )
{
if( static_cast<const VIA*>( item )->IsVirtual() )
continue;
vias++;
}
else if( item->Kind() == SEGMENT_T || item->Kind() == ARC_T )
{
segs++;
}
realItems++;
}
return ( realItems == 3 && vias == 1 && segs == 2 );
}
bool IsStitchingVia() const

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
@ -63,7 +63,7 @@ bool MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
m_originLine = m_world->AssembleLine( m_initialSegment );
TOPOLOGY topo( m_world );
m_tunedPath = topo.AssembleTrivialPath( m_initialSegment );
m_tunedPath = topo.AssembleTrivialPath( m_initialSegment, nullptr, true );
if( !topo.AssembleDiffPair ( m_initialSegment, m_originPair ) )
{

View File

@ -198,7 +198,8 @@ ITEM* TOPOLOGY::NearestUnconnectedItem( const JOINT* aStart, int* aAnchor, int a
bool TOPOLOGY::followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet,
std::set<ITEM*>& aVisited, const JOINT** aTerminalJoint )
std::set<ITEM*>& aVisited, const JOINT** aTerminalJoint,
bool aFollowLockedSegments )
{
assert( aLine->IsLinked() );
@ -233,7 +234,7 @@ bool TOPOLOGY::followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet,
return false;
}
LINE l = m_world->AssembleLine( next_seg );
LINE l = m_world->AssembleLine( next_seg, nullptr, false, aFollowLockedSegments );
VECTOR2I nextAnchor = ( aLeft ? l.CLine().CPoint( -1 ) : l.CLine().CPoint( 0 ) );
@ -257,7 +258,7 @@ bool TOPOLOGY::followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet,
aSet.Add( l );
}
return followTrivialPath( &l, aLeft, aSet, aVisited, aTerminalJoint );
return followTrivialPath( &l, aLeft, aSet, aVisited, aTerminalJoint, aFollowLockedSegments );
}
if( aTerminalJoint )
@ -304,15 +305,15 @@ const ITEM_SET TOPOLOGY::AssembleTrivialPath( ITEM* aStart,
// Assemble a line following through locked segments
// TODO: consider if we want to allow tuning lines with different widths in the future
LINE l = m_world->AssembleLine( seg, nullptr, false, true );
LINE l = m_world->AssembleLine( seg, nullptr, false, aFollowLockedSegments );
path.Add( l );
const JOINT* jointA = nullptr;
const JOINT* jointB = nullptr;
followTrivialPath( &l, false, path, visited, &jointB );
followTrivialPath( &l, true, path, visited, &jointA );
followTrivialPath( &l, false, path, visited, &jointB, aFollowLockedSegments );
followTrivialPath( &l, true, path, visited, &jointA, aFollowLockedSegments );
if( aTerminalJoints )
{

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
@ -96,7 +96,7 @@ private:
const int DP_PARALLELITY_THRESHOLD = 5;
bool followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet, std::set<ITEM*>& aVisited,
const JOINT** aTerminalJoint = nullptr );
const JOINT** aTerminalJoint = nullptr, bool aFollowLockedSegments = false );
NODE *m_world;
};