Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(universe_utils): add Polygon Clipping implementation to do boolean operation on Polygons (XOR, OR, AND) #8728

Merged
merged 30 commits into from
Jan 29, 2025

Conversation

mraditya01
Copy link
Contributor

@mraditya01 mraditya01 commented Sep 3, 2024

Description

Added new polygon clipping function within universe_utils to do boolean operation on multiple polygons using Greiner-Hormann clipping algorithm.

Related links

Parent Issue:

  • Link

How was this PR tested?

Unit and random test.
Conducted a performance comparison and point-wise evaluation using an epsilon of 1 with the functions boost::geometry::difference, boost::geometry::union_, and boost::geometry::intersection. Additionally, verified results with Shapely using an epsilon of 1e-6.

vertices = 4
	Union:
		Custom = 578.75 ms
		Boost::geometry = 1234.70 ms
		Matching Polygon = 249500
		Different Polygon = 0
	Intersection:
		Custom = 297.46 ms
		Boost::geometry = 995.62 ms
		Matching Polygon = 249500
		Different Polygon = 0
vertices = 5
	Union:
		Custom = 753.72 ms
		Boost::geometry = 1471.03 ms
		Matching Polygon = 249500
		Different Polygon = 0
	Intersection:
		Custom = 385.73 ms
		Boost::geometry = 1170.93 ms
		Matching Polygon = 249500
		Different Polygon = 0
vertices = 6
	Union:
		Custom = 905.92 ms
		Boost::geometry = 1637.74 ms
		Matching Polygon = 249500
		Different Polygon = 0
	Intersection:
		Custom = 508.24 ms
		Boost::geometry = 1278.59 ms
		Matching Polygon = 249500
		Different Polygon = 0
vertices = 7
	Union:
		Custom = 1071.70 ms
		Boost::geometry = 1867.30 ms
		Matching Polygon = 249500
		Different Polygon = 0
	Intersection:
		Custom = 618.66 ms
		Boost::geometry = 1456.06 ms
		Matching Polygon = 249500
		Different Polygon = 0
vertices = 8
	Union:
		Custom = 1258.94 ms
		Boost::geometry = 2091.93 ms
		Matching Polygon = 249500
		Different Polygon = 0
	Intersection:
		Custom = 736.47 ms
		Boost::geometry = 1630.60 ms
		Matching Polygon = 249500
		Different Polygon = 0
vertices = 9
	Union:
		Custom = 1443.39 ms
		Boost::geometry = 2295.15 ms
		Matching Polygon = 249500
		Different Polygon = 0
	Intersection:
		Custom = 831.60 ms
		Boost::geometry = 1806.78 ms
		Matching Polygon = 249500
		Different Polygon = 0

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@github-actions github-actions bot added the component:common Common packages from the autoware-common repository. (auto-assigned) label Sep 3, 2024
Copy link

github-actions bot commented Sep 3, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

@mraditya01 mraditya01 marked this pull request as ready for review October 15, 2024 06:55
@maxime-clem maxime-clem added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Oct 16, 2024
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 85.03937% with 38 lines in your changes missing coverage. Please review.

Project coverage is 29.76%. Comparing base (461dbc1) to head (26837e1).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...oware_universe_utils/src/geometry/polygon_clip.cpp 83.96% 27 Missing and 11 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8728      +/-   ##
==========================================
+ Coverage   29.21%   29.76%   +0.54%     
==========================================
  Files        1439     1598     +159     
  Lines      108115   128955   +20840     
  Branches    42638    52567    +9929     
==========================================
+ Hits        31588    38379    +6791     
- Misses      73485    86327   +12842     
- Partials     3042     4249    +1207     
Flag Coverage Δ *Carryforward flag
differential 32.39% <85.03%> (?)
total 29.61% <ø> (+0.39%) ⬆️ Carriedforward from 45af3e1

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maxime-clem maxime-clem merged commit f1d5e0e into autowarefoundation:main Jan 29, 2025
32 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:common Common packages from the autoware-common repository. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants