26#ifndef DIFF_PHASE_SKEW_TOOL_H
27#define DIFF_PHASE_SKEW_TOOL_H
141constexpr double EPS = 1e-9;
156 std::optional<std::pair<double, double>>
ValueAt(
const double s )
162 if( s <
m_pts.front().LinearDistance -
EPS )
166 if( s >
m_pts.back().LinearDistance +
EPS )
178 const auto& p =
m_pts.back();
179 return std::pair{ p.RelativeLength, p.RelativeDelay };
186 const double len = b.LinearDistance - a.LinearDistance;
191 return std::pair{ a.RelativeLength, a.RelativeDelay };
194 const double t = ( s - a.LinearDistance ) / len;
195 const double relativeLength = a.RelativeLength + t * ( b.RelativeLength - a.RelativeLength );
196 const double relativeDelay = a.RelativeDelay + t * ( b.RelativeDelay - a.RelativeDelay );
198 return std::pair{ relativeLength, relativeDelay };
202 const std::vector<KNOWN_RELATIVE_POINT>&
m_pts;
217 bool Init()
override;
295 const NETINFO_ITEM* aNet, std::vector<LENGTH_DELAY_CALCULATION_ITEM>& aItems,
310 static std::vector<CUMULATIVE_ENTRY>
313 const PNS::SOLID* aEndPad, START_END_DETAILS& aStartEndDetails );
316 static void splitLengthItems( std::vector<LENGTH_DELAY_CALCULATION_ITEM>& aItems );
319 std::vector<PARALLEL_RUN>
findParallelRuns(
const std::vector<CUMULATIVE_ENTRY>& aSelectedCumulative,
320 const std::vector<CUMULATIVE_ENTRY>& aCoupledCumulative )
const;
325 const std::vector<CUMULATIVE_ENTRY>& aCoupledCumulative,
326 std::pair<std::size_t, std::size_t> aRangeA, std::pair<std::size_t, std::size_t> aRangeB,
327 double aMaxSpacing, std::vector<PARALLEL_RUN>& aRuns )
const;
332 return { aA.
x + ( aB.
x - aA.
x ) * aT, aA.
y + ( aB.
y - aA.
y ) * aT };
336 static std::pair<int64_t, int64_t>
338 const START_END_DETAILS& aPadDetails,
339 const std::vector<CUMULATIVE_ENTRY>& aCumulative, std::size_t aSegIdx,
double aT );
369 const std::vector<PARALLEL_RUN>& aKnownRuns,
370 double aTargetSubsegmentSize,
bool isCoupledTrack );
375 const std::vector<PARALLEL_RUN>& aKnownRuns,
376 bool isCoupledTrack )
const;
379 static std::vector<double>
buildSplitPositions(
const std::vector<CUMULATIVE_ENTRY>& aSegments,
380 double aTargetSubsegmentSize );
384 static std::pair<VECTOR2D, std::size_t>
386 const std::vector<LENGTH_DELAY_CALCULATION_ITEM>& aSourceItemDetails,
double aDist );
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
Information pertinent to a Pcbnew printed circuit board.
A general implementation of a COLLECTORS_GUIDE.
A color representation with 4 components: red, green, blue, alpha.
An interface for classes handling user events controlling the view behavior such as zooming,...
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
KnownValueInterpolator(const std::vector< KNOWN_RELATIVE_POINT > &pts)
const std::vector< KNOWN_RELATIVE_POINT > & m_pts
std::optional< std::pair< double, double > > ValueAt(const double s)
TYPE
The type of routing object this item proxies.
Handle the data for a net.
Common, abstract interface for edit frames.
Push and Shove diff pair dimensions (gap) settings dialog.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Builds the length / delay calculation items from a given path.
LENGTH_DELAY_CALCULATION_ITEM::TYPE m_SourceType
Represents a point on a track where the length and delay relative to the coupled track can be calcula...
double RelativeLength
The length relative to the coupled track.
double LinearDistance
The distance (in IU) along the track.
double RelativeDelay
The propagation delay relative to the coupled track.
Used to represent the results of a call to CalculateLengthDetails, including inferred via-in-pad deta...
Struct to represent one segment where tracks run parallel, including information about absolute and r...
std::pair< double, double > pathLengthDelta() const
Calculates the {start, end} track length delta relative to the selected track.
VECTOR2I endA
The ending coordinate of the run on track A.
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.
VECTOR2I startB
The starting coordinate of the run on track B.
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.
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.
double overlapFractionB() const
Calculate the fraction of track B that overlaps track A.
size_t segA
The index of the parallel segment on track A.
VECTOR2I endB
The ending coordinate of the run on track B.
std::pair< double, double > pathDelayDelta() const
Calculates the {start, end} track delay delta relative to the selected track.
double overlapFractionA() const
Calculate the fraction of track A that overlaps track B.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D