Skip to content

Commit 7552200

Browse files
committed
[traverse] use new method operation_from_rank in two other places as well
1 parent 556896c commit 7552200

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

include/boost/geometry/algorithms/detail/overlay/traversal.hpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,13 @@ struct traversal
418418
return true;
419419
}
420420

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+
421428
inline int select_turn_in_cluster_union(std::size_t selected_rank,
422429
typename sbs_type::rp const& ranked_point,
423430
signed_size_type start_turn_index, int start_op_index) const
@@ -432,8 +439,7 @@ struct traversal
432439
return 0;
433440
}
434441

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);
437443

438444
// Check finalized: TODO: this should be finetuned, it is not necessary
439445
if (op.visited.finalized())
@@ -456,12 +462,6 @@ struct traversal
456462
;
457463
}
458464

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-
465465
inline signed_size_type select_rank(sbs_type const& sbs,
466466
bool skip_isolated) const
467467
{
@@ -547,10 +547,9 @@ struct traversal
547547

548548
if (ranked_point.rank == selected_rank)
549549
{
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);
552551

553-
if (ranked_op.visited.finalized())
552+
if (op.visited.finalized())
554553
{
555554
// This direction is already traveled before, the same
556555
// cannot be traveled again
@@ -559,10 +558,10 @@ struct traversal
559558

560559
// Take turn with the smallest remaining distance
561560
if (selected_index == sbs.m_ranked_points.size()
562-
|| ranked_op.remaining_distance < min_remaining_distance)
561+
|| op.remaining_distance < min_remaining_distance)
563562
{
564563
selected_index = i;
565-
min_remaining_distance = ranked_op.remaining_distance;
564+
min_remaining_distance = op.remaining_distance;
566565
}
567566
}
568567
}

0 commit comments

Comments
 (0)