KiCad PCB EDA Suite
Loading...
Searching...
No Matches
TEARDROP_MANAGER Class Reference

TEARDROP_MANAGER manage and build teardrop areas A teardrop area is a polygonal area (a copper ZONE) having: 2 points on the track connected to a pad or via 2 points on the outline of this pad or via 1 point near the pad/via position (calculated in order to have this pad/via position inside the area The 2 sides joining a point on the track to the corresponding point on the pad/via outline can be a straight line or a curved shape (defined from a Bezier curve) This curved shape is built by segments (3 to 10) from this Bezier curve Size of area (height and length) are defined from the pad/via size or for pads having a size X and a size Y, the smallest of X,Y size. More...

#include <teardrop.h>

Public Types

enum  TEARDROP_VARIANT { TD_TYPE_PADVIA , TD_TYPE_TRACKEND }
 

Public Member Functions

 TEARDROP_MANAGER (BOARD *aBoard, TOOL_MANAGER *aToolManager)
 
void RemoveTeardrops (BOARD_COMMIT &aCommit, std::vector< BOARD_ITEM * > *dirtyPadsAndVias, std::set< PCB_TRACK * > *dirtyTracks, const std::vector< BOARD_ITEM * > *dirtyCopper=nullptr)
 Remove teardrops on dirty pads, vias or tracks, and any whose neighbouring copper moved, dirtying the anchors of the latter.
 
void UpdateTeardrops (BOARD_COMMIT &aCommit, const std::vector< BOARD_ITEM * > *dirtyPadsAndVias, const std::set< PCB_TRACK * > *dirtyTracks, bool aForceFullUpdate=false)
 Update teardrops on a list of items.
 
void AddTeardropsOnTracks (BOARD_COMMIT &aCommit, const std::set< PCB_TRACK * > *aTracks, bool aForceFullUpdate=false, bool aSetPriorities=true)
 Add teardrop on tracks of different sizes connected by their end.
 
void DeleteTrackToTrackTeardrops (BOARD_COMMIT &aCommit)
 
void BuildTrackCaches ()
 

Static Public Member Functions

static int GetWidth (BOARD_ITEM *aItem, PCB_LAYER_ID aLayer)
 
static bool IsRound (BOARD_ITEM *aItem, PCB_LAYER_ID aLayer)
 
static bool IsUniformlyRound (BOARD_ITEM *aItem)
 

Private Member Functions

bool areItemsInSameZone (BOARD_ITEM *aPadOrVia, PCB_TRACK *aTrack) const
 
const std::vector< std::set< const BOARD_ITEM * > > & zoneConnections (ZONE *aZone, PCB_LAYER_ID aLayer) const
 
int pairClearance (PCB_TRACK *aSourceTrack, BOARD_ITEM *aItem, PCB_LAYER_ID aLayer) const
 
void ensureCopperIndex () const
 Build the copper collision index, deferred so a commit with no teardrop candidate never pays for it.
 
bool collidesWithOtherNets (const std::vector< VECTOR2I > &aPoints, PCB_TRACK *aSourceTrack, const std::vector< const BOARD_ITEM * > &aExempt) const
 
bool computeFittedTeardropPolygon (const TEARDROP_PARAMETERS &aParams, std::vector< VECTOR2I > &aPoints, PCB_TRACK *aTrack, PCB_TRACK *aSourceTrack, BOARD_ITEM *aOther, const VECTOR2I &aOtherPos) const
 Widen a teardrop as far as the surrounding copper allows.
 
int computeChordThroughShape (PCB_TRACK *aTrack, BOARD_ITEM *aOther, PCB_LAYER_ID aLayer, const VECTOR2I &aInsidePoint) const
 Return the centerline chord length through aOther's copper span at aInsidePoint.
 
void computeCurvedForRoundShape (const TEARDROP_PARAMETERS &aParams, std::vector< VECTOR2I > &aPoly, PCB_LAYER_ID aLayer, int aTrackHalfWidth, const VECTOR2D &aTrackDir, BOARD_ITEM *aOther, const VECTOR2I &aOtherPos, std::vector< VECTOR2I > &aPts) const
 Compute the curve part points for teardrops connected to a round shape The Bezier curve control points are optimized for a round pad/via shape, and do not give a good curve shape for other pad shapes use m_m_heightRatio.
 
void computeCurvedForRectShape (const TEARDROP_PARAMETERS &aParams, std::vector< VECTOR2I > &aPoly, int aTdWidth, int aTrackHalfWidth, std::vector< VECTOR2I > &aPts, const VECTOR2I &aIntersection, BOARD_ITEM *aOther, const VECTOR2I &aOtherPos, PCB_LAYER_ID aLayer) const
 Compute the curve part points for teardrops connected to a rectangular/polygonal shape The Bezier curve control points are not optimized for a special shape, so use computeCurvedForRoundShape() for round shapes for better result.
 
bool computeTeardropPolygon (const TEARDROP_PARAMETERS &aParams, std::vector< VECTOR2I > &aCorners, PCB_TRACK *aTrack, PCB_TRACK *aSourceTrack, BOARD_ITEM *aOther, const VECTOR2I &aOtherPos) const
 Compute all teardrop points of the polygon shape.
 
bool computeAnchorPoints (const TEARDROP_PARAMETERS &aParams, PCB_LAYER_ID aLayer, BOARD_ITEM *aItem, const VECTOR2I &aPos, std::vector< VECTOR2I > &aPts) const
 Compute the 2 points on pad/via of the teardrop shape.
 
PCB_TRACKfindTouchingTrack (EDA_ITEM_FLAGS &aMatchType, PCB_TRACK *aTrackRef, PCB_TRACK *aSourceTrack, const VECTOR2I &aEndPoint) const
 Find a track connected to the end of another track.
 
ZONEcreateTeardrop (TEARDROP_VARIANT aTeardropVariant, std::vector< VECTOR2I > &aPoints, PCB_TRACK *aSourceTrack, const KIID &aUuid) const
 Creates a teardrop (a ZONE item) from its polygonal shape, track netcode and layer.
 
ZONEcreateTeardropMask (TEARDROP_VARIANT aTeardropVariant, std::vector< VECTOR2I > &aPoints, PCB_TRACK *aSourceTrack, const KIID &aUuid) const
 
void createAndAddTeardropWithMask (BOARD_COMMIT &aCommit, TEARDROP_VARIANT aTeardropVariant, std::vector< VECTOR2I > &aPoints, PCB_TRACK *aSourceTrack, const KIID &aUuid)
 Creates and adds a teardrop with optional mask to the board.
 
bool tryCreateTrackTeardrop (BOARD_COMMIT &aCommit, const TEARDROP_PARAMETERS &aParams, TEARDROP_VARIANT aTeardropVariant, PCB_TRACK *aTrack, PCB_TRACK *aSourceTrack, BOARD_ITEM *aCandidate, const VECTOR2I &aPos, const KIID &aUuid)
 Attempts to create a track-to-track teardrop.
 
void setTeardropPriorities ()
 Set priority of created teardrops.
 
bool findAnchorPointsOnTrack (const TEARDROP_PARAMETERS &aParams, VECTOR2I &aStartPoint, VECTOR2I &aEndPoint, VECTOR2I &aIntersection, PCB_TRACK *&aTrack, PCB_TRACK *aSourceTrack, BOARD_ITEM *aOther, const VECTOR2I &aOtherPos, int *aEffectiveTeardropLen) const
 

Static Private Member Functions

static int copperNetcode (const BOARD_ITEM *aItem)
 
static KIID teardropUuid (const PCB_TRACK *aTrack, const BOARD_ITEM *aCandidate, int aSlot)
 Build the UUID a teardrop is created with.
 
static KIID maskUuidFor (const KIID &aCopperUuid)
 Build the UUID of the mask sibling of aCopperUuid.
 
static void buildCrossingStub (PCB_TRACK &aStub, const PCB_TRACK *aTrack, const VECTOR2I &aEnd)
 Set aStub up as the segment from one end of aTrack to aEnd, for a track that crosses the pad or via it connects to.
 

Private Attributes

int m_tolerance
 
BOARDm_board
 
TOOL_MANAGERm_toolManager
 
TEARDROP_PARAMETERS_LISTm_prmsList
 
DRC_RTREE m_tracksRTree
 
TRACK_BUFFER m_trackLookupList
 
std::vector< ZONE * > m_createdTdList
 
DRC_RTREE m_copperRTree
 Every copper item plus the teardrops built so far, to keep teardrops off other nets.
 
bool m_copperIndexed
 
std::unordered_map< PTR_LAYER_CACHE_KEY, std::vector< std::set< const BOARD_ITEM * > > > m_zoneConnectionCache
 
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, int > m_pairClearanceCache
 

Friends

class TEARDROP_PARAMETERS
 

Detailed Description

TEARDROP_MANAGER manage and build teardrop areas A teardrop area is a polygonal area (a copper ZONE) having: 2 points on the track connected to a pad or via 2 points on the outline of this pad or via 1 point near the pad/via position (calculated in order to have this pad/via position inside the area The 2 sides joining a point on the track to the corresponding point on the pad/via outline can be a straight line or a curved shape (defined from a Bezier curve) This curved shape is built by segments (3 to 10) from this Bezier curve Size of area (height and length) are defined from the pad/via size or for pads having a size X and a size Y, the smallest of X,Y size.

For a custom pad that size and position describe only the anchor; the copper may lie far away and need not be convex or connected, so anchor-derived geometry must be clamped to that copper

Definition at line 85 of file teardrop.h.

Member Enumeration Documentation

◆ TEARDROP_VARIANT

Enumerator
TD_TYPE_PADVIA 
TD_TYPE_TRACKEND 

Definition at line 90 of file teardrop.h.

Constructor & Destructor Documentation

◆ TEARDROP_MANAGER()

TEARDROP_MANAGER::TEARDROP_MANAGER ( BOARD * aBoard,
TOOL_MANAGER * aToolManager )

Definition at line 48 of file teardrop.cpp.

References m_board, m_copperIndexed, m_prmsList, m_tolerance, and m_toolManager.

Member Function Documentation

◆ AddTeardropsOnTracks()

void TEARDROP_MANAGER::AddTeardropsOnTracks ( BOARD_COMMIT & aCommit,
const std::set< PCB_TRACK * > * aTracks,
bool aForceFullUpdate = false,
bool aSetPriorities = true )

◆ areItemsInSameZone()

bool TEARDROP_MANAGER::areItemsInSameZone ( BOARD_ITEM * aPadOrVia,
PCB_TRACK * aTrack ) const
private
Returns
true if the given aViaPad + aTrack is located inside a zone of the same netname

Definition at line 230 of file teardrop_utils.cpp.

References BOARD_CONNECTED_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), m_board, and zoneConnections().

Referenced by UpdateTeardrops().

◆ buildCrossingStub()

void TEARDROP_MANAGER::buildCrossingStub ( PCB_TRACK & aStub,
const PCB_TRACK * aTrack,
const VECTOR2I & aEnd )
staticprivate

◆ BuildTrackCaches()

void TEARDROP_MANAGER::BuildTrackCaches ( )

◆ collidesWithOtherNets()

bool TEARDROP_MANAGER::collidesWithOtherNets ( const std::vector< VECTOR2I > & aPoints,
PCB_TRACK * aSourceTrack,
const std::vector< const BOARD_ITEM * > & aExempt ) const
private
Returns
true if a teardrop with the given outline would touch copper of another net.
Parameters
aExemptare the items it overlaps by construction, its anchor and its track(s); without them a no-net teardrop collides with its own anchor, no net being shared with none

Definition at line 264 of file teardrop_utils.cpp.

References SHAPE_POLY_SET::Append(), alg::contains(), copperNetcode(), ensureCopperIndex(), BOARD_CONNECTED_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), m_board, m_copperRTree, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), pairClearance(), and SHAPE_POLY_SET::Simplify().

Referenced by computeFittedTeardropPolygon().

◆ computeAnchorPoints()

bool TEARDROP_MANAGER::computeAnchorPoints ( const TEARDROP_PARAMETERS & aParams,
PCB_LAYER_ID aLayer,
BOARD_ITEM * aItem,
const VECTOR2I & aPos,
std::vector< VECTOR2I > & aPts ) const
private

Compute the 2 points on pad/via of the teardrop shape.

Returns
false if these 2 points are not found
Parameters
aLayeris the layer for the teardrop
aItemis the via/pad/track used to build the teardrop
aPosis the via/pad position, or track start or end teardrop height = aViaPad size * aHeightRatio
aPtsis the buffer that contains initial and final teardrop polygonal shape in aPts: A and B ( aPts[0] and aPts[1] ) are points on the track C and E ( aPts[2] and aPts[4] ) are points on the aViaPad D ( aPts[3] ) is midpoint behind the aViaPad centre m_heightRatio is the factor to calculate the aViaPad teardrop size

Definition at line 934 of file teardrop_utils.cpp.

References SHAPE_POLY_SET::Append(), SHAPE_LINE_CHAIN::Area(), SHAPE_POLY_SET::BooleanIntersection(), BuildConvexHull(), SHAPE_LINE_CHAIN::CPoints(), ERROR_INSIDE, VECTOR2< T >::EuclideanNorm(), GetWidth(), IsRound(), KiROUND(), TEARDROP_PARAMETERS::m_BestWidthRatio, m_board, TEARDROP_PARAMETERS::m_TdMaxWidth, SHAPE_POLY_SET::Move(), SHAPE_POLY_SET::NewOutline(), next(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), pad, PCB_PAD_T, SHAPE_POLY_SET::Rotate(), TEARDROP_PARAMETERS, TransformCircleToPolygon(), and EDA_ITEM::Type().

Referenced by computeTeardropPolygon().

◆ computeChordThroughShape()

int TEARDROP_MANAGER::computeChordThroughShape ( PCB_TRACK * aTrack,
BOARD_ITEM * aOther,
PCB_LAYER_ID aLayer,
const VECTOR2I & aInsidePoint ) const
private

◆ computeCurvedForRectShape()

void TEARDROP_MANAGER::computeCurvedForRectShape ( const TEARDROP_PARAMETERS & aParams,
std::vector< VECTOR2I > & aPoly,
int aTdWidth,
int aTrackHalfWidth,
std::vector< VECTOR2I > & aPts,
const VECTOR2I & aIntersection,
BOARD_ITEM * aOther,
const VECTOR2I & aOtherPos,
PCB_LAYER_ID aLayer ) const
private

Compute the curve part points for teardrops connected to a rectangular/polygonal shape The Bezier curve control points are not optimized for a special shape, so use computeCurvedForRoundShape() for round shapes for better result.

For rounded rectangles, special handling ensures curves are tangent to corner radii.

Definition at line 804 of file teardrop_utils.cpp.

References computeCornerTangentControlPoint(), VECTOR2< T >::EuclideanNorm(), BEZIER_POLY::GetPoly(), isPointOnOvalEnd(), isPointOnRoundedCorner(), m_board, OVAL, pad, PCB_PAD_T, VECTOR2< T >::Resize(), ROUNDRECT, TEARDROP_PARAMETERS, and EDA_ITEM::Type().

Referenced by computeTeardropPolygon().

◆ computeCurvedForRoundShape()

void TEARDROP_MANAGER::computeCurvedForRoundShape ( const TEARDROP_PARAMETERS & aParams,
std::vector< VECTOR2I > & aPoly,
PCB_LAYER_ID aLayer,
int aTrackHalfWidth,
const VECTOR2D & aTrackDir,
BOARD_ITEM * aOther,
const VECTOR2I & aOtherPos,
std::vector< VECTOR2I > & aPts ) const
private

Compute the curve part points for teardrops connected to a round shape The Bezier curve control points are optimized for a round pad/via shape, and do not give a good curve shape for other pad shapes use m_m_heightRatio.

Definition at line 577 of file teardrop_utils.cpp.

References std::abs(), VECTOR2< T >::EuclideanNorm(), BEZIER_POLY::GetPoly(), GetWidth(), KiROUND(), SEG::Length(), TEARDROP_PARAMETERS::m_BestWidthRatio, m_board, TEARDROP_PARAMETERS::m_TdMaxWidth, radius, VECTOR2< T >::Resize(), TEARDROP_PARAMETERS, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by computeTeardropPolygon().

◆ computeFittedTeardropPolygon()

bool TEARDROP_MANAGER::computeFittedTeardropPolygon ( const TEARDROP_PARAMETERS & aParams,
std::vector< VECTOR2I > & aPoints,
PCB_TRACK * aTrack,
PCB_TRACK * aSourceTrack,
BOARD_ITEM * aOther,
const VECTOR2I & aOtherPos ) const
private

Widen a teardrop as far as the surrounding copper allows.

The requested width knows nothing of what is nearby, so bisect down from it; the result is within a few percent.

Returns
false if no width down to the track width clears the neighbouring copper

Definition at line 355 of file teardrop_utils.cpp.

References collidesWithOtherNets(), computeTeardropPolygon(), BOARD_CONNECTED_ITEM::GetLayer(), PCB_TRACK::GetWidth(), GetWidth(), KiROUND(), TEARDROP_PARAMETERS::m_BestWidthRatio, TEARDROP_PARAMETERS::m_TdMaxWidth, and TEARDROP_PARAMETERS.

Referenced by tryCreateTrackTeardrop().

◆ computeTeardropPolygon()

◆ copperNetcode()

int TEARDROP_MANAGER::copperNetcode ( const BOARD_ITEM * aItem)
staticprivate
Returns
aItem's netcode, or NETINFO_LIST::UNCONNECTED. IsConnected() is not a proxy; a copper graphic in a footprint answers false to it and still carries a net.

Definition at line 174 of file teardrop_utils.cpp.

References NETINFO_LIST::UNCONNECTED.

Referenced by collidesWithOtherNets(), and RemoveTeardrops().

◆ createAndAddTeardropWithMask()

void TEARDROP_MANAGER::createAndAddTeardropWithMask ( BOARD_COMMIT & aCommit,
TEARDROP_VARIANT aTeardropVariant,
std::vector< VECTOR2I > & aPoints,
PCB_TRACK * aSourceTrack,
const KIID & aUuid )
private

Creates and adds a teardrop with optional mask to the board.

Parameters
aCommitthe board commit to add the teardrop to
aTeardropVariant= variant of the teardrop( attached to a pad, or a track end )
aPointsis the polygonal shape
aSourceTrackis the board track the teardrop belongs to
aUuidis the UUID to give the teardrop

Definition at line 184 of file teardrop.cpp.

References COMMIT::Added(), BULK_INSERT, CLEARANCE_CONSTRAINT, createTeardrop(), createTeardropMask(), ensureCopperIndex(), BOARD_CONNECTED_ITEM::GetLayer(), ZONE::GetLayer(), PCB_TRACK::HasSolderMask(), IsExternalCopperLayer(), m_board, m_copperRTree, and m_createdTdList.

Referenced by tryCreateTrackTeardrop().

◆ createTeardrop()

ZONE * TEARDROP_MANAGER::createTeardrop ( TEARDROP_VARIANT aTeardropVariant,
std::vector< VECTOR2I > & aPoints,
PCB_TRACK * aSourceTrack,
const KIID & aUuid ) const
private

Creates a teardrop (a ZONE item) from its polygonal shape, track netcode and layer.

Parameters
aTeardropVariant= variant of the teardrop( attached to a pad, or a track end )
aPointsis the polygonal shape
aSourceTrackis the board track it belongs to, not the stub geometry came from
aUuidis the UUID to give the teardrop

Definition at line 95 of file teardrop.cpp.

References SHAPE_POLY_SET::Append(), ZONE::CalculateFilledArea(), ZONE_SETTINGS::ExportSetting(), FULL, ZONE_SETTINGS::GetDefaultSettings(), BOARD_CONNECTED_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), INVISIBLE_BORDER, m_board, NEVER, SHAPE_POLY_SET::NewOutline(), ZONE::Outline(), pcbIUScale, ZONE::SetBorderDisplayStyle(), ZONE::SetFilledPolysList(), ZONE::SetIsFilled(), ZONE::SetIslandRemovalMode(), ZONE::SetLayer(), ZONE::SetLocalClearance(), ZONE::SetMinThickness(), ZONE::SetNetCode(), ZONE::SetPadConnection(), ZONE::SetTeardropAreaType(), BOARD_ITEM::SetUuidDirect(), TD_TRACKEND, TD_TYPE_PADVIA, and TD_VIAPAD.

Referenced by createAndAddTeardropWithMask().

◆ createTeardropMask()

◆ DeleteTrackToTrackTeardrops()

void TEARDROP_MANAGER::DeleteTrackToTrackTeardrops ( BOARD_COMMIT & aCommit)

Definition at line 604 of file teardrop.cpp.

References m_board, STRUCT_DELETED, and TD_TRACKEND.

Referenced by DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow().

◆ ensureCopperIndex()

void TEARDROP_MANAGER::ensureCopperIndex ( ) const
private

Build the copper collision index, deferred so a commit with no teardrop candidate never pays for it.

Definition at line 134 of file teardrop_utils.cpp.

References CLEARANCE_CONSTRAINT, ZONE::IsTeardropArea(), m_board, m_copperIndexed, m_copperRTree, PCB_GROUP_T, PCB_ZONE_T, and RECURSE.

Referenced by collidesWithOtherNets(), and createAndAddTeardropWithMask().

◆ findAnchorPointsOnTrack()

bool TEARDROP_MANAGER::findAnchorPointsOnTrack ( const TEARDROP_PARAMETERS & aParams,
VECTOR2I & aStartPoint,
VECTOR2I & aEndPoint,
VECTOR2I & aIntersection,
PCB_TRACK *& aTrack,
PCB_TRACK * aSourceTrack,
BOARD_ITEM * aOther,
const VECTOR2I & aOtherPos,
int * aEffectiveTeardropLen ) const
private
Returns
true if a point on a track can be found as anchor point of a teardrop
Parameters
aStartPointis the start point of the track found (always inside the teardrop)
aEndPointis the start point of the track found (always outside the teardrop)
aIntersectionis the point where the track's centerline meets the pad/via edge
aTrackis the track connected to the pad/via used to search a anchor point this reference can be modified if a connected track to the initial track is selected
aOtheris the via/pad/track used to build the teardrop
aOtherPosis the via/pad position, or track start or end
aEffectiveTeardropLenis the actual teardrop length, that can be smaller than expected if the connected track length is too small
aFollowTracks= true to use a connected track to aTrack if aTrack is too small
aTrackLookupListis the list of tracks to explore if aFollowTracks = true m_lengthRatio is the length of teardrop (ratio pad/via size/teardrop len)

Definition at line 1122 of file teardrop_utils.cpp.

References SHAPE_ARC::ConvertToPolyline(), SHAPE_LINE_CHAIN::CPoint(), end, ERROR_INSIDE, findTouchingTrack(), PCB_TRACK::GetEnd(), BOARD_CONNECTED_ITEM::GetLayer(), PCB_TRACK::GetLength(), PCB_ARC::GetMid(), PCB_TRACK::GetStart(), PCB_TRACK::GetWidth(), GetWidth(), EDA_ITEM::HitTest(), SHAPE_LINE_CHAIN::Intersect(), IsRound(), KiROUND(), TEARDROP_PARAMETERS::m_AllowUseTwoTracks, TEARDROP_PARAMETERS::m_BestLengthRatio, m_board, TEARDROP_PARAMETERS::m_TdMaxLen, SHAPE_ARC::NearestPoint(), NormalizeVector(), SHAPE_POLY_SET::Outline(), PCB_ARC_T, PCB_PAD_T, SHAPE_LINE_CHAIN::PointCount(), radius, SHAPE_ARC::Reverse(), SHAPE_LINE_CHAIN::SetClosed(), SHAPE_LINE_CHAIN::SetPoint(), STARTPOINT, TEARDROP_PARAMETERS, TransformCircleToPolygon(), EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by computeTeardropPolygon().

◆ findTouchingTrack()

PCB_TRACK * TEARDROP_MANAGER::findTouchingTrack ( EDA_ITEM_FLAGS & aMatchType,
PCB_TRACK * aTrackRef,
PCB_TRACK * aSourceTrack,
const VECTOR2I & aEndPoint ) const
private

Find a track connected to the end of another track.

Returns
a reference to the touching track (or nullptr)
Parameters
aMatchTypereturns the end point id 0, STARTPOINT, ENDPOINT
aTrackRefis the reference track
aSourceTrackis the board track aTrackRef stands in for, excluded from the search
aEndpointis the coordinate to test
tracksRTreeis an RTree containing the available tracks

Definition at line 511 of file teardrop_utils.cpp.

References BOARD_CONNECTED_ITEM::GetLayer(), and m_tracksRTree.

Referenced by findAnchorPointsOnTrack().

◆ GetWidth()

◆ IsRound()

◆ IsUniformlyRound()

bool TEARDROP_MANAGER::IsUniformlyRound ( BOARD_ITEM * aItem)
static

◆ maskUuidFor()

KIID TEARDROP_MANAGER::maskUuidFor ( const KIID & aCopperUuid)
staticprivate

Build the UUID of the mask sibling of aCopperUuid.

Producer and consumer of that pairing are far apart, so it has one home.

Definition at line 72 of file teardrop.cpp.

References KIID::Increment().

Referenced by createTeardropMask(), and RemoveTeardrops().

◆ pairClearance()

int TEARDROP_MANAGER::pairClearance ( PCB_TRACK * aSourceTrack,
BOARD_ITEM * aItem,
PCB_LAYER_ID aLayer ) const
private
Returns
the clearance aSourceTrack owes aItem on aLayer, less the DRC epsilon, so that geometry sitting exactly at the limit is not rejected where DRC would pass it.

Definition at line 183 of file teardrop_utils.cpp.

References clearance, CLEARANCE_CONSTRAINT, BOARD_DESIGN_SETTINGS::GetDRCEpsilon(), MINOPTMAX< T >::HasMin(), m_board, BOARD_DESIGN_SETTINGS::m_DRCEngine, m_pairClearanceCache, MINOPTMAX< T >::Min(), and DRC_CONSTRAINT::Value().

Referenced by collidesWithOtherNets().

◆ RemoveTeardrops()

void TEARDROP_MANAGER::RemoveTeardrops ( BOARD_COMMIT & aCommit,
std::vector< BOARD_ITEM * > * dirtyPadsAndVias,
std::set< PCB_TRACK * > * dirtyTracks,
const std::vector< BOARD_ITEM * > * dirtyCopper = nullptr )

Remove teardrops on dirty pads, vias or tracks, and any whose neighbouring copper moved, dirtying the anchors of the latter.

Call this BEFORE connectivity is updated.

Definition at line 228 of file teardrop.cpp.

References B_Cu, BOX2< Vec >::Contains(), copperNetcode(), F_Cu, F_Mask, BOX2< Vec >::GetCenter(), BOX2< Vec >::Inflate(), BOX2< Vec >::Intersects(), m_board, maskUuidFor(), pad, STRUCT_DELETED, and via.

Referenced by BOARD_COMMIT::Push().

◆ setTeardropPriorities()

void TEARDROP_MANAGER::setTeardropPriorities ( )
private

Set priority of created teardrops.

smaller have bigger priority

Definition at line 616 of file teardrop.cpp.

References ZONE::GetFirstLayer(), ZONE::GetOutlineArea(), m_board, m_createdTdList, EDA_ITEM::m_Uuid, and MAGIC_TEARDROP_ZONE_ID.

Referenced by AddTeardropsOnTracks(), and UpdateTeardrops().

◆ teardropUuid()

KIID TEARDROP_MANAGER::teardropUuid ( const PCB_TRACK * aTrack,
const BOARD_ITEM * aCandidate,
int aSlot )
staticprivate

Build the UUID a teardrop is created with.

Parameters
aSlotseparates the two teardrops of a crossing track; each slot spans two UUIDs

Definition at line 58 of file teardrop.cpp.

References KIID::Combine(), KIID::Increment(), and EDA_ITEM::m_Uuid.

Referenced by AddTeardropsOnTracks(), and UpdateTeardrops().

◆ tryCreateTrackTeardrop()

bool TEARDROP_MANAGER::tryCreateTrackTeardrop ( BOARD_COMMIT & aCommit,
const TEARDROP_PARAMETERS & aParams,
TEARDROP_MANAGER::TEARDROP_VARIANT aTeardropVariant,
PCB_TRACK * aTrack,
PCB_TRACK * aSourceTrack,
BOARD_ITEM * aCandidate,
const VECTOR2I & aPos,
const KIID & aUuid )
private

Attempts to create a track-to-track teardrop.

Parameters
aCommitthe board commit to add the teardrop to
aParamsthe teardrop parameters
aTeardropVariant= variant of the teardrop( attached to a pad, or a track end )
aTrackthe track the teardrop geometry is built from
aSourceTrackthe board track it belongs to, the same as aTrack unless that is a stub
aCandidatethe target item
aPosthe connection position
aUuidis the UUID to give the teardrop
Returns
true if teardrop was created successfully

Definition at line 209 of file teardrop.cpp.

References computeFittedTeardropPolygon(), createAndAddTeardropWithMask(), and TEARDROP_PARAMETERS.

Referenced by AddTeardropsOnTracks(), and UpdateTeardrops().

◆ UpdateTeardrops()

◆ zoneConnections()

const std::vector< std::set< const BOARD_ITEM * > > & TEARDROP_MANAGER::zoneConnections ( ZONE * aZone,
PCB_LAYER_ID aLayer ) const
private
Returns
one set per filled island of aZone on aLayer, holding what that island reaches. Islands stay apart because two items are only joined by the pour if one island has both.

Definition at line 215 of file teardrop_utils.cpp.

References m_board, and m_zoneConnectionCache.

Referenced by areItemsInSameZone().

Friends And Related Symbol Documentation

◆ TEARDROP_PARAMETERS

Member Data Documentation

◆ m_board

◆ m_copperIndexed

bool TEARDROP_MANAGER::m_copperIndexed
mutableprivate

Definition at line 334 of file teardrop.h.

Referenced by ensureCopperIndex(), and TEARDROP_MANAGER().

◆ m_copperRTree

DRC_RTREE TEARDROP_MANAGER::m_copperRTree
mutableprivate

Every copper item plus the teardrops built so far, to keep teardrops off other nets.

Definition at line 333 of file teardrop.h.

Referenced by collidesWithOtherNets(), createAndAddTeardropWithMask(), and ensureCopperIndex().

◆ m_createdTdList

std::vector<ZONE*> TEARDROP_MANAGER::m_createdTdList
private

Definition at line 330 of file teardrop.h.

Referenced by createAndAddTeardropWithMask(), and setTeardropPriorities().

◆ m_pairClearanceCache

std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, int> TEARDROP_MANAGER::m_pairClearanceCache
mutableprivate

Definition at line 339 of file teardrop.h.

Referenced by pairClearance().

◆ m_prmsList

TEARDROP_PARAMETERS_LIST* TEARDROP_MANAGER::m_prmsList
private

Definition at line 326 of file teardrop.h.

Referenced by AddTeardropsOnTracks(), TEARDROP_MANAGER(), and UpdateTeardrops().

◆ m_tolerance

int TEARDROP_MANAGER::m_tolerance
private

Definition at line 322 of file teardrop.h.

Referenced by AddTeardropsOnTracks(), TEARDROP_MANAGER(), and UpdateTeardrops().

◆ m_toolManager

TOOL_MANAGER* TEARDROP_MANAGER::m_toolManager
private

Definition at line 325 of file teardrop.h.

Referenced by TEARDROP_MANAGER().

◆ m_trackLookupList

TRACK_BUFFER TEARDROP_MANAGER::m_trackLookupList
private

Definition at line 329 of file teardrop.h.

Referenced by AddTeardropsOnTracks(), and BuildTrackCaches().

◆ m_tracksRTree

DRC_RTREE TEARDROP_MANAGER::m_tracksRTree
private

Definition at line 328 of file teardrop.h.

Referenced by BuildTrackCaches(), and findTouchingTrack().

◆ m_zoneConnectionCache

std::unordered_map<PTR_LAYER_CACHE_KEY, std::vector<std::set<const BOARD_ITEM*> > > TEARDROP_MANAGER::m_zoneConnectionCache
mutableprivate

Definition at line 337 of file teardrop.h.

Referenced by zoneConnections().


The documentation for this class was generated from the following files: