41 auto via = std::make_unique<PCB_VIA>( &
m_board );
42 via->SetPosition( aCenter );
44 via->SetDrill( 400000 );
45 via->SetWidth( 1270000 );
57 pad->SetPosition( aCenter );
74 const VECTOR2I viaCenter( 189190000, 46760000 );
75 auto via = MakeVia( viaCenter );
78 chain.Append( viaCenter );
85 BOOST_REQUIRE_EQUAL( chainForward.
Length(), chainBackward.
Length() );
90 BOOST_CHECK_CLOSE(
static_cast<double>( chainForward.
Length() ),
static_cast<double>( chainBackward.
Length() ),
100 const VECTOR2I arcStart( 189190000, 46760000 );
101 const VECTOR2I arcMid( 190382763, 46815467 );
102 const VECTOR2I arcEnd( 189758445, 47833301 );
105 baseChain.
Append( arcStart );
106 SHAPE_ARC arc( arcStart, arcMid, arcEnd, 0 );
109 const double fullArcLen =
static_cast<double>( baseChain.
Length() );
114 auto via = MakeVia( arcStart );
115 auto pad = MakeCircularPad( arcStart );
120 const double viaLen =
static_cast<double>( viaChain.
Length() );
121 const double padLen =
static_cast<double>( padChain.
Length() );
129 BOOST_CHECK_CLOSE( viaLen, padLen, 0.5 );
140 const VECTOR2I arcMid( 6000000, 1000000 );
141 const VECTOR2I arcEnd( 7000000, 0 );
154 auto makeItems = [&]()
156 std::vector<LENGTH_DELAY_CALCULATION_ITEM> items;
168 items.push_back( s );
169 items.push_back( c );
176 .OptimiseVias =
false, .MergeTracks =
false, .OptimiseTracesInPads =
false, .InferViaInPad =
false
179 .OptimiseVias =
false, .MergeTracks =
true, .OptimiseTracesInPads =
false, .InferViaInPad =
false
182 auto i1 = makeItems();
183 auto i2 = makeItems();
185 const double lenNoMerge =
static_cast<double>( calc.
CalculateLength( i1, noMerge,
nullptr,
nullptr ) );
186 const double lenMerge =
static_cast<double>( calc.
CalculateLength( i2, merge,
nullptr,
nullptr ) );
192 BOOST_CHECK_CLOSE( lenNoMerge,
expected, 0.01 );
193 BOOST_CHECK_CLOSE( lenMerge, lenNoMerge, 0.01 );
Information pertinent to a Pcbnew printed circuit board.
Lightweight class which holds a pad, via, or a routed trace outline.
void SetLine(const SHAPE_LINE_CHAIN &aLine)
Sets the source SHAPE_LINE_CHAIN of this item.
void SetWidth(const int aWidth)
Sets the line width.
void SetLayers(const PCB_LAYER_ID aStart, const PCB_LAYER_ID aEnd=PCB_LAYER_ID::UNDEFINED_LAYER)
Sets the first and last layers associated with this item.
Class which calculates lengths (and associated routing statistics) in a BOARD context.
int64_t CalculateLength(std::vector< LENGTH_DELAY_CALCULATION_ITEM > &aItems, PATH_OPTIMISATIONS aOptimisations, const PAD *aStartPad=nullptr, const PAD *aEndPad=nullptr) const
Calculates the electrical length of the given items.
static void OptimiseTraceInVia(SHAPE_LINE_CHAIN &aLine, const PCB_VIA *aVia, PCB_LAYER_ID aLayer)
Clips trace portions inside a VIA pad and replaces them with a straight-line segment from the VIA edg...
static void OptimiseTraceInPad(SHAPE_LINE_CHAIN &aLine, const PAD *aPad, PCB_LAYER_ID aPcbLayer)
Optimises the given trace / line to minimise the electrical path length within the given pad.
LSET is a set of PCB_LAYER_IDs.
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
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.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
long long int Length() const
Return length of the line chain in Euclidean metric.
@ PTH
Plated through hole pad.
std::unique_ptr< PAD > MakeCircularPad(const VECTOR2I &aCenter)
std::unique_ptr< PCB_VIA > MakeVia(const VECTOR2I &aCenter)
CLIP_LINE_TO_VIA_FIXTURE()
Struct to control which optimisations the length calculation code runs on the given path objects.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(StraightTrace_ForwardBackwardAgree)
BOOST_AUTO_TEST_SUITE_END()
VECTOR3I expected(15, 30, 45)
BOOST_TEST_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))
const SHAPE_LINE_CHAIN chain
VECTOR2< int32_t > VECTOR2I