Skip to content

Conversation

@ktro2828
Copy link

@ktro2828 ktro2828 commented Oct 31, 2025

Description

Currently, is_clockwise(...) function throws std::out_of_range if the input polygon is empty.

This pull request makes a small change to the is_clockwise function in boost_polygon_utils.cpp to improve its robustness. Specifically, it adds a check to handle empty polygons safely, preventing potential out-of-bounds access.

  • Robustness improvement:
    • Updated the initialization of x_offset and y_offset in the is_clockwise function to check if the polygon has at least one point before accessing the first element, defaulting to 0.0 if empty.

How was this PR tested?

Confirmed the unit test succeeded after updating.

Notes for reviewers

None.

Effects on system behavior

None.

@github-actions
Copy link

github-actions bot commented Oct 31, 2025

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@ktro2828 ktro2828 marked this pull request as ready for review October 31, 2025 07:11
@ktro2828 ktro2828 changed the title fix: avoid to raise exception if the polygon is empty fix(autoware_utils_geometry): avoid to raise exception if the polygon is empty Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant