91 "net for length tuning. Make sure the names of the nets "
92 "belonging to a differential pair end with either _N/_P "
141 return std::max( totalP, totalN );
201 if( coupledSegments.size() == 0 )
217 int offset = ( tuned.
Gap() + tuned.
Width() ) / 2;
226 if(
const LINE* l = dyn_cast<const LINE*>( item ) )
228 PNS_DBG(
Dbg(), AddShape, &l->CLine(),
YELLOW, 10000, wxT(
"tuned-path-p" ) );
236 if(
const LINE* l = dyn_cast<const LINE*>( item ) )
238 PNS_DBG(
Dbg(), AddShape, &l->CLine(),
YELLOW, 10000, wxT(
"tuned-path-n" ) );
244 int curIndexP = 0, curIndexN = 0;
252 while( sp.indexP >= curIndexP && curIndexP != -1 )
256 ssize_t arcIndex = tunedP.
ArcIndex( curIndexP );
265 curIndexP = tunedP.
NextShape( curIndexP );
268 while( sp.indexN >= curIndexN && curIndexN != -1 )
272 ssize_t arcIndex = tunedN.
ArcIndex( curIndexN );
281 curIndexN = tunedN.
NextShape( curIndexN );
287 while( curIndexP < tunedP.
PointCount() && curIndexP != -1 )
291 ssize_t arcIndex = tunedP.
ArcIndex( curIndexP );
300 curIndexP = tunedP.
NextShape( curIndexP );
303 while( curIndexN < tunedN.
PointCount() && curIndexN != -1 )
307 ssize_t arcIndex = tunedN.
ArcIndex( curIndexN );
316 curIndexN = tunedN.
NextShape( curIndexN );
343 tunedP.
Append( m->CLine( 0 ) );
344 tunedN.
Append( m->CLine( 1 ) );
416 int w = aShape->
Width();
462 status =
_(
"Too long: " );
465 status =
_(
"Too short: " );
468 status =
_(
"Tuned: " );
475 status += wxT(
"/" );
477 status += wxT(
" (gap: " );
479 status += wxT(
")" );
constexpr EDA_IU_SCALE pcbIUScale
ROUTER * Router() const
Return current router settings.
DEBUG_DECORATOR * Dbg() const
Basic class for a differential pair.
const SHAPE_LINE_CHAIN & CN() const
std::vector< COUPLED_SEGMENTS > COUPLED_SEGMENTS_VEC
void SetShape(const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN &aN, bool aSwapLanes=false)
const SHAPE_LINE_CHAIN & CP() const
void CoupledSegmentPairs(COUPLED_SEGMENTS_VEC &aPairs) const
bool Start(const VECTOR2I &aP, ITEM *aStartItem) override
Start routing a single track at point aP, taking item aStartItem as anchor (unless NULL).
bool CheckFit(MEANDER_SHAPE *aShape) override
Checks if it's OK to place the shape aShape (i.e.
const ITEM_SET Traces() override
Function Traces()
SHAPE_LINE_CHAIN m_finalShapeP
bool AbortPlacement() override
bool pairOrientation(const DIFF_PAIR::COUPLED_SEGMENTS &aPair)
const std::vector< int > CurrentNets() const override
Function CurrentNets()
DP_MEANDER_PLACER(ROUTER *aRouter)
SHAPE_LINE_CHAIN m_finalShapeN
VECTOR2I m_currentStart
Current world state.
bool FixRoute(const VECTOR2I &aP, ITEM *aEndItem, bool aForceFinish=false) override
Commit the currently routed track to the parent node, taking aP as the final end point and aEndItem a...
int CurrentLayer() const override
Function CurrentLayer()
TUNING_STATUS TuningStatus() const override
Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.
const SEG baselineSegment(const DIFF_PAIR::COUPLED_SEGMENTS &aCoupledSegs)
TUNING_STATUS m_lastStatus
const wxString TuningInfo(EDA_UNITS aUnits) const override
Return a string describing the status and length of the tuned traces.
bool HasPlacedAnything() const override
bool CommitPlacement() override
bool Move(const VECTOR2I &aP, ITEM *aEndItem) override
Move the end of the currently routed trace to the point aP, taking aEndItem as anchor (if not NULL).
const VECTOR2I & CurrentEnd() const override
Function CurrentEnd()
long long int m_lastLength
const VECTOR2I & CurrentStart() const override
Function CurrentStart()
LINKED_ITEM * m_initialSegment
long long int origPathLength() const
Current routing start point (end of tail, beginning of head).
NODE * CurrentNode(bool aLoopsRemoved=false) const override
Return the most recent world state.
void Add(const LINE &aLine)
const std::vector< ITEM * > & CItems() const
Base class for PNS router board items.
const LAYER_RANGE & Layers() const
bool OfKind(int aKindMask) const
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
LINKED_ITEM * GetLink(int aIndex) const
Erase the linking information. Used to detach the line from the owning node.
Represent a set of meanders fitted over a single or two lines.
void SetBaselineOffset(int aOffset)
Set the parallel offset between the base segment and the meandered line.
void SetWidth(int aWidth)
Set the line width.
void AddCorner(const VECTOR2I &aA, const VECTOR2I &aB=VECTOR2I(0, 0))
Create a dummy meander shape representing a line corner.
void MeanderSegment(const SEG &aSeg, bool aSide, int aBaseIndex=0)
Fit maximum amplitude meanders on a given segment and adds to the current line.
void AddArcAndPt(const SHAPE_ARC &aArc1, const VECTOR2I &aPt2)
Create a dummy meander shape representing an arc corner.
bool CheckSelfIntersections(MEANDER_SHAPE *aShape, int aClearance)
Check if the given shape is intersecting with any other meander in the current line.
std::vector< MEANDER_SHAPE * > & Meanders()
void AddPtAndArc(const VECTOR2I &aPt1, const SHAPE_ARC &aArc2)
Create a dummy meander shape representing an arc corner.
Base class for Single trace & Differential pair meandering tools, as both of them share a lot of code...
void tuneLineLength(MEANDERED_LINE &aTuned, long long int aElongation)
Take a set of meanders in aTuned and tunes their length to extend the original line length by aElonga...
TUNING_STATUS
< Result of the length tuning operation
int m_currentWidth
Meander settings.
void cutTunedLine(const SHAPE_LINE_CHAIN &aOrigin, const VECTOR2I &aTuneStart, const VECTOR2I &aCursorPos, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aTuned, SHAPE_LINE_CHAIN &aPost)
Extract the part of a track to be meandered, depending on the starting point and the cursor position.
MEANDER_SETTINGS m_settings
The current end point.
int compareWithTolerance(long long int aValue, long long int aExpected, long long int aTolerance=0) const
Compare aValue against aExpected with given tolerance.
NODE * m_world
Width of the meandered trace(s).
VECTOR2I getSnappedStartPoint(LINKED_ITEM *aStartItem, VECTOR2I aStartPoint)
long long int lineLength(const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad) const
Calculate the total length of the line represented by an item set (tracks and vias)
long long int m_targetLength
Type of corners for the meandered line.
int m_lengthTolerance
Target skew value for diff pair de-skewing.
int m_spacing
Amplitude/spacing adjustment step.
The geometry of a single meander.
const SHAPE_LINE_CHAIN & CLine(int aShape) const
Keep the router "world" - i.e.
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
OPT_OBSTACLE CheckColliding(const ITEM *aItem, int aKindMask=ITEM::ANY_T)
Check if the item collides with anything else in the world, and if found, returns the obstacle.
bool Add(std::unique_ptr< SEGMENT > &&aSegment, bool aAllowRedundant=false)
Add an item to the current node.
void Remove(ARC *aArc)
Remove an item from this branch.
virtual void DisplayPathLine(const SHAPE_LINE_CHAIN &aLine, int aImportance)=0
ROUTER_IFACE * GetInterface() const
void SetFailureReason(const wxString &aReason)
const DIFF_PAIR AssembleDiffPair(SEGMENT *aStart)
const ITEM_SET AssembleTuningPath(ITEM *aStart, SOLID **aStartPad=nullptr, SOLID **aEndPad=nullptr)
Like AssembleTrivialPath, but follows the track length algorithm, which discards segments that are fu...
int Side(const VECTOR2I &aP) const
Determine on which side of directed line passing via segment ends point aP lies.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_ARC & Arc(size_t aArc) const
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
int NextShape(int aPointIndex, bool aForwards=true) const
Return the vertex index of the next shape in the chain, or -1 if aPointIndex is the last shape.
int PointCount() const
Return the number of points (vertices) in this line chain.
ssize_t ArcIndex(size_t aSegment) const
Return the arc index for the given segment index.
void Clear()
Remove all points from the line chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
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.
bool IsArcSegment(size_t aSegment) const
long long int Length() const
Return length of the line chain in Euclidean metric.
wxString MessageTextFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A helper to convert the double length aValue to a string in inches, millimeters, or unscaled units.
Push and Shove diff pair dimensions (gap) settings dialog.
#define PNS_DBG(dbg, method,...)