KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_diff_pair.h
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2013-2015 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22
23#ifndef __PNS_DIFF_PAIR_H
24#define __PNS_DIFF_PAIR_H
25
26#include <core/minoptmax.h>
27#include <vector>
28
29#include "pns_line.h"
30#include "pns_via.h"
31#include "pns_link_holder.h"
32
33#include "ranged_num.h"
34
35namespace PNS {
36
37class DIFF_PAIR;
39
41
42/* Diff pair dimensions on a single layer */
44{
45public:
46 DP_DIMENSIONS( int aWidth = 0, int aGap = 0, int aViaGap = 0, int aViaDiameter = 0, int aMinClearance = 0 ) :
47 m_width( aWidth ),
48 m_gap( aGap ),
49 m_viaGap( aViaGap ),
50 m_viaDiameter( aViaDiameter ),
51 m_minClearance( aMinClearance )
52 {
53 }
54
55 int Width() const { return m_width; }
56 int Gap() const { return m_gap; }
57 int ViaGap() const { return m_viaGap; }
58 int ViaDiameter() const { return m_viaDiameter; }
59 int MinClearance() const { return m_minClearance; }
60
61 void SetGap( int aGap ) { m_gap = aGap; }
62
63 void SetGapConstraint( const DP_GAP_CONSTRAINT& aGapConstraint ) { m_gapConstraint = aGapConstraint; }
64
65 void SetMinClearance( int aClearance ) { m_minClearance = aClearance; }
66
68
69 const wxString Format() const;
70
71private:
73 int m_gap;
78};
79
86{
87public:
88 DP_GATEWAY( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN, bool aIsDiagonal,
89 int aAllowedEntryAngles = DIRECTION_45::ANG_OBTUSE, int aPriority = 0, int aDirectionMask = 0,
90 const wxString aName = wxT( "" ) ) :
91 m_anchorP( aAnchorP ),
92 m_anchorN( aAnchorN ),
93 m_isDiagonal( aIsDiagonal ),
94 m_allowedEntryAngles( aAllowedEntryAngles ),
95 m_priority( aPriority ),
96 m_directionMask( aDirectionMask ),
97 m_name( aName )
98 {
99 m_hasEntryLines = false;
100 }
101
103 {
104
105 }
106
108 {
109 }
110
111 void SetDimensions( const DP_DIMENSIONS& aDims ) { m_dims = aDims; }
112
114 {
115 m_directionMask = aPrimDir.Mask();
116 }
117
119 {
120 m_directionMask |= aPrimDir.Mask();
121 }
122
123 bool HasPrimaryDirection() const { return m_directionMask != 0; }
124
126 {
127 return m_directionMask;
128 }
129
130 const DP_DIMENSIONS& Dimensions() const { return m_dims; }
131 void SetDirections( DIRECTION_45 dP, DIRECTION_45 dN ) { m_dirP = dP; m_dirN = dN; }
132
136 bool IsDiagonal() const
137 {
138 return m_isDiagonal;
139 }
140
141 void SetName( const wxString& aName) { m_name = aName; }
142 const wxString GetName() const;
143
144 const VECTOR2I& AnchorP() const { return m_anchorP; }
145
146 const VECTOR2I& AnchorN() const { return m_anchorN; }
147
151 int AllowedAngles () const { return m_allowedEntryAngles; }
152
156 int Priority() const
157 {
158 return m_priority;
159 }
160
161 void SetPriority(int aPriority)
162 {
163 m_priority = aPriority;
164 }
165
166 void SetEntryLines( const SHAPE_LINE_CHAIN& aEntryP, const SHAPE_LINE_CHAIN& aEntryN )
167 {
168 m_entryP = aEntryP;
169 m_entryN = aEntryN;
170 m_hasEntryLines = true;
171 }
172
173 void SetAnchors( const VECTOR2I& aP, const VECTOR2I& aN )
174 {
175 m_anchorP = aP;
176 m_anchorN = aN;
177 }
178
179 const SHAPE_LINE_CHAIN& EntryP() const { return m_entryP; }
180 const SHAPE_LINE_CHAIN& EntryN() const { return m_entryN; }
181 const DIFF_PAIR Entry() const ;
182
183 void Reverse();
184
185 bool HasEntryLines () const
186 {
187 return m_hasEntryLines;
188 }
189
190 std::optional<DP_GATEWAY> Extend( int aLength );
191 std::optional<DP_GATEWAY> AddTurns( bool aSide, bool a90Deg, bool aLeft, bool aWiggle );
192
193 DIRECTION_45 DirP() const { return m_dirP; };
194 DIRECTION_45 DirN() const { return m_dirN; };
195
196private:
206 wxString m_name;
207};
208
213{
214public:
215 static constexpr double DP_ASSUME_PRIMS_COLINEAR_FACTOR = 0.1;
216
218 m_primP( nullptr ), m_primN( nullptr ) {};
219
220 DP_PRIMITIVE_PAIR( const DP_PRIMITIVE_PAIR& aOther );
221 DP_PRIMITIVE_PAIR( ITEM* aPrimP, ITEM* aPrimN );
222 DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN );
223
225
226 void SetAnchors( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN );
227 void SetPrimitives(ITEM* aPrimP, ITEM* aPrimN );
228 const VECTOR2I& AnchorP() const { return m_anchorP; }
229 const VECTOR2I& AnchorN() const { return m_anchorN; }
230
232
233 ITEM* PrimP() const { return m_primP; }
234 ITEM* PrimN() const { return m_primN; }
235
236 bool Directional() const;
237
238 DIRECTION_45 DirP() const;
239 DIRECTION_45 DirN() const;
240
241
242 void CursorOrientation( const VECTOR2I& aCursorPos, VECTOR2I& aMidpoint,
243 VECTOR2I& aDirection ) const;
244
245 void SetIsMidtrace( bool aMidtrace )
246 {
247 m_isMidtrace = aMidtrace;
248 }
249
250 bool IsMidtrace() const
251 {
252 return m_isMidtrace;
253 }
254
255 void Unlink()
256 {
257 m_primP = m_primN = nullptr;
258 }
259
260 void SetName( const wxString& aName ) { m_name = aName; }
261 const wxString& GetName() const { return m_name; }
262
263 bool HasDefinedGap() const { return m_gap.has_value(); }
264 int GetGap() const { return *m_gap; }
265 void SetGap( int aGap ) { m_gap = aGap; }
266
268 {
269 m_fixedDirection = aDir;
270 }
271
272 bool HasFixedDirection() const {
273 return m_fixedDirection.has_value();
274 }
275
277 {
278 return m_fixedDirection.value();
279 }
280
281 // returns the minimum dimension of the parent objects (be that width/height, thickness, radius)
282 int GetMinDimension() const;
283
284private:
285 DIRECTION_45 anchorDirection( const ITEM* aItem, const VECTOR2I& aP ) const;
286
291 std::optional<DIRECTION_45> m_fixedDirection;
292 wxString m_name;
293 std::optional<int> m_gap;
294};
295
300{
301public:
303 m_dims( aDims )
304 {
305 // Do not leave uninitialized members, and keep static analyzer quiet:
306 m_fitVias = false;
307 }
308
309 void Clear() { m_gateways.clear(); }
310
311 void SetFitVias( bool aEnable )
312 {
313 m_fitVias = aEnable;
314 }
315
316 bool FittingVias() const {
317 return m_fitVias;
318 }
319
320 void BuildForCursor( const VECTOR2I& aCursorPos, int aDirectionMask = -1 );
321 void BuildOrthoProjections( DP_GATEWAYS& aEntries, const VECTOR2I& aCursorPos, int aOrthoScore );
322 void BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, int aColinearityThreshold = 0,
323 bool aBuildEntries = false, bool aViaMode = false );
324 void BuildFromPrimitivePair( const DP_PRIMITIVE_PAIR& aPair, bool aPreferDiagonal );
325
338
339 std::vector<FIT_RESULT> FitGateways( DP_GATEWAYS& aEntry, DP_GATEWAYS& aTarget, bool aFitVias );
340
341 std::vector<DP_GATEWAY>& Gateways() { return m_gateways; }
342
343 const std::vector<DP_GATEWAY>& CGateways() const { return m_gateways; }
344
345 void FilterByOrientation( int aDirectionMask );
346
347 void SetDimensions( const DP_DIMENSIONS& aDims )
348 {
349 m_dims = aDims;
350 for( auto& gw : m_gateways )
351 gw.SetDimensions( aDims );
352 }
353
354private:
355
356 void addGateway( DP_GATEWAY& aGw, const wxString&name = wxT(""), bool aAddTurns = false );
357
364
365 bool checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const;
366 void buildDpContinuation( const DP_PRIMITIVE_PAIR& aPair, bool aIsDiagonal );
367
368 void buildEntries( DP_GATEWAY& aGw, const VECTOR2I& p0_p, const VECTOR2I& p0_n );
369 void buildFromPads( const DP_PRIMITIVE_PAIR& aPair );
370
373 std::vector<DP_GATEWAY> m_gateways;
374};
375
376
381class DIFF_PAIR : public LINK_HOLDER
382{
383public:
384
385 static constexpr int DP_PARALLELITY_THRESHOLD = 10;
386
388 {
389 COUPLED_SEGMENTS ( const SEG& aCoupledP, const SEG& aParentP, int aIndexP,
390 const SEG& aCoupledN, const SEG& aParentN, int aIndexN ) :
391 coupledP( aCoupledP ),
392 coupledN( aCoupledN ),
393 parentP( aParentP ),
394 parentN( aParentN ),
395 indexP( aIndexP ),
396 indexN( aIndexN ),
397 linkP( nullptr ),
398 linkN( nullptr )
399 {}
400
409 };
410
411 typedef std::vector<COUPLED_SEGMENTS> COUPLED_SEGMENTS_VEC;
412
415 m_hasVias( false )
416 {
417 // Initialize other members, to avoid uninitialized variables.
418 m_net_p = nullptr;
419 m_net_n = nullptr;
421 m_chamferLimit = 0;
422 m_dims = aDims;
423 }
424
425 DIFF_PAIR( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, const DP_DIMENSIONS& aDims = DP_DIMENSIONS() ) :
427 m_n( aN ),
428 m_p( aP ),
429 m_dims( aDims ),
430 m_hasVias( false )
431 {
432 // Initialize other members, to avoid uninitialized variables.
433 m_net_p = nullptr;
434 m_net_n = nullptr;
436 m_chamferLimit = 0;
437 }
438
439 DIFF_PAIR( const LINE &aLineP, const LINE &aLineN, const DP_DIMENSIONS& aDims = DP_DIMENSIONS() ) :
441 m_line_p( aLineP ),
442 m_line_n( aLineN ),
443 m_dims( aDims ),
444 m_hasVias( false )
445 {
446 m_net_p = aLineP.Net();
447 m_net_n = aLineN.Net();
448 m_p = aLineP.CLine();
449 m_n = aLineN.CLine();
450
451 // Do not leave uninitialized members, and keep static analyzer quiet:
453 m_chamferLimit = 0;
454 }
455
456 DIFF_PAIR( const DIFF_PAIR& aOther ) :
458 {
459 *this = aOther;
460 }
461
462 static inline bool ClassOf( const ITEM* aItem )
463 {
464 return aItem && ITEM::DIFF_PAIR_T == aItem->Kind();
465 }
466
467 DIFF_PAIR* Clone() const override
468 {
469 assert( false );
470 return nullptr;
471 }
472
473 // Copy operator
474 DIFF_PAIR& operator=( const DIFF_PAIR& aOther )
475 {
476 m_n = aOther.m_n;
477 m_p = aOther.m_p;
478 m_line_n = aOther.m_line_n;
479 m_line_p = aOther.m_line_p;
480 m_via_n = aOther.m_via_n;
481 m_via_p = aOther.m_via_p;
482 m_layers = aOther.m_layers;
483 m_hasVias = aOther.m_hasVias;
484 m_net_n = aOther.m_net_n;
485 m_net_p = aOther.m_net_p;
486 m_dims = aOther.m_dims;
489 return *this;
490 }
491
492 // Move assignment operator
493 DIFF_PAIR& operator=( DIFF_PAIR&& aOther ) noexcept
494 {
495 if (this != &aOther)
496 {
497 m_n = std::move( aOther.m_n );
498 m_p = std::move( aOther.m_p );
499 m_line_n = std::move( aOther.m_line_n );
500 m_line_p = std::move( aOther.m_line_p );
501 m_via_n = aOther.m_via_n;
502 m_via_p = aOther.m_via_p;
503 m_layers = aOther.m_layers;
504 m_hasVias = aOther.m_hasVias;
505 m_net_n = aOther.m_net_n;
506 m_net_p = aOther.m_net_p;
507 m_dims = aOther.m_dims;
508 m_maxUncoupledLength = aOther.m_maxUncoupledLength;
509 m_chamferLimit = aOther.m_chamferLimit;
510 }
511
512 return *this;
513 }
514
515 void SetDimensions( const DP_DIMENSIONS& aDims ) { m_dims = aDims; }
516
517 void SetGap( int aGap )
518 {
519 m_dims.SetGap( aGap );
520 }
521
522 virtual void ClearLinks() override
523 {
524 m_links.clear();
525 m_line_p.ClearLinks();
526 m_line_n.ClearLinks();
527 }
528
529 void SetShape( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, bool aSwapLanes = false )
530 {
531 if( aSwapLanes )
532 {
533 m_p = aN;
534 m_n = aP;
535 }
536 else
537 {
538 m_p = aP;
539 m_n = aN;
540 }
541 }
542
543 void SetShape( const DIFF_PAIR& aPair )
544 {
545 m_p = aPair.m_p;
546 m_n = aPair.m_n;
547 }
548
550 {
551 m_net_p = aP;
552 m_net_n = aN;
553 }
554
555 void AppendVias( const VIA &aViaP, const VIA& aViaN )
556 {
557 m_hasVias = true;
558 m_via_p = aViaP;
559 m_via_p.SetHole( aViaP.Hole()->Clone() );
560 m_via_n = aViaN;
561 m_via_n.SetHole( aViaN.Hole()->Clone() );
562 }
563
565 {
566 m_hasVias = false;
567 m_line_n.RemoveVia();
568 m_line_p.RemoveVia();
569 }
570
571 bool EndsWithVias() const
572 {
573 return m_hasVias;
574 }
575
576 void SetViaDiameter( int aDiameter )
577 {
578 m_via_p.SetDiameter( VIA::ALL_LAYERS, aDiameter );
579 m_via_n.SetDiameter( VIA::ALL_LAYERS, aDiameter );
580 }
581
582 void SetViaDrill( int aDrill )
583 {
584 m_via_p.SetDrill( aDrill );
585 m_via_n.SetDrill( aDrill );
586 }
587
589 {
590 return m_net_p;
591 }
592
594 {
595 return m_net_n;
596 }
597
599 {
600 if( !m_line_p.IsLinked() )
602
603 return m_line_p;
604 }
605
607 {
608 if( !m_line_n.IsLinked() )
610
611 return m_line_n;
612 }
613
615
616 double CoupledLength() const;
617 double TotalLength() const;
618 double Skew() const;
619
620
622 bool aUseGapConstraint = true,
623 const std::optional<DP_GAP_CONSTRAINT>& aOverrideGapConstraint = std::optional<DP_GAP_CONSTRAINT>() ) const;
624
625 void Clear()
626 {
627 m_n.Clear();
628 m_p.Clear();
629 }
630
631 void Append( const DIFF_PAIR& aOther )
632 {
633 m_n.Append( aOther.m_n );
634 m_p.Append( aOther.m_p );
635 }
636
637 bool Empty() const
638 {
639 return ( m_n.SegmentCount() == 0 ) || ( m_p.SegmentCount() == 0 );
640 }
641
642 const SHAPE_LINE_CHAIN& CP() const { return m_p; }
643 const SHAPE_LINE_CHAIN& CN() const { return m_n; }
644
645 bool BuildInitial( const DP_GATEWAY& aEntry, const DP_GATEWAY& aTarget, bool aPrefDiagonal, bool aFitVias, float& aBestCouplingRatio, float& aAspectRatio );
646 bool CheckConnectionAngle( const DIFF_PAIR &aOther, int allowedAngles ) const;
647 int CoupledLength( const SEG& aP, const SEG& aN ) const;
648
649 std::pair<int64_t, bool> CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const;
650
652 {
653 return m_dims.GapConstraint();
654 }
655
656 void SetLines( const LINE& aP, const LINE& aN )
657 {
658 m_line_p = aP;
659 m_line_n = aN;
660 }
661
662 std::optional<DP_PRIMITIVE_PAIR> BuildMidpairIntersection( PNS::SEGMENT* aStartSeg, const VECTOR2I& aP );
663
664 int GuessMostLikelyGap() const;
665 const DP_DIMENSIONS& Dimensions() const { return m_dims; }
666
667 DIRECTION_45 DirP( bool aEnd ) const { return getDirection( true, aEnd ); }
668 DIRECTION_45 DirN( bool aEnd ) const { return getDirection( false, aEnd ); }
669
670private:
671
672 DIRECTION_45 getDirection( bool aIsP, bool aEnd ) const;
673
674 void updateLine( LINE &aLine, const SHAPE_LINE_CHAIN& aShape, NET_HANDLE aNet, const VIA& aVia )
675 {
676 aLine.SetShape( aShape );
677 aLine.SetWidth( m_dims.Width() );
678 aLine.SetNet( aNet );
679 aLine.SetLayer( Layers().Start() );
680 aLine.SetParent( m_parent );
682
683 if( m_hasVias )
684 aLine.AppendVia( aVia );
685 }
686
690
696};
697
698}
699
700#endif
const char * name
Represent route directions & corner angles in a 45-degree metric.
Definition direction45.h:37
int Mask() const
Basic class for a differential pair.
bool CheckConnectionAngle(const DIFF_PAIR &aOther, int allowedAngles) const
void AppendVias(const VIA &aViaP, const VIA &aViaN)
SHAPE_LINE_CHAIN m_p
const SHAPE_LINE_CHAIN & CN() const
DIRECTION_45 DirP(bool aEnd) const
DP_PRIMITIVE_PAIR EndingPrimitives()
std::vector< COUPLED_SEGMENTS > COUPLED_SEGMENTS_VEC
NET_HANDLE m_net_p
double CoupledLength() const
void Append(const DIFF_PAIR &aOther)
void SetLines(const LINE &aP, const LINE &aN)
double Skew() const
void SetDimensions(const DP_DIMENSIONS &aDims)
void SetViaDiameter(int aDiameter)
const DP_DIMENSIONS & Dimensions() const
DP_DIMENSIONS m_dims
DIFF_PAIR(const DP_DIMENSIONS &aDims=DP_DIMENSIONS())
bool BuildInitial(const DP_GATEWAY &aEntry, const DP_GATEWAY &aTarget, bool aPrefDiagonal, bool aFitVias, float &aBestCouplingRatio, float &aAspectRatio)
void updateLine(LINE &aLine, const SHAPE_LINE_CHAIN &aShape, NET_HANDLE aNet, const VIA &aVia)
int GuessMostLikelyGap() const
double TotalLength() const
void SetViaDrill(int aDrill)
virtual void ClearLinks() override
Return the number of segments that were assembled together to form this line.
void SetShape(const DIFF_PAIR &aPair)
void SetShape(const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN &aN, bool aSwapLanes=false)
DIFF_PAIR(const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN &aN, const DP_DIMENSIONS &aDims=DP_DIMENSIONS())
bool EndsWithVias() const
NET_HANDLE NetP() const
DIFF_PAIR(const LINE &aLineP, const LINE &aLineN, const DP_DIMENSIONS &aDims=DP_DIMENSIONS())
DIFF_PAIR & operator=(const DIFF_PAIR &aOther)
NET_HANDLE m_net_n
bool Empty() const
DIFF_PAIR * Clone() const override
Return a deep copy of the item.
std::optional< DP_PRIMITIVE_PAIR > BuildMidpairIntersection(PNS::SEGMENT *aStartSeg, const VECTOR2I &aP)
static bool ClassOf(const ITEM *aItem)
DIRECTION_45 getDirection(bool aIsP, bool aEnd) const
void SetGap(int aGap)
SHAPE_LINE_CHAIN m_n
static constexpr int DP_PARALLELITY_THRESHOLD
void SetNets(NET_HANDLE aP, NET_HANDLE aN)
DIFF_PAIR(const DIFF_PAIR &aOther)
DIFF_PAIR & operator=(DIFF_PAIR &&aOther) noexcept
const SHAPE_LINE_CHAIN & CP() const
void CoupledSegmentPairs(COUPLED_SEGMENTS_VEC &aPairs, bool aUseGapConstraint=true, const std::optional< DP_GAP_CONSTRAINT > &aOverrideGapConstraint=std::optional< DP_GAP_CONSTRAINT >()) const
DIRECTION_45 DirN(bool aEnd) const
const DP_GAP_CONSTRAINT GapConstraint() const
NET_HANDLE NetN() const
int ViaDiameter() const
void SetMinClearance(int aClearance)
const wxString Format() const
void SetGapConstraint(const DP_GAP_CONSTRAINT &aGapConstraint)
void SetGap(int aGap)
DP_DIMENSIONS(int aWidth=0, int aGap=0, int aViaGap=0, int aViaDiameter=0, int aMinClearance=0)
DP_GAP_CONSTRAINT m_gapConstraint
int MinClearance() const
const DP_GAP_CONSTRAINT & GapConstraint() const
A set of gateways calculated for the cursor or starting/ending primitive pair.
void BuildForCursor(const VECTOR2I &aCursorPos, int aDirectionMask=-1)
DP_GATEWAYS(const DP_DIMENSIONS &aDims=DP_DIMENSIONS())
void BuildGeneric(const VECTOR2I &p0_p, const VECTOR2I &p0_n, int aColinearityThreshold=0, bool aBuildEntries=false, bool aViaMode=false)
void BuildFromPrimitivePair(const DP_PRIMITIVE_PAIR &aPair, bool aPreferDiagonal)
void FilterByOrientation(int aDirectionMask)
void buildEntries(DP_GATEWAY &aGw, const VECTOR2I &p0_p, const VECTOR2I &p0_n)
void addGateway(DP_GATEWAY &aGw, const wxString &name=wxT(""), bool aAddTurns=false)
std::vector< DP_GATEWAY > & Gateways()
bool checkDiagonalAlignment(const VECTOR2I &a, const VECTOR2I &b) const
void SetFitVias(bool aEnable)
void BuildOrthoProjections(DP_GATEWAYS &aEntries, const VECTOR2I &aCursorPos, int aOrthoScore)
void buildDpContinuation(const DP_PRIMITIVE_PAIR &aPair, bool aIsDiagonal)
void buildFromPads(const DP_PRIMITIVE_PAIR &aPair)
std::vector< DP_GATEWAY > m_gateways
const std::vector< DP_GATEWAY > & CGateways() const
DP_DIMENSIONS m_dims
bool FittingVias() const
void SetDimensions(const DP_DIMENSIONS &aDims)
std::vector< FIT_RESULT > FitGateways(DP_GATEWAYS &aEntry, DP_GATEWAYS &aTarget, bool aFitVias)
Define a "gateway" for routing a differential pair - e.g.
SHAPE_LINE_CHAIN m_entryP
DIRECTION_45 m_dirP
bool HasPrimaryDirection() const
bool IsDiagonal() const
std::optional< DP_GATEWAY > AddTurns(bool aSide, bool a90Deg, bool aLeft, bool aWiggle)
const DP_DIMENSIONS & Dimensions() const
void SetName(const wxString &aName)
const SHAPE_LINE_CHAIN & EntryP() const
bool HasEntryLines() const
int AllowedAngles() const
DP_GATEWAY(const VECTOR2I &aAnchorP, const VECTOR2I &aAnchorN, bool aIsDiagonal, int aAllowedEntryAngles=DIRECTION_45::ANG_OBTUSE, int aPriority=0, int aDirectionMask=0, const wxString aName=wxT(""))
const VECTOR2I & AnchorN() const
void SetAnchors(const VECTOR2I &aP, const VECTOR2I &aN)
int PrimaryDirectionMask() const
SHAPE_LINE_CHAIN m_entryN
void AddPrimaryDirection(DIRECTION_45 aPrimDir)
DIRECTION_45 DirN() const
DIRECTION_45 DirP() const
void SetDimensions(const DP_DIMENSIONS &aDims)
void SetEntryLines(const SHAPE_LINE_CHAIN &aEntryP, const SHAPE_LINE_CHAIN &aEntryN)
const VECTOR2I & AnchorP() const
const SHAPE_LINE_CHAIN & EntryN() const
DP_DIMENSIONS m_dims
const DIFF_PAIR Entry() const
std::optional< DP_GATEWAY > Extend(int aLength)
void SetPrimaryDirection(DIRECTION_45 aPrimDir)
DIRECTION_45 m_dirN
const wxString GetName() const
int Priority() const
void SetDirections(DIRECTION_45 dP, DIRECTION_45 dN)
void SetPriority(int aPriority)
Store starting/ending primitives (pads, vias or segments) for a differential pair.
DIRECTION_45 DirN() const
const VECTOR2I & AnchorN() const
DIRECTION_45 FixedDirection() const
std::optional< DIRECTION_45 > m_fixedDirection
bool HasFixedDirection() const
static constexpr double DP_ASSUME_PRIMS_COLINEAR_FACTOR
const VECTOR2I & AnchorP() const
void SetIsMidtrace(bool aMidtrace)
void SetFixedDirection(DIRECTION_45 aDir)
DIRECTION_45 anchorDirection(const ITEM *aItem, const VECTOR2I &aP) const
void CursorOrientation(const VECTOR2I &aCursorPos, VECTOR2I &aMidpoint, VECTOR2I &aDirection) const
DP_PRIMITIVE_PAIR & operator=(const DP_PRIMITIVE_PAIR &aOther)
void SetName(const wxString &aName)
const wxString & GetName() const
void SetPrimitives(ITEM *aPrimP, ITEM *aPrimN)
std::optional< int > m_gap
void SetAnchors(const VECTOR2I &aAnchorP, const VECTOR2I &aAnchorN)
DIRECTION_45 DirP() const
virtual HOLE * Clone() const override
Return a deep copy of the item.
Definition pns_hole.cpp:41
Base class for PNS router board items.
Definition pns_item.h:98
BOARD_ITEM * m_sourceItem
Definition pns_item.h:319
void SetSourceItem(BOARD_ITEM *aSourceItem)
Definition pns_item.h:201
const PNS_LAYER_RANGE & Layers() const
Definition pns_item.h:212
virtual NET_HANDLE Net() const
Definition pns_item.h:210
PNS_LAYER_RANGE m_layers
Definition pns_item.h:323
PnsKind Kind() const
Return the type (kind) of the item.
Definition pns_item.h:173
void SetNet(NET_HANDLE aNet)
Definition pns_item.h:209
void SetLayer(int aLayer)
Definition pns_item.h:215
@ DIFF_PAIR_T
Definition pns_item.h:110
void SetParent(BOARD_ITEM *aParent)
Definition pns_item.h:191
BOARD_ITEM * m_parent
Definition pns_item.h:317
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition pns_line.h:62
void SetShape(const SHAPE_LINE_CHAIN &aLine)
Return the shape of the line.
Definition pns_line.h:135
const SHAPE_LINE_CHAIN & CLine() const
Definition pns_line.h:146
void AppendVia(const VIA &aVia)
void SetWidth(int aWidth)
Return line width.
Definition pns_line.h:159
virtual HOLE * Hole() const override
Definition pns_via.h:340
static constexpr int ALL_LAYERS
Definition pns_via.h:78
Definition seg.h:38
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Push and Shove diff pair dimensions (gap) settings dialog.
MINOPTMAX< int > DP_GAP_CONSTRAINT
void * NET_HANDLE
Definition pns_item.h:55
COUPLED_SEGMENTS(const SEG &aCoupledP, const SEG &aParentP, int aIndexP, const SEG &aCoupledN, const SEG &aParentN, int aIndexN)
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683