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

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allow concave polygon to be checked whether within convex polygon
Signed-off-by: mitukou1109 <mitukou1109@gmail.com>
  • Loading branch information
mitukou1109 committed Oct 28, 2024
commit a1986a79775e10eefdf803f9b4c681cab7df91e4
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ bool touches(const alt::Point2d & point, const alt::Polygon2d & poly);

bool within(const alt::Point2d & point, const alt::Polygon2d & poly);

bool within(
const alt::ConvexPolygon2d & poly_contained, const alt::ConvexPolygon2d & poly_containing);
bool within(const alt::Polygon2d & poly_contained, const alt::ConvexPolygon2d & poly_containing);
} // namespace autoware::universe_utils

#endif // AUTOWARE__UNIVERSE_UTILS__GEOMETRY__ALT_GEOMETRY_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -656,15 +656,14 @@ bool within(const alt::Point2d & point, const alt::Polygon2d & poly)
return true;
}

bool within(
const alt::ConvexPolygon2d & poly_contained, const alt::ConvexPolygon2d & poly_containing)
bool within(const alt::Polygon2d & poly_contained, const alt::ConvexPolygon2d & poly_containing)
{
if (equals(poly_contained, poly_containing)) {
return true;
}

// check if all points of poly_contained are within poly_containing
for (const auto & vertex : poly_contained.vertices()) {
for (const auto & vertex : poly_contained.outer()) {
if (!within(vertex, poly_containing)) {
return false;
}
Expand Down