117 PNS_DBG(
Dbg(), AddItem, &line,
WHITE, 10000, wxString::Format(
"current (policy %d, stat %d)", i, status ) );
128 PNS_DBG(
Dbg(), Message, wxString::Format(
"no-more-colls pol %d st %d", i, status ) );
134 pendingClusters[ i ] = topo.
AssembleCluster( obstacle->m_item, line.Layer(), 0.0, line.Net() );
135 PNS_DBG(
Dbg(), AddItem, obstacle->m_item,
BLUE, 10000, wxString::Format(
"col-item owner-depth %d cl-items=%d",
static_cast<const NODE*
>( obstacle->m_item->Owner() )->
Depth(), (
int) pendingClusters[i].
m_items.size() ) );
143 using namespace std::chrono;
144 auto start_time = steady_clock::now();
148 PNS_DBG(
Dbg(), BeginGroup, wxString::Format(
"cluster-details [cw %d]", aCw?1:0 ), 1 );
150 for(
auto& clItem : aCluster.
m_items )
156 auto now = steady_clock::now();
157 auto elapsed = duration_cast<milliseconds>( now - start_time ).count();
159 if( elapsed > timeout_ms )
161 PNS_DBG(
Dbg(), Message, wxString::Format(
"processCluster timeout after %d ms", timeout_ms ) );
168 clItem,
clearance, aLine.Width(), aLine.Layer() );
187 bool stat = aLine.Walkaround( hull, tmp.
Line(), aCw );
189 PNS_DBG(
Dbg(), AddShape, &hull,
YELLOW, 10000, wxString::Format(
"hull stat %d", stat?1:0 ) );
190 PNS_DBG(
Dbg(), AddItem, &tmp,
RED, 10000, wxString::Format(
"walk stat %d", stat?1:0 ) );
191 PNS_DBG(
Dbg(), AddItem, clItem,
WHITE, 10000, wxString::Format(
"item stat %d", stat?1:0 ) );
199 aLine.SetShape( tmp.
CLine() );
224 LINE path_cw( line ), path_ccw( line );
226 auto st_cw = processCluster( pendingClusters[
WP_SHORTEST], path_cw,
true );
227 auto st_ccw = processCluster( pendingClusters[
WP_SHORTEST], path_ccw,
false );
229 bool cw_coll = st_cw ?
m_world->CheckColliding( &path_cw ).has_value() :
false;
230 bool ccw_coll = st_ccw ?
m_world->CheckColliding( &path_ccw ).has_value() :
false;
232 double lengthFactorCw = (double) path_cw.CLine().Length() / (double)
m_initialLength;
235 PNS_DBG(
Dbg(), AddItem, &path_cw,
RED, 10000, wxString::Format(
"shortest-cw stat %d lf %.1f", st_cw?1:0, lengthFactorCw ) );
236 PNS_DBG(
Dbg(), AddItem, &path_ccw,
BLUE, 10000, wxString::Format(
"shortest-ccw stat %d lf %.1f", st_ccw?1:0, lengthFactorCcw ) );
239 std::optional<LINE> shortest;
240 std::optional<LINE> shortest_alt;
243 if( st_cw && st_ccw )
245 if( !cw_coll && !ccw_coll || ( cw_coll && ccw_coll) )
247 if( path_cw.CLine().Length() > path_ccw.
CLine().
Length() )
250 shortest_alt = path_cw;
255 shortest_alt = path_ccw;
269 bool anyColliding =
false;
275 if( shortest->Collide( item,
m_world, shortest->Layer() ) )
287 shortest = std::move( shortest_alt );
328 start( aInitialPath );
330 PNS_DBG(
Dbg(), AddItem, &aInitialPath,
WHITE, 10000, wxT(
"initial-path" ) );
336 bool stillInProgress =
false;
345 double lengthFactor = (double) ln.CLine().Length() / (double) aInitialPath.
CLine().
Length();
356 PNS_DBG(
Dbg(), Message, wxString::Format(
"check-wp iter %d st %d i %d lf %.1f",
m_iteration, st, pol, lengthFactor ) );
359 stillInProgress =
true;
363 if( !stillInProgress )
379 if( ln.SegmentCount() < 1 || ln.CPoint( 0 ) != aInitialPath.
CPoint( 0 ) )
384 if( ln.PointCount() > 0 && ln.CLastPoint() != aInitialPath.
CLastPoint() )
389 PNS_DBG(
Dbg(), Message, wxString::Format(
"stat=%d", st ) );
wxString result
Test unit parsing edge cases and error handling.