74 for(
ITEM* item : aSet )
78 if ( item->HasHole() )
83 for(
ITEM* item : aSet )
85 if(
SOLID* solid = dyn_cast<SOLID*>( item ) )
93 std::optional<OBSTACLE>& current_obs =
106 bool s_cw = aPath.
Walkaround( hull, path_walk, aWindingDirection );
109 PNS_DBG(
Dbg(), AddShape, &hull,
RED, 0, wxString::Format(
"hull-%s-%d-cl %d", aWindingDirection ? wxT(
"cw" ) : wxT(
"ccw" ),
m_iteration, current_obs->m_clearance ) );
111 PNS_DBG(
Dbg(), AddShape, &path_walk,
BLUE, 0, wxString::Format(
"result-%s-%d", aWindingDirection ? wxT(
"cw" ) : wxT(
"ccw" ),
m_iteration ) );
112 PNS_DBG(
Dbg(), Message, wxString::Format( wxT(
"Stat cw %d" ), !!s_cw ) );
133 LINE path_cw( aInitialPath ), path_ccw( aInitialPath );
148 start( aInitialPath );
152 result.
lineCw = aInitialPath;
165 const int maxWalkDistFactor = 10;
166 long long lengthLimit = aInitialPath.
CLine().
Length() * maxWalkDistFactor;
191 double lcw = path_cw.Line().Length() / (double)aInitialPath.
CLine().
Length();
194 PNS_DBG(
Dbg(), Message, wxString::Format( wxT(
"lcw %.1f lccw %.1f" ), lcw, lccw ) );
248 LINE path_cw( aInitialPath ), path_ccw( aInitialPath );
258 aWalkPath = aInitialPath;
262 start( aInitialPath );
266 aWalkPath = aInitialPath;
276 if( path_cw.PointCount() == 0 )
290 int len_cw = path_cw.CLine().Length();
294 aWalkPath = ( len_cw > len_ccw ? path_cw : path_ccw );
296 aWalkPath = ( len_cw < len_ccw ? path_cw : path_ccw );
307 aWalkPath = path_ccw;
316 int len_cw = path_cw.CLine().Length();
320 aWalkPath = ( len_cw > len_ccw ? path_cw : path_ccw );
322 aWalkPath = ( len_cw < len_ccw ? path_cw : path_ccw );
330 if( aWalkPath.
CPoint( -1 ) != aInitialPath.
CPoint( -1 ) )
DEBUG_DECORATOR * Dbg() const
Base class for PNS router board items.
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
const VECTOR2I & CPoint(int aIdx) const
void SetShape(const SHAPE_LINE_CHAIN &aLine)
Return the shape of the line.
const SHAPE_LINE_CHAIN & CLine() const
SHAPE_LINE_CHAIN & Line()
bool Walkaround(SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aWalk, SHAPE_LINE_CHAIN &aPost, bool aCw) const
Calculate a line tightly wrapping a convex hull of an obstacle object (aObstacle).
int Width() const
Return true if the line is geometrically identical as line aOther.
virtual void ClearLinks()
Return the number of segments that were assembled together to form this line.
OPT_OBSTACLE CheckColliding(const ITEM *aItem, int aKindMask=ITEM::ANY_T)
Check if the item collides with anything else in the world, and if found, returns the obstacle.
std::optional< OBSTACLE > OPT_OBSTACLE
OPT_OBSTACLE NearestObstacle(const LINE *aLine, const COLLISION_SEARCH_OPTIONS &aOpts=COLLISION_SEARCH_OPTIONS())
Follow the line in search of an obstacle that is nearest to the starting to the line's starting point...
static bool Optimize(LINE *aLine, int aEffortLevel, NODE *aWorld, const VECTOR2I &aV=VECTOR2I(0, 0))
@ MERGE_OBTUSE
Reduce corner cost by merging obtuse segments.
std::set< ITEM * > m_restrictedSet
WALKAROUND_STATUS singleStep(LINE &aPath, bool aWindingDirection)
NODE::OPT_OBSTACLE m_currentObstacle[2]
NODE::OPT_OBSTACLE nearestObstacle(const LINE &aPath)
std::vector< VECTOR2I > m_restrictedVertices
WALKAROUND_STATUS Route(const LINE &aInitialPath, LINE &aWalkPath, bool aOptimize=true)
void start(const LINE &aInitialPath)
void RestrictToSet(bool aEnabled, const std::set< ITEM * > &aSet)
bool PointOnEdge(const VECTOR2I &aP, int aAccuracy=0) const
Check if point aP lies on an edge or vertex of the line chain.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override
Check if point aP lies inside a closed shape.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
long long int Length() const
Return length of the line chain in Euclidean metric.
Push and Shove diff pair dimensions (gap) settings dialog.
#define PNS_DBG(dbg, method,...)
#define PNS_DBGN(dbg, method)
std::set< ITEM * > * m_restrictedSet
bool m_useClearanceEpsilon
WALKAROUND_STATUS statusCcw
WALKAROUND_STATUS statusCw