@@ -228,23 +228,23 @@ class TurnSignalDecider
228
228
using tier4_autoware_utils::transformVector;
229
229
230
230
const auto footprint = vehicle_info.createFootprint ();
231
-
232
- for ( const auto & lane : lanes) {
233
- for ( size_t i = shift_line. start_idx ; i < shift_line. end_idx ; ++i) {
234
- const auto transform = pose2transform (path. path . points . at (i). point . pose );
235
- const auto shifted_vehicle_footprint = transformVector (footprint, transform );
236
-
237
- if ( intersects (lane. leftBound2d (). basicLineString (), shifted_vehicle_footprint)) {
238
- return true ;
239
- }
240
-
241
- if ( intersects ( lane.rightBound2d ().basicLineString (), shifted_vehicle_footprint)) {
242
- return true ;
243
- }
244
- }
245
- }
246
-
247
- return false ;
231
+ const auto start_itr = std::next (path. path . points . begin (), shift_line. start_idx );
232
+ const auto end_itr = std::next (path. path . points . begin (), shift_line. end_idx );
233
+
234
+ return std::any_of (start_itr, end_itr, [&footprint, &lanes]( const auto & point) {
235
+ const auto transform = pose2transform (point. point . pose );
236
+ const auto shifted_vehicle_footprint = transformVector (footprint, transform);
237
+
238
+ auto check_for_vehicle_and_bound_intersection =
239
+ [&shifted_vehicle_footprint]( const auto & lane) {
240
+ const auto & left_bound = lane. leftBound2d (). basicLineString ();
241
+ const auto & right_bound = lane.rightBound2d ().basicLineString ();
242
+ return intersects (left_bound, shifted_vehicle_footprint) ||
243
+ intersects (right_bound, shifted_vehicle_footprint);
244
+ };
245
+
246
+ return std::any_of (lanes. begin (), lanes. end (), check_for_vehicle_and_bound_intersection);
247
+ }) ;
248
248
};
249
249
250
250
inline bool isNearEndOfShift (
0 commit comments