@@ -418,6 +418,13 @@ struct traversal
418
418
return true ;
419
419
}
420
420
421
+
422
+ template <typename RankedPoint>
423
+ inline turn_operation_type const & operation_from_rank (RankedPoint const & rp) const
424
+ {
425
+ return m_turns[rp.turn_index ].operations [rp.operation_index ];
426
+ }
427
+
421
428
inline int select_turn_in_cluster_union (std::size_t selected_rank,
422
429
typename sbs_type::rp const & ranked_point,
423
430
signed_size_type start_turn_index, int start_op_index) const
@@ -432,8 +439,7 @@ struct traversal
432
439
return 0 ;
433
440
}
434
441
435
- turn_type const & turn = m_turns[ranked_point.turn_index ];
436
- turn_operation_type const & op = turn.operations [ranked_point.operation_index ];
442
+ turn_operation_type const & op = operation_from_rank (ranked_point);
437
443
438
444
// Check finalized: TODO: this should be finetuned, it is not necessary
439
445
if (op.visited .finalized ())
@@ -456,12 +462,6 @@ struct traversal
456
462
;
457
463
}
458
464
459
- template <typename RankedPoint>
460
- inline turn_operation_type const & operation_from_rank (RankedPoint const & rp) const
461
- {
462
- return m_turns[rp.turn_index ].operations [rp.operation_index ];
463
- }
464
-
465
465
inline signed_size_type select_rank (sbs_type const & sbs,
466
466
bool skip_isolated) const
467
467
{
@@ -547,10 +547,9 @@ struct traversal
547
547
548
548
if (ranked_point.rank == selected_rank)
549
549
{
550
- turn_type const & ranked_turn = m_turns[ranked_point.turn_index ];
551
- turn_operation_type const & ranked_op = ranked_turn.operations [ranked_point.operation_index ];
550
+ turn_operation_type const & op = operation_from_rank (ranked_point);
552
551
553
- if (ranked_op .visited .finalized ())
552
+ if (op .visited .finalized ())
554
553
{
555
554
// This direction is already traveled before, the same
556
555
// cannot be traveled again
@@ -559,10 +558,10 @@ struct traversal
559
558
560
559
// Take turn with the smallest remaining distance
561
560
if (selected_index == sbs.m_ranked_points .size ()
562
- || ranked_op .remaining_distance < min_remaining_distance)
561
+ || op .remaining_distance < min_remaining_distance)
563
562
{
564
563
selected_index = i;
565
- min_remaining_distance = ranked_op .remaining_distance ;
564
+ min_remaining_distance = op .remaining_distance ;
566
565
}
567
566
}
568
567
}
0 commit comments