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 =
117 bool s_cw = aPath.
Walkaround( hull, path_walk, aWindingDirection );
121 wxString::Format(
"hull-%s-%d-cl %d", aWindingDirection ? wxT(
"cw" ) : wxT(
"ccw" ),
124 wxString::Format(
"path-%s-%d", aWindingDirection ? wxT(
"cw" ) : wxT(
"ccw" ),
127 wxString::Format(
"result-%s-%d", aWindingDirection ? wxT(
"cw" ) : wxT(
"ccw" ),
129 PNS_DBG(
Dbg(), Message, wxString::Format( wxT(
"Stat cw %d" ), !!s_cw ) );
150 LINE path_cw( aInitialPath ), path_ccw( aInitialPath );
165 start( aInitialPath );
169 result.
lineCw = aInitialPath;
182 const int maxWalkDistFactor = 10;
183 long long lengthLimit = aInitialPath.
CLine().
Length() * maxWalkDistFactor;
208 double length = (double)aInitialPath.
CLine().
Length();
209 wxCHECK2( length != 0, length = 1.0 );
210 double lcw = path_cw.Line().Length() / length;
213 wxCHECK2( length != 0, length = 1.0 );
214 double lccw = path_ccw.
Line().
Length() / length;
216 PNS_DBG(
Dbg(), Message, wxString::Format( wxT(
"lcw %.1f lccw %.1f" ), lcw, lccw ) );
271 LINE path_cw( aInitialPath ), path_ccw( aInitialPath );
282 aWalkPath = aInitialPath;
286 start( aInitialPath );
290 aWalkPath = aInitialPath;
300 if( path_cw.PointCount() == 0 )
314 int len_cw = path_cw.CLine().Length();
318 aWalkPath = ( len_cw > len_ccw ? path_cw : path_ccw );
320 aWalkPath = ( len_cw < len_ccw ? path_cw : path_ccw );
331 aWalkPath = path_ccw;
340 int len_cw = path_cw.CLine().Length();
344 aWalkPath = ( len_cw > len_ccw ? path_cw : path_ccw );
346 aWalkPath = ( len_cw < len_ccw ? path_cw : path_ccw );
354 if( aWalkPath.
CPoint( -1 ) != aInitialPath.
CPoint( -1 ) )
coord_type GetTop() const
coord_type GetRight() const
coord_type GetLeft() const
coord_type GetBottom() const
@ ROUNDED_90
H/V with filleted corners.
@ MITERED_90
H/V only (90-degree corners)
ROUTING_SETTINGS & Settings() const
Return the logger object, allowing to dump geometry to a file.
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.
DIRECTION_45::CORNER_MODE GetCornerMode() const
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...
void Simplify(int aMaxError=0)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
void Clear()
Remove all points from 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.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
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