22#ifndef DIFF_PHASE_SKEW_TOOL_H
23#define DIFF_PHASE_SKEW_TOOL_H
153constexpr double EPS = 1e-9;
168 std::optional<std::pair<double, double>>
ValueAt(
const double s )
174 if( s <
m_pts.front().LinearDistance -
EPS )
178 if( s >
m_pts.back().LinearDistance +
EPS )
190 const auto& p =
m_pts.back();
191 return std::pair{ p.RelativeLengthBefore, p.RelativeDelayBefore };
198 const double len = b.LinearDistance - a.LinearDistance;
203 return std::pair{ a.RelativeLengthBefore, a.RelativeDelayBefore };
206 const double t = ( s - a.LinearDistance ) / len;
207 const double relativeLength = a.RelativeLengthAfter + t * ( b.RelativeLengthBefore - a.RelativeLengthAfter );
208 const double relativeDelay = a.RelativeDelayAfter + t * ( b.RelativeDelayBefore - a.RelativeDelayAfter );
210 return std::pair{ relativeLength, relativeDelay };
214 const std::vector<KNOWN_RELATIVE_POINT>&
m_pts;
229 bool Init()
override;
309 const NETINFO_ITEM* aNet, std::vector<LENGTH_DELAY_CALCULATION_ITEM>& aItems,
324 static std::vector<CUMULATIVE_ENTRY>
327 const PNS::SOLID* aEndPad, START_END_DETAILS& aStartEndDetails );
330 static void splitLengthItems( std::vector<LENGTH_DELAY_CALCULATION_ITEM>& aItems );
337 void findParallelRunsImpl( std::pair<std::size_t, std::size_t> aRangeA, std::pair<std::size_t, std::size_t> aRangeB,
338 double aMaxSpacing, std::vector<PARALLEL_RUN>& aRuns )
const;
343 return { aA.
x + ( aB.
x - aA.
x ) * aT, aA.
y + ( aB.
y - aA.
y ) * aT };
347 static std::pair<int64_t, int64_t>
349 const START_END_DETAILS& aPadDetails,
350 const std::vector<CUMULATIVE_ENTRY>& aCumulative, std::size_t aSegIdx,
double aT );
380 std::vector<OUTPUT_SEGMENT>
382 const std::vector<LENGTH_DELAY_CALCULATION_ITEM>& aSourceItemDetails,
383 const std::vector<KNOWN_RELATIVE_POINT>& aKnownPoints,
double aTargetSubsegmentSize );
389 static std::vector<double>
buildSplitPositions(
const std::vector<CUMULATIVE_ENTRY>& aSegments,
390 double aTargetSubsegmentSize );
394 static std::pair<VECTOR2D, std::size_t>
396 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 RelativeLengthAfter
The length relative to the coupled track.
double RelativeDelayAfter
The propagation delay relative to the coupled track.
double RelativeLengthBefore
The length relative to the coupled track.
double LinearDistance
The distance (in IU) along the track.
double RelativeDelayBefore
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.
std::optional< double > startViaLengthB
std::optional< double > endViaDelayA
std::optional< double > startViaLengthA
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.
std::optional< double > startViaDelayB
std::optional< double > startViaDelayA
VECTOR2I startB
The starting coordinate of the run on track B.
std::optional< double > endViaDelayB
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.
std::optional< double > endViaLengthA
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.
std::optional< double > endViaLengthB
double overlapFractionA() const
Calculate the fraction of track A that overlaps track B.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D