95 if( cp == aTuneStart )
102 cp += ( s.
B - s.
A ).Resize( 2 );
117 int i_start = l.
Find( m );
118 int i_end = l.
Find( n );
120 if( i_start > i_end )
123 i_start = l.
Find( m );
127 aPre = l.
Slice( 0, i_start );
128 aPost = l.
Slice( i_end, -1 );
129 aTuned = l.
Slice( i_start, i_end );
137 long long int remaining = aElongation;
138 bool finished =
false;
145 remaining -= m->MaxTunableLength() - m->BaselineLength();
158 m->SetType( newType );
171 remaining = aElongation;
172 int meanderCount = 0;
180 remaining -= m->MaxTunableLength() - m->BaselineLength();
186 long long int balance = 0;
189 balance = -remaining / meanderCount;
197 m->Resize( std::max( m->Amplitude() - balance / 2,
214 for(
auto& link : start.
LinkList() )
216 if(
const SOLID* solid =
dynamic_cast<const SOLID*
>( link.item ) )
219 if( solid->GetPadToDie() > 0 )
221 length += solid->GetPadToDie();
229 if(
const SOLID* solid =
dynamic_cast<const SOLID*
>( link.item ) )
231 if( solid->GetPadToDie() > 0 )
233 length += solid->GetPadToDie();
250 long long int aValue,
long long int aExpected,
long long int aTolerance )
const
252 if( aValue < aExpected - aTolerance )
254 else if( aValue > aExpected + aTolerance )
265 return static_cast<SEGMENT*
>( aStartItem )->Seg().NearestPoint( aStartPoint );
270 ARC* arc =
static_cast<ARC*
>( aStartItem );
272 if( (
VECTOR2I( arc->
Anchor( 0 ) - aStartPoint ) ).SquaredEuclideanNorm() <=
273 (
VECTOR2I( arc->
Anchor( 1 ) - aStartPoint ) ).SquaredEuclideanNorm() )
287 long long int total = 0;
292 const ITEM* start_item = aLine[0];
293 const ITEM* end_item = aLine[aLine.
Size() - 1];
294 bool start_via =
false;
295 bool end_via =
false;
303 start_via = aStartPad && ( !aStartPad->
LayersOverlap( start_item ) );
304 end_via = aEndPad && ( !aEndPad->
LayersOverlap( end_item ) );
306 for(
int idx = 0; idx < aLine.
Size(); idx++ )
308 const ITEM* item = aLine[idx];
310 if(
const LINE* l = dyn_cast<const LINE*>( item ) )
312 total += l->CLine().Length();
316 int layerPrev = aLine[idx - 1]->Layer();
317 int layerNext = aLine[idx + 1]->Layer();
319 if( layerPrev != layerNext )
326 int layerPrev = aStartPad->
Layer();
327 int layerNext = start_item->
Layer();
334 int layerPrev = end_item->
Layer();
335 int layerNext = aEndPad->
Layer();
ROUTER * Router() const
Return current router settings.
virtual VECTOR2I Anchor(int n) const override
const ENTRIES & CItems() const
Base class for PNS router board items.
PnsKind Kind() const
Return the type (kind) of the item.
virtual int Layer() const
bool OfKind(int aKindMask) const
Return true if the item's type matches the mask aKindMask.
bool LayersOverlap(const ITEM *aOther) const
Return true if the set of layers spanned by aOther overlaps our layers.
A 2D point on a given set of layers and belonging to a certain net, that links together a number of b...
const LINKED_ITEMS & LinkList() const
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Represent a set of meanders fitted over a single or two lines.
std::vector< MEANDER_SHAPE * > & Meanders()
virtual void UpdateSettings(const MEANDER_SETTINGS &aSettings)
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...
virtual void SpacingStep(int aSign)
Increase/decrease the current meandering spacing by one step.
int m_currentWidth
Meander settings.
int m_padToDieLength
Width of the meandered trace(s).
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_PLACER_BASE(ROUTER *aRouter)
virtual ~MEANDER_PLACER_BASE()
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.
virtual int Clearance()
Return the clearance of the track(s) being length tuned.
virtual const MEANDER_SETTINGS & MeanderSettings() const
Return the current meandering configuration.
NODE * m_world
Total length added by pad to die size.
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)
int GetTotalPadToDieLength(const LINE &aLine) const
virtual void AmplitudeStep(int aSign)
Increase/decreases the current meandering amplitude by one step.
Dimensions for the meandering algorithm.
int m_minAmplitude
Maximum meandering amplitude.
int m_step
Length PadToDie.
int m_maxAmplitude
Meandering period/spacing (see dialog picture for explanation).
int m_spacing
Amplitude/spacing adjustment step.
The geometry of a single meander.
void FindLineEnds(const LINE &aLine, JOINT &aA, JOINT &aB)
Destroy all child nodes. Applicable only to the root node.
virtual const ITEM_SET Traces()=0
Function Traces()
virtual int CurrentLayer() const =0
Function CurrentLayer()
virtual int StackupHeight(int aFirstLayer, int aSecondLayer) const =0
ROUTER_IFACE * GetInterface() const
RULE_RESOLVER * GetRuleResolver() const
virtual bool QueryConstraint(CONSTRAINT_TYPE aType, const PNS::ITEM *aItemA, const PNS::ITEM *aItemB, int aLayer, PNS::CONSTRAINT *aConstraint)=0
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.
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
int Split(const VECTOR2I &aP)
Insert the point aP belonging to one of the our segments, splitting the adjacent segment in two.
int FindSegment(const VECTOR2I &aP, int aThreshold=1) const
Search for segment containing point aP.
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Return a subset of this line chain containing the [start_index, end_index] range of points.
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Find a point on the line chain that is closest to point aP.
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.
int Find(const VECTOR2I &aP, int aThreshold=0) const
Search for point aP.
Push and Shove diff pair dimensions (gap) settings dialog.
MEANDER_TYPE
Shapes of available meanders.