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(autoware_universe_utils): reduce dependence on Boost.Geometry #7778

Merged

Conversation

mitukou1109
Copy link
Contributor

@mitukou1109 mitukou1109 commented Jul 2, 2024

Description

This PR adds the following functions to reduce dependence on Boost.Geometry.

Boost.Geometry
(boost::geometry)
alternative
(autoware::universe_utils)
supported types
area() area() polygon
convex_hull() convex_hull() point list
correct() correct() polygon
covered_by() covered_by() point & polygon
disjoint() disjoint() polygon & polygon
distance() distance() point & segment (2 edge points) / point & polygon
equals() equals() point & point / polygon & polygon
intersects() intersects() segment & segment / polygon & polygon
touches() touches() point & polygon
within() within() point & polygon / polygon & polygon

Notes:

  • It is assumed that polygons are convex and do not have holes.
  • Polygons do not have closing points (i.e. the last vertex in the array does not match the first, as any polygon given is considered to be closed).
  • correct() sorts outer points in clockwise order with respect to the first point AND removes duplicate points.

Related links

Parent Issue:

How was this PR tested?

colcon test --packages-select autoware_universe_utils

Benchmark result with 500 randomly generated polygons with 9 vertices:

function Boost self-impl. task
area() 0.03ms 0.03ms calculate the area of 500 polygons
convex_hull() 0.38ms 0.32ms calculate the convex hull of vertices of 500 polygons
covered_by() 309.93ms 307.29ms check if each vertex of 500 polygons is covered by (= inside or on border of) another 500 polygons
disjoint() 198.91ms 77.51ms check if 500 polygons are disjoint (runs totally 250,000 times)
intersects() 199.10ms 58.56ms check if 500 polygons intersect (runs totally 250,000 times)
touches() 296.44ms 310.73ms check if each vertex of 500 polygons touches (= on border of) another 500 polygons
within() 1058.86ms 55.80ms check if each of 500 polygons is within 500 polygons

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 Jul 2, 2024
Copy link

github-actions bot commented Jul 2, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

@mitukou1109 mitukou1109 changed the title feat(autoware_universe_utils): reduce dependence on Boost.geometry feat(autoware_universe_utils): reduce dependence on Boost.Geometry Jul 2, 2024
@mitukou1109 mitukou1109 force-pushed the feat/no_boost_geometry branch 2 times, most recently from e6b5275 to 805dd1d Compare July 5, 2024 08:58
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
@mitukou1109 mitukou1109 force-pushed the feat/no_boost_geometry branch from 805dd1d to bb65929 Compare July 11, 2024 06:22
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
@satoshi-ota satoshi-ota self-assigned this Jul 18, 2024
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Copy link
Contributor

@maxime-clem maxime-clem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not check all the code in details yet but I think there are a few issues to fix because the PR can be merged.

  • the alternative intersects only works for convex polygons (whereas the boost implementation also works for non-convex polygons).
  • the random test only use convex polygons.
  • GJK is already implemented so we should see which implementation to keep.

@@ -583,6 +584,148 @@ std::optional<geometry_msgs::msg::Point> intersect(
*/
bool intersects_convex(const Polygon2d & convex_polygon1, const Polygon2d & convex_polygon2);

// Alternatives for Boost.Geometry ----------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(minor) I think the new code could be added to a separate file as the current one is becoming too big.
This can be done in a future PR.

return true;
}

bool intersects(const alt::ConvexPolygon2d & poly1, const alt::ConvexPolygon2d & poly2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GJK is already implemented (https://github.com/autowarefoundation/autoware.universe/blob/main/common/autoware_universe_utils/src/geometry/gjk_2d.cpp) but it only works for convex polygon.
If your goal is to provide an alternative to the boost::geometry::intersects function, then you need to use a more general algorithm that also works for concave planners.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I already named the class for representing polygons ConvexPolygon2d and thus I do not expect the input to be concave (at least for now).

}
}

TEST(geometry, intersects)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should include non-convex polygons.

}
}

TEST(geometry, intersectsRand)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test (and probably the other random tests as well) should also use random non-convex polygons.
@mraditya01 is working on random polygon generation so maybe you can coordinate with him.

Comment on lines 624 to 625
return std::abs(point1.x() - point2.x()) <= std::numeric_limits<double>::epsilon() &&
std::abs(point1.y() - point2.y()) <= std::numeric_limits<double>::epsilon();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I read (e.g., here or here), using std::numeric_limits<double>::epsilon() directly is not a good way to check for precision when comparing two numbers.
I think it would make more sense to define an epsilon based on the accuracy we want to reach (e.g., 1e-3 for mm accuracy).

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 75.82846% with 124 lines in your changes missing coverage. Please review.

Project coverage is 30.50%. Comparing base (3d849e9) to head (c95aaaf).
Report is 969 commits behind head on main.

Files Patch % Lines
...universe_utils/test/src/geometry/test_geometry.cpp 69.73% 10 Missing and 92 partials ⚠️
.../autoware_universe_utils/src/geometry/geometry.cpp 89.93% 9 Missing and 7 partials ⚠️
...lude/autoware/universe_utils/geometry/geometry.hpp 64.70% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #7778       +/-   ##
===========================================
+ Coverage   15.09%   30.50%   +15.41%     
===========================================
  Files        1967     1352      -615     
  Lines      135941   105603    -30338     
  Branches    42122    47098     +4976     
===========================================
+ Hits        20520    32217    +11697     
+ Misses      92700    64835    -27865     
+ Partials    22721     8551    -14170     
Flag Coverage Δ
differential 30.50% <75.82%> (?)
total ?

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

mitukou1109 and others added 3 commits August 2, 2024 13:13
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
@satoshi-ota satoshi-ota enabled auto-merge (squash) August 9, 2024 06:01
@satoshi-ota satoshi-ota merged commit 7f96352 into autowarefoundation:main Aug 9, 2024
22 of 24 checks passed
technolojin pushed a commit to technolojin/autoware.universe that referenced this pull request Aug 13, 2024
…utowarefoundation#7778)

* add within function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* return nullopt as is

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add disjoint function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add polygon-and-polygon version of intersect function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* use intersect for disjoint

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add test case for disjoint

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* checking intersection of edges is unnecessary

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* return nullopt when no intersection point found

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add distance function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add coveredBy function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add point-polygon variant of distance function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add isAbove function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add divideBySegment function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add convexHull function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add correct function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add area function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change point type to tf2::Vector3

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* simplify correct function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* push geometry types to namespace

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* match the behavior of Boost.Geometry

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add test cases for benchmarking

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add headers for convex_hull()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* remove polygon-polygon intersect & disjoint function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add intersects function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add touches function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add disjoint function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* minor fix

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change name Polygon to CvxPolygon

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change name CvxPolygon to ConvexPolygon

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* rename intersect function and restore the original

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change function names to snake_case

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* early return

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change point type from tf2::Vector3 to custom struct

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* style(pre-commit): autofix

* use alt::Vector2d to represent point

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* convert from boost before time measurement

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add header for std::move

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* avoid using long

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* convert from boost before time measurement

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add point-segment variant of touches function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of point-polygon touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of area()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add note for class naming

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of covered_by()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* simplify within()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of covered_by()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of within()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* use operator[] instead of at()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* print point when covered_by() test failed

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* avoid using hypot()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performace of convex_hull()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* remove divide_by_segment() function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* fix test cases

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add test case for touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change type alias PointList to Points2d

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add & fix vector size assertions

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* define epsilon respectively

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

---------

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Satoshi OTA <44889564+satoshi-ota@users.noreply.github.com>
esteve pushed a commit to esteve/autoware.universe that referenced this pull request Aug 13, 2024
…utowarefoundation#7778)

* add within function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* return nullopt as is

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add disjoint function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add polygon-and-polygon version of intersect function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* use intersect for disjoint

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add test case for disjoint

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* checking intersection of edges is unnecessary

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* return nullopt when no intersection point found

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add distance function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add coveredBy function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add point-polygon variant of distance function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add isAbove function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add divideBySegment function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add convexHull function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add correct function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add area function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change point type to tf2::Vector3

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* simplify correct function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* push geometry types to namespace

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* match the behavior of Boost.Geometry

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add test cases for benchmarking

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add headers for convex_hull()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* remove polygon-polygon intersect & disjoint function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add intersects function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add touches function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add disjoint function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* minor fix

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change name Polygon to CvxPolygon

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change name CvxPolygon to ConvexPolygon

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* rename intersect function and restore the original

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change function names to snake_case

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* early return

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change point type from tf2::Vector3 to custom struct

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* style(pre-commit): autofix

* use alt::Vector2d to represent point

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* convert from boost before time measurement

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add header for std::move

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* avoid using long

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* convert from boost before time measurement

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add point-segment variant of touches function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of point-polygon touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of area()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add note for class naming

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of covered_by()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* simplify within()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of covered_by()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of within()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* use operator[] instead of at()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* print point when covered_by() test failed

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* avoid using hypot()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performace of convex_hull()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* remove divide_by_segment() function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* fix test cases

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add test case for touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change type alias PointList to Points2d

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add & fix vector size assertions

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* define epsilon respectively

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

---------

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Satoshi OTA <44889564+satoshi-ota@users.noreply.github.com>
xtk8532704 pushed a commit to tier4/autoware.universe that referenced this pull request Aug 15, 2024
…utowarefoundation#7778)

* add within function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* return nullopt as is

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add disjoint function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add polygon-and-polygon version of intersect function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* use intersect for disjoint

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add test case for disjoint

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* checking intersection of edges is unnecessary

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* return nullopt when no intersection point found

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add distance function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add coveredBy function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add point-polygon variant of distance function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add isAbove function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add divideBySegment function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add convexHull function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add correct function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add area function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change point type to tf2::Vector3

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* simplify correct function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* push geometry types to namespace

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* match the behavior of Boost.Geometry

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add test cases for benchmarking

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add headers for convex_hull()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* remove polygon-polygon intersect & disjoint function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add intersects function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add touches function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add disjoint function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* minor fix

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change name Polygon to CvxPolygon

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change name CvxPolygon to ConvexPolygon

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* rename intersect function and restore the original

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change function names to snake_case

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* early return

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change point type from tf2::Vector3 to custom struct

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* style(pre-commit): autofix

* use alt::Vector2d to represent point

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* convert from boost before time measurement

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add header for std::move

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* avoid using long

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* convert from boost before time measurement

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add point-segment variant of touches function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of point-polygon touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of area()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add note for class naming

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of covered_by()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* simplify within()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of covered_by()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of within()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* use operator[] instead of at()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* print point when covered_by() test failed

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* avoid using hypot()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performace of convex_hull()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* remove divide_by_segment() function

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* fix test cases

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add test case for touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* improve performance of touches()

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* change type alias PointList to Points2d

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* add & fix vector size assertions

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

* define epsilon respectively

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>

---------

Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Satoshi OTA <44889564+satoshi-ota@users.noreply.github.com>
Signed-off-by: xtk8532704 <1041084556@qq.com>
@mitukou1109 mitukou1109 deleted the feat/no_boost_geometry branch September 13, 2024 04:34
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.

5 participants