38 static const int candidateCount = 2;
44 for(
int i = 0; i < candidateCount; i++ )
46 prioritized[i] =
nullptr;
51 for(
int slopRadius : { 0, maxSlopRadius } )
60 if( !item->IsRoutable() )
63 if( !item->Layers().Overlaps( aLayer ) )
73 SEG::ecoord d0 = ( nearest - aWhere ).SquaredEuclideanNorm();
86 dcBaseline = ( aBaseline.
CPoint( 0 ) - target ).SquaredEuclideanNorm();
88 if( dcBaseline > distBaseline[1] )
91 distBaseline[1] = dcBaseline;
94 prioritized[1] = linked;
103 SEG::ecoord dd = ( aWhere - nearest ).SquaredEuclideanNorm();
116 dcBaseline = ( aBaseline.
CPoint( 0 ) - target ).SquaredEuclideanNorm();
118 if( dcBaseline > distBaseline[1] )
121 distBaseline[1] = dcBaseline;
124 prioritized[1] = segm;
133 for(
int i = 0; i < candidateCount; i++ )
137 if( item && ( aLayer < 0 || item->Layers().Overlaps( aLayer ) ) )
140 aPointOut = point[i];
157 if( aNet && track->GetNet() != aNet )
171 SEG seg( track->GetStart(), track->GetEnd() );
175 SEG::ecoord dist_sq = ( nearest - aP ).SquaredEuclideanNorm();
177 if( dist_sq < minDist_sq )
179 minDist_sq = dist_sq;
183 *aNearestTrack = track;
195 return static_cast<SEGMENT*
>( aStartItem )->Seg().NearestPoint( aStartPoint );
200 ARC* arc =
static_cast<ARC*
>( aStartItem );
202 if( (
VECTOR2I( arc->
Anchor( 0 ) - aStartPoint ) ).SquaredEuclideanNorm()
203 <= (
VECTOR2I( arc->
Anchor( 1 ) - aStartPoint ) ).SquaredEuclideanNorm() )
Information pertinent to a Pcbnew printed circuit board.
const TRACKS & Tracks() const
Handle the data for a net.
const VECTOR2I & GetMid() const
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual int GetWidth() const
virtual VECTOR2I Anchor(int n) const override
std::vector< ITEM * > & Items()
Base class for PNS router board items.
PnsKind Kind() const
Return the type (kind) of the item.
const ITEM_SET QueryHoverItems(const VECTOR2I &aP, int aSlopRadius=0)
const SHAPE_LINE_CHAIN CLine() const
const SHAPE * Shape(int aLayer) const override
Return the geometrical shape of the item.
VECTOR2I::extended_type ecoord
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
const VECTOR2I & GetArcMid() const
VECTOR2I NearestPoint(const VECTOR2I &aP) const
SEG::ecoord SquaredDistance(const VECTOR2I &aP, bool aOutlineOnly=false) const override
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Find a point on the line chain that is closest to point aP.
int SegmentCount() const
Return the number of segments in this line chain.
virtual VECTOR2I Centre() const
Compute a center-of-mass of the shape.
static constexpr extended_type ECOORD_MAX
static VECTOR2I GetSnappedStartPoint(LINKED_ITEM *aStartItem, VECTOR2I aStartPoint)
static VECTOR2I SnapToNearestTrack(const VECTOR2I &aP, BOARD *aBoard, NETINFO_ITEM *aNet, PCB_TRACK **aNearestTrack)
static LINKED_ITEM * PickSegment(ROUTER *aRouter, const VECTOR2I &aWhere, int aLayer, VECTOR2I &aPointOut, const SHAPE_LINE_CHAIN &aBaseline=SHAPE_LINE_CHAIN())
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
VECTOR2< int32_t > VECTOR2I