50#define INITIAL_HOVER_HITTEST_THRESHOLD_PIXELS 5
51#define DETAILS_HOVER_HITTEST_THRESHOLD_PIXELS 20
112 settings->
m_PnsSettings = std::make_unique<PNS::ROUTING_SETTINGS>( settings,
"tools.pns" );
156 if( evt->IsCancelInteractive() || evt->IsActivate() )
176 if( evt->IsMotion() )
248 m_frame->GetCanvas()->Refresh();
275 double min_dist_sq = std::numeric_limits<double>::max();
277 for(
EDA_ITEM* candidate : collector )
282 candidatePos =
static_cast<PCB_TRACK*
>( candidate )->GetCenter();
283 else if( candidate->Type() ==
PCB_ARC_T )
284 candidatePos =
static_cast<PCB_ARC*
>( candidate )->GetMid();
286 const double dist_sq = (
m_cursorPos - candidatePos ).SquaredEuclideanNorm();
288 if( dist_sq < min_dist_sq )
295 min_dist_sq = dist_sq;
298 const bool isDiffPairItem =
314 int fakeNCP, fakeNCN;
317 const bool isDiffPairItem =
m_drcEngine->IsNetADiffPair(
m_board, candidateNet, fakeNCP, fakeNCN );
320 const NETINFO_ITEM* existingNet = existingBci->GetNet();
322 if( !isDiffPairItem && candidateNet != existingNet )
324 min_dist_sq = dist_sq;
339 std::vector<LENGTH_DELAY_CALCULATION_ITEM>& aItems,
342 if( aPath.
Size() == 0 )
347 wxASSERT( aItems.size() ==
static_cast<size_t>( aPath.
Size() ) );
354 .OptimiseVias =
false, .MergeTracks =
false, .OptimiseTracesInPads =
false, .InferViaInPad =
true
360 m_board->GetLengthCalculation()->CalculateLengthDetails(
386 wxString selectedTuningProfileName =
m_selectedNetinfo->GetNetClass()->GetTuningProfile();
387 wxString coupledTuningProfileName =
m_coupledNetinfo->GetNetClass()->GetTuningProfile();
389 std::shared_ptr<TUNING_PROFILES> tuningParams =
m_frame->Prj().GetProjectFile().TuningProfileParameters();
390 const TUNING_PROFILE& selectedTuningProfile = tuningParams->GetTuningProfile( selectedTuningProfileName );
391 const TUNING_PROFILE& coupledTuningProfile = tuningParams->GetTuningProfile( coupledTuningProfileName );
431 const double padLenDiff =
433 const double padDelayDiff =
442 auto opposite = [](
const RELATIVE_PAIR& a )
444 return RELATIVE_PAIR{ -a.len, -a.delay };
447 for(
const auto& r : aKnownRuns )
449 const std::size_t segIdxA = r.segA;
450 const std::size_t segIdxB = r.segB;
452 const double segStartA = segIdxA == 0 ? 0.0 :
static_cast<double>(
m_selectedCumulative[segIdxA - 1].m_Length );
453 const double segStartB = segIdxB == 0 ? 0.0 :
static_cast<double>(
m_coupledCumulative[segIdxB - 1].m_Length );
457 const double s0A = segStartA + r.ta0 * segLenA;
458 const double s1A = segStartA + r.ta1 * segLenA;
459 const double s0B = segStartB + r.tb0 * segLenB;
460 const double s1B = segStartB + r.tb1 * segLenB;
462 const RELATIVE_PAIR startRel{ ( r.startLenA - r.startLenB ) + padLenDiff,
463 ( r.startDelayA - r.startDelayB ) + padDelayDiff };
464 const RELATIVE_PAIR endRel{ ( r.endLenA - r.endLenB ) + padLenDiff,
465 ( r.endDelayA - r.endDelayB ) + padDelayDiff };
466 const RELATIVE_PAIR startRelB = opposite( startRel );
467 const RELATIVE_PAIR endRelB = opposite( endRel );
469 const bool hasStartViaA = r.startViaLengthA.has_value();
470 const bool hasEndViaA = r.endViaLengthA.has_value();
471 const bool hasStartViaB = r.startViaLengthB.has_value();
472 const bool hasEndViaB = r.endViaLengthB.has_value();
474 const double startViaLenA = r.startViaLengthA.value_or( 0.0 );
475 const double endViaLenA = r.endViaLengthA.value_or( 0.0 );
476 const double startViaLenB = r.startViaLengthB.value_or( 0.0 );
477 const double endViaLenB = r.endViaLengthB.value_or( 0.0 );
479 const double startViaDelayA = r.startViaDelayA.value_or( 0.0 );
480 const double endViaDelayA = r.endViaDelayA.value_or( 0.0 );
481 const double startViaDelayB = r.startViaDelayB.value_or( 0.0 );
482 const double endViaDelayB = r.endViaDelayB.value_or( 0.0 );
485 if( hasStartViaA && hasStartViaB )
487 const RELATIVE_PAIR rel{ startRel.len - startViaLenA + startViaLenB,
488 startRel.delay - startViaDelayA + startViaDelayB };
489 const RELATIVE_PAIR relB = opposite( rel );
491 m_coupledKnownPoints.push_back( { s0B - startViaLenB, relB.len, relB.delay, relB.len, relB.delay } );
495 RELATIVE_PAIR startBeforeA = startRel;
496 RELATIVE_PAIR startBeforeB = startRelB;
498 if( hasStartViaA && !hasStartViaB )
500 startBeforeB.len += startViaLenA;
501 startBeforeB.delay += startViaDelayA;
503 startRel.delay - startViaDelayA, startRel.len - startViaLenA,
504 startRel.delay - startViaDelayA } );
506 else if( !hasStartViaA && hasStartViaB )
508 startBeforeA.len += startViaLenB;
509 startBeforeA.delay += startViaDelayB;
511 startRelB.delay - startViaDelayB, startRelB.len - startViaLenB,
512 startRelB.delay - startViaDelayB } );
516 RELATIVE_PAIR endAfterA = endRel;
517 RELATIVE_PAIR endAfterB = endRelB;
519 if( hasEndViaA && !hasEndViaB )
521 endAfterB.len -= endViaLenA;
522 endAfterB.delay -= endViaDelayA;
524 else if( !hasEndViaA && hasEndViaB )
526 endAfterA.len -= endViaLenB;
527 endAfterA.delay -= endViaDelayB;
531 m_selectedKnownPoints.push_back( { s0A, startBeforeA.len, startBeforeA.delay, startRel.len, startRel.delay } );
532 m_selectedKnownPoints.push_back( { s1A, endRel.len, endRel.delay, endAfterA.len, endAfterA.delay } );
533 m_coupledKnownPoints.push_back( { s0B, startBeforeB.len, startBeforeB.delay, startRelB.len, startRelB.delay } );
534 m_coupledKnownPoints.push_back( { s1B, endRelB.len, endRelB.delay, endAfterB.len, endAfterB.delay } );
537 if( hasEndViaA && hasEndViaB )
539 const RELATIVE_PAIR rel{ endRel.len + endViaLenA - endViaLenB, endRel.delay + endViaDelayA - endViaDelayB };
540 const RELATIVE_PAIR relB = opposite( rel );
542 m_coupledKnownPoints.push_back( { s1B + endViaLenB, relB.len, relB.delay, relB.len, relB.delay } );
544 else if( hasEndViaA && !hasEndViaB )
546 m_selectedKnownPoints.push_back( { s1A + endViaLenA, endRel.len + endViaLenA, endRel.delay + endViaDelayA,
547 endRel.len + endViaLenA, endRel.delay + endViaDelayA } );
549 else if( !hasEndViaA && hasEndViaB )
551 m_coupledKnownPoints.push_back( { s1B + endViaLenB, endRelB.len + endViaLenB, endRelB.delay + endViaDelayB,
552 endRelB.len + endViaLenB, endRelB.delay + endViaDelayB } );
559 const double aTargetSubsegmentSize )
561 if( aSegments.empty() )
564 std::vector<double> splits;
567 if( aSegments[0].m_SourceType == LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE )
568 splits.push_back( 0.0 );
570 double currentDistance = 0;
574 const double segStart = currentDistance;
575 const double segEnd = seg.m_Length;
576 currentDistance = segEnd;
579 if( seg.m_SourceType != LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE )
583 for(
double s = segStart; s < segEnd; s += aTargetSubsegmentSize )
585 splits.push_back( s );
588 splits.push_back( segEnd );
592 std::ranges::sort( splits );
594 splits.erase( std::ranges::unique( splits,
595 [](
const double a,
const double b )
606std::pair<VECTOR2D, std::size_t>
608 const std::vector<LENGTH_DELAY_CALCULATION_ITEM>& aSourceItemDetails,
611 for( std::size_t i = 0; i < aSegments.size(); ++i )
613 const double segStart = i == 0 ? 0.0 :
static_cast<double>( aSegments[i - 1].m_Length );
614 const double segEnd =
static_cast<double>( aSegments[i].m_Length );
616 if( aDist <= segEnd +
EPS )
618 const double segLen = segEnd - segStart;
623 t = ( aDist - segStart ) / segLen;
625 t = std::clamp( t, 0.0, 1.0 );
627 if( aSourceItemDetails[i].Type() == LENGTH_DELAY_CALCULATION_ITEM::TYPE::VIA )
631 wxASSERT( aSourceItemDetails[i - 1].Type() == LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE );
632 wxASSERT( aSourceItemDetails[i - 1].
GetLine().CPoints().size() == 2 );
633 return { aSourceItemDetails[i - 1].GetLine().CPoints()[1], i - 1 };
636 wxASSERT( aSourceItemDetails[i].Type() == LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE );
637 wxASSERT( aSourceItemDetails[i].
GetLine().CPoints().size() == 2 );
640 lerp( aSourceItemDetails[i].
GetLine().CPoints()[0], aSourceItemDetails[i].
GetLine().CPoints()[1], t ), i
647 return { { 0.0, 0.0 }, 0 };
652 const bool aUseLogScale )
const
654 auto lerp = [](
const double d1,
const double d2,
const double s )
656 return d1 + s * ( d2 - d1 );
663 const double r = std::clamp(
lerp( aColour1.
r, aColour2.
r, aS ), 0.0, 1.0 );
664 const double g = std::clamp(
lerp( aColour1.
g, aColour2.
g, aS ), 0.0, 1.0 );
665 const double b = std::clamp(
lerp( aColour1.
b, aColour2.
b, aS ), 0.0, 1.0 );
666 const double a = std::clamp(
lerp( aColour1.
a, aColour2.
a, aS ), 0.0, 1.0 );
677 aTargetSubsegmentSize );
682 const std::vector<CUMULATIVE_ENTRY>& aSegments,
683 const std::vector<LENGTH_DELAY_CALCULATION_ITEM>& aSourceItemDetails,
684 const std::vector<KNOWN_RELATIVE_POINT>& aKnownPoints,
double aTargetSubsegmentSize )
686 std::vector<OUTPUT_SEGMENT>
result;
688 if( aSegments.empty() )
697 double minDelay = 0.0;
698 double maxDelay = 0.0;
700 for(
const auto& [_1, relLenBefore, relDelayBefore, relLenAfter, relDelayAfter] : aKnownPoints )
702 minLen = std::min( minLen, std::min( relLenBefore, relLenAfter ) );
703 maxLen = std::max( maxLen, std::max( relLenBefore, relLenAfter ) );
704 minDelay = std::min( minDelay, std::min( relDelayBefore, relDelayAfter ) );
705 maxDelay = std::max( maxDelay, std::max( relDelayBefore, relDelayAfter ) );
711 m_maxSkew = std::max(
static_cast<int>( std::round( maxDelay / 10 ) * 10 ), maxSkew );
713 m_maxSkew = std::max(
static_cast<int>( std::round( maxLen / 10 ) * 10 ), maxSkew );
721 for( std::size_t i = 0; i + 1 < splits.size(); ++i )
723 const double s0 = splits[i];
724 const double s1 = splits[i + 1];
732 auto [startPoint, segIdx] =
pointAtDistance( aSegments, aSourceItemDetails, s0 );
734 out.
Start = startPoint;
738 const double sMid = ( s0 + s1 ) / 2.0;
740 const std::optional<std::pair<double, double>> knownInterp = interp.
ValueAt( sMid );
748 out.
RelativeValueAtMid = knownInterp.value_or( std::pair<double, double>{ 0.0, 0.0 } ).second;
754 out.
RelativeValueAtMid = knownInterp.value_or( std::pair<double, double>{ 0.0, 0.0 } ).first;
797 const bool drawHighlight = selIdx < std::numeric_limits<std::size_t>::max();
806 if( drawHighlight && isSelected && i == selIdx )
818 if( drawHighlight && !isSelected && i == selIdx )
826 std::vector<MSG_PANEL_ITEM> items;
827 wxString description, value;
835 std::vector<MSG_PANEL_ITEM> items;
845 wxString description = wxString::Format(
_(
"Net A Name" ) );
847 items.emplace_back( description, netName );
851 description = wxString::Format(
_(
"Net B Name" ) );
853 items.emplace_back( description, netName );
858 wxString description = wxString::Format(
_(
"Net P Name" ) );
859 wxString netName =
m_board->GetNetInfo().GetNetItem(
m_netcodeP )->GetDisplayNetname();
860 items.emplace_back( description, netName );
862 description = wxString::Format(
_(
"Net N Name" ) );
864 items.emplace_back( description, netName );
869 wxString description = wxString::Format(
_(
"Max Skew" ) );
877 items.emplace_back( description, value );
882 const bool drawHighlight = selIdx < std::numeric_limits<std::size_t>::max();
888 normalisedValue = ( normalisedValue == 0.0 ) ? 0.0 : normalisedValue;
890 wxString description =
_(
"Local Skew" );
891 wxString value =
_(
"Unknown" );
895 value =
m_frame->MessageTextFromValue( normalisedValue,
true,
900 items.emplace_back( description, value );
903 frame()->SetMsgPanel( items );
918 return std::numeric_limits<int>::max();
923 return std::max( val.
Max(), val.
Opt() );
929 return std::numeric_limits<int>::max();
940 std::pair<std::size_t, std::size_t> aRangeB,
double aMaxSpacing,
941 std::vector<PARALLEL_RUN>& aRuns )
const
943 for(
size_t ia = aRangeA.first; ia < aRangeA.second; ++ia )
947 if( selectedItem.
Type() != LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE )
961 for(
size_t ib = aRangeB.first; ib < aRangeB.second; ++ib )
965 if( coupledItem.
Type() != LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE )
983 const double dp = nA.Dot( nB );
993 const double perpDistance = std::fabs( nA.Cross( midB -
A0 ) );
995 const double maxItemGap =
998 if( perpDistance > maxItemGap )
1002 double a0 =
A0.Dot( nA );
1003 double a1 =
A1.Dot( nA );
1004 double b0 = B0.
Dot( nA );
1005 double b1 = B1.
Dot( nA );
1007 bool aReversed =
false;
1008 bool bReversed =
false;
1012 std::swap( a0, a1 );
1018 std::swap( b0, b1 );
1023 double overlap0 = std::max( a0, b0 );
1024 double overlap1 = std::min( a1, b1 );
1027 if( overlap1 <= overlap0 )
1031 double tA0 = ( overlap0 - a0 ) / ( a1 - a0 );
1032 double tA1 = ( overlap1 - a0 ) / ( a1 - a0 );
1033 double tB0 = ( overlap0 - b0 ) / ( b1 - b0 );
1034 double tB1 = ( overlap1 - b0 ) / ( b1 - b0 );
1051 std::swap( tA0, tA1 );
1054 std::swap( tB0, tB1 );
1057 tA0 = std::clamp( tA0, 0.0, 1.0 );
1058 tA1 = std::clamp( tA1, 0.0, 1.0 );
1060 tB0 = std::clamp( tB0, 0.0, 1.0 );
1061 tB1 = std::clamp( tB1, 0.0, 1.0 );
1066 auto HasStartingVia = [](
const std::vector<CUMULATIVE_ENTRY>& cumulative,
const std::size_t
index,
1072 const auto& prev = cumulative[
index - 1];
1074 return prev.m_SourceType == LENGTH_DELAY_CALCULATION_ITEM::TYPE::VIA && current.m_Start == prev.m_End;
1077 auto HasEndingVia = [](
const std::vector<CUMULATIVE_ENTRY>& cumulative,
const std::size_t
index,
1080 if(
index + 1 >= cumulative.size() )
1083 const auto&
next = cumulative[
index + 1];
1085 return next.m_SourceType == LENGTH_DELAY_CALCULATION_ITEM::TYPE::VIA && current.m_End ==
next.m_Start;
1151 aRuns.push_back( run );
1159 std::vector<PARALLEL_RUN> runs;
1169 const auto [minSelected, maxSelected] = std::ranges::minmax( runs, {},
1175 const auto [minCoupled, maxCoupled] = std::ranges::minmax( runs, {},
1182 const std::size_t firstSegA = minSelected.segA;
1183 const std::size_t lastSegA = maxSelected.segA;
1184 const std::size_t firstSegB = minCoupled.segA;
1185 const std::size_t lastSegB = maxCoupled.segA;
1189 if( firstSegA > 0 || firstSegB > 0 )
1193 const VECTOR2D distVec = selPadLocn - coupledPadLocn;
1205 const VECTOR2D distVec = selPadLocn - coupledPadLocn;
1209 padSeparation, runs );
1212 std::ranges::sort( runs,
1229 const std::vector<CUMULATIVE_ENTRY>& aCumulative,
const std::size_t aSegIdx,
const double aT )
1231 const double segLength =
static_cast<double>( aLengthDelayDetails.
LengthsAndDelays[aSegIdx].first );
1232 const double segDelay =
static_cast<double>( aLengthDelayDetails.
LengthsAndDelays[aSegIdx].second );
1237 const double partLen = segLength * ( 1.0 - aT );
1238 const double partDelay = segDelay * ( 1.0 - aT );
1239 return { aCumulative[aSegIdx].m_Length -
static_cast<int64_t
>( partLen ) + aPadDetails.
StartPadLength,
1240 aCumulative[aSegIdx].m_Delay -
static_cast<int64_t
>( partDelay ) + aPadDetails.
StartPadDelay };
1253 std::vector<CUMULATIVE_ENTRY> cumulative;
1262 int64_t totalLength = 0;
1263 int64_t totalDelay = 0;
1267 for( std::size_t i = 0; i < aItems.size(); ++i )
1274 if( item.
Type() == LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE )
1279 else if( item.
Type() == LENGTH_DELAY_CALCULATION_ITEM::TYPE::VIA )
1285 totalLength += itemLen;
1286 totalDelay += itemDly;
1287 cumulative.emplace_back( totalLength, totalDelay, item.
Type(), start,
end );
1296 std::vector<LENGTH_DELAY_CALCULATION_ITEM> splitItems;
1306 newItem.
SetWidth( aSourceItem.GetWidth() );
1307 newItem.
SetLayers( aSourceItem.GetStartLayer() );
1309 splitItems.emplace_back( std::move( newItem ) );
1312 for(
const auto& sourceItem : aItems )
1315 if( sourceItem.Type() != LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE )
1317 splitItems.emplace_back( sourceItem );
1323 for(
int segIdx = 0; segIdx < line.
SegmentCount(); ++segIdx )
1326 makeLengthDelayItem( seg, sourceItem );
1330 aItems = std::move( splitItems );
1339 switch( aDirection )
1342 message = wxString::Format(
_(
"Net %s has multiple simulation electrical source pads" ),
1346 message = wxString::Format(
_(
"Net %s has multiple simulation electrical source pads" ),
1350 message = wxString::Format(
_(
"Differential pair %s / %s is missing start and / or end pads" ),
1354 message = wxString::Format(
_(
"Net %s is missing electrical simulation source pad" ),
1358 message = wxString::Format(
_(
"Net %s is missing electrical simulation source pad" ),
1361 default: error =
false;
break;
1365 m_frame->ShowInfoBarError( message,
true );
1395 m_frame->ShowInfoBarError(
_(
"Phase skew initial selection failed" ),
true );
1410 m_frame->ShowInfoBarError(
_(
"Differential pair identification failed" ),
true );
1439 wxCHECK( trackFirst, );
1443 wxCHECK( trackSecond, );
1453 VECTOR2I startSnapPointFirst, startSnapPointSecond;
1462 m_frame->ShowInfoBarError(
_(
"Phase skew initial selection failed" ),
true );
1492 for(
int i = 0; i < aPath.
Size(); ++i )
1505 wxASSERT( numPoints >= 2 );
1507 if( line.
GetPoint( numPoints - 1 ) == pathSearchLoc )
1510 pathSearchLoc = line.
GetPoint( numPoints - 1 );
1515 wxASSERT( viaItem->
Pos() == pathSearchLoc );
1532 if( !selectedStartPad || !selectedEndPad || !coupledStartPad || !coupledEndPad )
1540 std::swap( selectedStartPad, selectedEndPad );
1547 std::swap( coupledStartPad, coupledEndPad );
1576 for(
auto itr = aPath.
rbegin(); itr != aPath.
rend(); ++itr )
1581 wxASSERT( l !=
nullptr );
1587 reversed.
Add( *itr );
1590 aPath = std::move( reversed );
1593 std::swap( *aStartPad, *aEndPad );
1599 constexpr std::size_t maxIdx = std::numeric_limits<std::size_t>::max();
1603 if( selectedIdx < maxIdx )
1605 if( isSelectedTrack )
1620 const double aHitTestDistance )
const
1622 auto getNearestSegment = [&aCursorPos, aHitTestDistance](
const std::vector<OUTPUT_SEGMENT>& segments )
1624 const double maxDistSq = aHitTestDistance * aHitTestDistance;
1626 std::size_t bestIndex = std::numeric_limits<std::size_t>::max();
1627 double bestDistSq = maxDistSq;
1629 for(
size_t i = 0; i < segments.size(); ++i )
1631 const auto& seg = segments[i];
1633 VECTOR2D mid = ( seg.Start + seg.End ) / 2.0;
1634 const double distSq = ( aCursorPos - mid ).SquaredEuclideanNorm();
1636 if( distSq <= bestDistSq )
1638 bestDistSq = distSq;
1643 return std::pair<std::size_t, double>( bestIndex, bestDistSq );
1646 const auto [selectedIdx, selectedDist] = getNearestSegment(
m_selectedDiffs );
1647 const auto [coupledIdx, coupledDist] = getNearestSegment(
m_coupledDiffs );
1649 constexpr std::size_t maxIdx = std::numeric_limits<std::size_t>::max();
1651 if( selectedIdx != maxIdx && coupledIdx != maxIdx )
1653 if( selectedDist <= coupledDist )
1654 return { selectedIdx,
true };
1656 return { coupledIdx,
false };
1659 if( selectedIdx != maxIdx )
1660 return { selectedIdx,
true };
1662 if( coupledIdx != maxIdx )
1663 return { coupledIdx,
false };
1665 return { maxIdx,
true };
1685 m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
1688 m_frame->GetCanvas()->Refresh();
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
int GetCount() const
Return the number of objects in the list.
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
A base class for most all the KiCad significant classes used in schematics and boards.
A general implementation of a COLLECTORS_GUIDE.
void SetPreferredLayer(PCB_LAYER_ID aLayer)
void SetIncludeSecondary(bool include)
Used when the right click button is pressed, or when the select tool is in effect.
void Collect(BOARD_ITEM *aItem, const std::vector< KICAD_T > &aScanList, const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
A color representation with 4 components: red, green, blue, alpha.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
An interface for classes handling user events controlling the view behavior such as zooming,...
Interpolates known relative points along a track using linear distance.
std::optional< std::pair< double, double > > ValueAt(const double s)
Lightweight class which holds a pad, via, or a routed trace outline.
void SetLine(const SHAPE_LINE_CHAIN &aLine)
Sets the source SHAPE_LINE_CHAIN of this item.
TYPE Type() const
Gets the routing item type.
int GetWidth() const
Gets the line width.
const PCB_VIA * GetVia() const
Gets the VIA associated with this item.
void SetWidth(const int aWidth)
Sets the line width.
SHAPE_LINE_CHAIN & GetLine() const
Gets the SHAPE_LINE_CHAIN associated with this item.
PCB_LAYER_ID GetStartLayer() const
Gets the start board layer for the proxied item.
void SetEffectiveNetClass(const NETCLASS *aNetClass)
Sets the effective net class for the item.
void SetLayers(const PCB_LAYER_ID aStart, const PCB_LAYER_ID aEnd=PCB_LAYER_ID::UNDEFINED_LAYER)
Sets the first and last layers associated with this item.
Handle the data for a net.
PAD_SIM_ELECTRICAL_TYPE GetSimElectricalType() const
DIFF_PHASE_SKEW_SETTINGS m_DiffPhaseSkewSettings
std::unique_ptr< PNS::ROUTING_SETTINGS > m_PnsSettings
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION showDiffPhaseSkew
Display of phase skew between differential pair tracks.
VECTOR2I GetPosition() const override
Basic class for a differential pair.
std::vector< ITEM * >::reverse_iterator rbegin()
void Add(const LINE &aLine)
std::vector< ITEM * >::reverse_iterator rend()
Base class for PNS router board items.
PnsKind Kind() const
Return the type (kind) of the item.
bool OfKind(int aKindMask) const
virtual BOARD_ITEM * BoardItem() const
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
SHAPE_LINE_CHAIN & Line()
void Reverse()
Clip the line to the nearest obstacle, traversing from the line's start vertex (0).
LINKED_ITEM * GetLink(int aIndex) const
Erase the linking information. Used to detach the line from the owning node.
Keep the router "world" - i.e.
int GetPadToDieDelay() const
const VECTOR2I & Pos() const
const DIFF_PAIR AssembleDiffPair(SEGMENT *aStart)
const ITEM_SET AssembleTuningPath(ROUTER_IFACE *aRouterIface, ITEM *aStart, SOLID **aStartPad=nullptr, SOLID **aEndPad=nullptr)
Like AssembleTrivialPath, but follows the track length algorithm, which discards segments that are fu...
const VECTOR2I & Pos() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_LINE_CHAIN Reverse() const
Reverse point order in the line chain.
virtual const VECTOR2I GetPoint(int aIndex) const override
SEG Segment(int aIndex) const
Return a copy of the aIndex-th segment in the line chain.
virtual size_t GetPointCount() const override
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
virtual const SEG GetSegment(int aIndex) const override
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
int SegmentCount() const
Return the number of segments in this line chain.
const VECTOR2I & CLastPoint() const
Return the last point in the line chain.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
constexpr extended_type Dot(const VECTOR2< T > &aVector) const
Compute dot product of self with aVector.
@ DIFF_PAIR_GAP_CONSTRAINT
double m_DiffSkewColourInterpolationLogStrength
The logarithmic weighting factor to apply to colour interpolation in the diff phase overlay tool.
double m_DiffSkewTrackGapInflation
The multiplier of constraint diff pair gap to allow identification of coupled track segments in the d...
double m_DiffSkewTargetDiffSegmentSize
The target size (in PCB IU) of diff phase skew gradient overlay segments.
double m_DiffSkewCosThetaParallelTestValue
The value of cos(theta) between two tracks used to test for parallelism in the diff phase skew overla...
double m_DiffSkewOverlayTrackInflation
The multiplier of underlying track size applied to the diff phase skew overlay.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
char * GetLine(FILE *File, char *Line, int *LineNum, int SizeLine)
Read one line line from aFile.
Builds the length / delay calculation items from a given path.
Used to represent the results of a call to CalculateLengthDetails, including inferred via-in-pad deta...
int64_t InferredEndViaLength
The length of an inferred end via-in-pad.
int64_t InferredStartViaLength
The length of an inferred start via-in-pad.
int64_t InferredEndViaDelay
The delay of an inferred end via-in-pad.
std::vector< std::pair< int64_t, int64_t > > LengthsAndDelays
Per-item lengths and delays.
int64_t InferredStartViaDelay
The delay of an inferred start via-in-pad.
Struct to represent one segment where tracks run parallel, including information about absolute and r...
VECTOR2I endA
The ending coordinate of the run on track A.
std::optional< double > startViaLengthB
std::optional< double > endViaDelayA
std::optional< double > startViaLengthA
double endDelayA
Cumulative delay of track A at the start of the parallel run.
double startLenA
Cumulative length of track A at the start of the parallel run.
size_t segB
The index of the parallel segment on track B.
VECTOR2I startA
The starting coordinate of the run on track A.
std::optional< double > startViaDelayB
std::optional< double > startViaDelayA
VECTOR2I startB
The starting coordinate of the run on track B.
std::optional< double > endViaDelayB
double ta0
Normalised values of the start (0) and end (1) coordinates on track A and B These are normalised to t...
double startDelayA
Cumulative delay of track A at the start of the parallel run.
std::optional< double > endViaLengthA
double startLenB
Cumulative length of track B at the start of the parallel run.
double endLenA
Cumulative length of track A at the end of the parallel run.
double endDelayB
Cumulative delay of track A at the start of the parallel run.
double startDelayB
Cumulative delay of track A at the start of the parallel run.
double endLenB
Cumulative length of track B at the end of the parallel run.
size_t segA
The index of the parallel segment on track A.
VECTOR2I endB
The ending coordinate of the run on track B.
std::optional< double > endViaLengthB
Struct to control which optimisations the length calculation code runs on the given path objects.
KIGFX::COLOR4D m_UnknownSkewColor
KIGFX::COLOR4D m_NegativeSkewColor
KIGFX::COLOR4D m_ZeroSkewColor
KIGFX::COLOR4D m_PositiveSkewColor
static VECTOR2I SnapToNearestTrack(const VECTOR2I &aP, BOARD *aBoard, NETINFO_ITEM *aNet, PCB_TRACK **aNearestTrack)
static LINKED_ITEM * PickSegment(ROUTER *aRouter, const VECTOR2I &aWhere, int aLayer, VECTOR2I &aPointOut, const SHAPE_LINE_CHAIN &aBaseline=SHAPE_LINE_CHAIN())
Represents a single line in the tuning profile configuration grid.
bool m_EnableTimeDomainTuning
wxString result
Test unit parsing edge cases and error handling.
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Casted dyn_cast(From aObject)
A lightweight dynamic downcast.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D