92 if( minAmp == maxAmp )
101 if( minLen > targetLength )
104 if( maxLen < targetLength )
107 int minError = minLen - targetLength;
108 int maxError = maxLen - targetLength;
143 if( initialGuess >= minAmp && initialGuess <= maxAmp )
145 copy.Resize( minAmp );
158 long long int maxElongation = 0;
159 long long int minElongation = 0;
160 bool finished =
false;
174 end.SetType( endType );
177 long long int maxEndElongation =
end.CurrentLength() -
end.BaselineLength();
179 if( maxElongation + maxEndElongation > aElongation )
183 m->SetType( endType );
189 long long int endMinElongation =
190 ( m->MinTunableLength() - m->BaselineLength() );
192 if( minElongation + endMinElongation >= aElongation )
204 maxElongation += m->CurrentLength() - m->BaselineLength();
205 minElongation += m->MinTunableLength() - m->BaselineLength();
209 long long int remainingElongation = aElongation;
210 int meanderCount = 0;
216 remainingElongation -= m->CurrentLength() - m->BaselineLength();
221 long long int lenReductionLeft = -remainingElongation;
222 int meandersLeft = meanderCount;
224 if( lenReductionLeft < 0 || !meandersLeft )
231 long long int lenReductionHere = lenReductionLeft / meandersLeft;
232 long long int initialLen = m->CurrentLength();
233 int minAmpl = m->MinAmplitude();
241 m->SetTargetBaselineLength( m->BaselineLength() );
244 lenReductionLeft -= initialLen - m->CurrentLength();
264 return static_cast<SEGMENT*
>( aStartItem )->Seg().NearestPoint( aStartPoint );
269 ARC* arc =
static_cast<ARC*
>( aStartItem );
271 if( (
VECTOR2I( arc->
Anchor( 0 ) - aStartPoint ) ).SquaredEuclideanNorm() <=
272 (
VECTOR2I( arc->
Anchor( 1 ) - aStartPoint ) ).SquaredEuclideanNorm() )
ROUTER * Router() const
Return current router settings.
virtual VECTOR2I Anchor(int n) const override
const std::vector< ITEM * > & CItems() const
Base class for PNS router board items.
PnsKind Kind() const
Return the type (kind) of the item.
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.
MEANDER_PLACER_BASE(ROUTER *aRouter)
virtual ~MEANDER_PLACER_BASE()
MEANDER_SETTINGS m_settings
The current end point.
int64_t lineDelay(const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad) const
Calculate the total delay of the line represented by an item set (tracks and vias)
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
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)
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.
long long int CurrentLength() const
void Resize(int aAmpl)
Change the amplitude of the meander shape to aAmpl and recalculates the resulting line chain.
int BaselineLength() const
virtual const ITEM_SET Traces()=0
Function Traces()
virtual int CurrentLayer() const =0
Function CurrentLayer()
virtual long long int CalculateRoutedPathLength(const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad, const NETCLASS *aNetClass)=0
virtual int64_t CalculateRoutedPathDelay(const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad, const NETCLASS *aNetClass)=0
ROUTER_IFACE * GetInterface() const
RULE_RESOLVER * GetRuleResolver() const
virtual bool QueryConstraint(CONSTRAINT_TYPE aType, const ITEM *aItemA, const ITEM *aItemB, int aLayer, CONSTRAINT *aConstraint)=0
Push and Shove diff pair dimensions (gap) settings dialog.
MEANDER_TYPE
Shapes of available meanders.
int findAmplitudeForLength(MEANDER_SHAPE *m, int targetLength, int minAmp, int maxAmp)
const int LENGTH_TARGET_TOLERANCE
int findAmplitudeBinarySearch(MEANDER_SHAPE &aCopy, int targetLength, int minAmp, int maxAmp)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between...
VECTOR2< int32_t > VECTOR2I