|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Distance between two closed convex polygons using GJK. More...
#include <geom_algorithms.H>
Classes | |
| struct | ClosestSimplexResult |
| struct | Result |
| Holds the results of the distance computation. More... | |
| struct | SupportPoint |
| A point in the Minkowski difference and its source components. More... | |
Public Member Functions | |
| Result | operator() (const Polygon &p, const Polygon &q) const |
| Compute the distance between two closed convex polygons. | |
Static Private Member Functions | |
| static double | to_double (const Geom_Number &v) |
| static double | dot2 (const double ax, const double ay, const double bx, const double by) noexcept |
| static double | norm2 (const double x, const double y) noexcept |
| static Point | point_from_double (const double x, const double y) |
| static Point | lerp_point (const Point &a, const Point &b, const double t) |
| static Point | centroid_of (const Array< Point > &v) |
| static SupportPoint | support (const Array< Point > &p, const Array< Point > &q, const double dx, const double dy) |
| static bool | polygons_intersect_or_contain (const Polygon &p, const Polygon &q) |
| static ClosestSimplexResult | closest_from_simplex (const std::vector< SupportPoint > &simplex) |
| static Result | exact_refine_disjoint (const Polygon &p, const Polygon &q, const Array< Point > &pv, const Array< Point > &qv) |
Static Private Attributes | |
| static constexpr size_t | kMaxIters = 64 |
| static constexpr double | kEps = 1e-12 |
Distance between two closed convex polygons using GJK.
The algorithm runs a 2D GJK loop on the Minkowski difference to detect overlap and drive the search direction. For robust witness output, disjoint cases are refined with exact point-to-segment checks.
Definition at line 7551 of file geom_algorithms.H.
|
inlinestaticprivate |
Definition at line 7625 of file geom_algorithms.H.
References Aleph::Array< T >::size().
Referenced by operator()().
|
inlinestaticprivate |
Definition at line 7708 of file geom_algorithms.H.
References Aleph::ConvexPolygonDistanceGJK::SupportPoint::a, ah_domain_error_if, Aleph::and, Aleph::ConvexPolygonDistanceGJK::SupportPoint::b, Aleph::divide_and_conquer_partition_dp(), dot2(), Aleph::Point::get_x(), Aleph::Point::get_y(), kEps, lerp_point(), norm2(), point_from_double(), Aleph::ConvexPolygonDistanceGJK::ClosestSimplexResult::reduced_simplex, to_double(), Aleph::ConvexPolygonDistanceGJK::SupportPoint::vx, and Aleph::ConvexPolygonDistanceGJK::SupportPoint::vy.
Referenced by operator()().
|
inlinestaticprivatenoexcept |
Definition at line 7598 of file geom_algorithms.H.
References Aleph::divide_and_conquer_partition_dp().
Referenced by closest_from_simplex(), norm2(), and support().
|
inlinestaticprivate |
Definition at line 7910 of file geom_algorithms.H.
References ah_domain_error_if, Aleph::divide_and_conquer_partition_dp(), Aleph::ConvexPolygonDistanceGJK::Result::intersects, polygons_intersect_or_contain(), Aleph::Segment::project(), and Aleph::square_root().
Referenced by operator()().
|
inlinestaticprivate |
Definition at line 7614 of file geom_algorithms.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Point::get_x(), Aleph::Point::get_y(), point_from_double(), and to_double().
Referenced by closest_from_simplex().
|
inlinestaticprivatenoexcept |
Definition at line 7604 of file geom_algorithms.H.
Referenced by closest_from_simplex(), and operator()().
|
inline |
Compute the distance between two closed convex polygons.
| domain_error | If either polygon is open, has < 3 vertices, or is non-convex. |
Definition at line 7987 of file geom_algorithms.H.
References ah_domain_error_if, centroid_of(), closest_from_simplex(), Aleph::ConvexPolygonDistanceGJK::Result::distance_squared, Aleph::divide_and_conquer_partition_dp(), exact_refine_disjoint(), Aleph::GeomPolygonUtils::extract_vertices(), Aleph::Polygon::is_closed(), Aleph::GeomPolygonUtils::is_convex(), kEps, kMaxIters, norm2(), polygons_intersect_or_contain(), r, Aleph::Polygon::size(), support(), and to_double().
|
inlinestaticprivate |
Definition at line 7609 of file geom_algorithms.H.
References y.
Referenced by closest_from_simplex(), and lerp_point().
|
inlinestaticprivate |
Definition at line 7678 of file geom_algorithms.H.
References Aleph::PointInPolygonWinding::contains(), Aleph::divide_and_conquer_partition_dp(), Aleph::Polygon::Segment_Iterator::has_curr(), and Aleph::Dlink::Iterator::has_curr().
Referenced by exact_refine_disjoint(), and operator()().
|
inlinestaticprivate |
Definition at line 7638 of file geom_algorithms.H.
References Aleph::divide_and_conquer_partition_dp(), dot2(), Aleph::Array< T >::size(), and to_double().
Referenced by operator()().
|
inlinestaticprivate |
Definition at line 7593 of file geom_algorithms.H.
References Aleph::geom_number_to_double().
Referenced by closest_from_simplex(), lerp_point(), operator()(), and support().
Definition at line 7591 of file geom_algorithms.H.
Referenced by closest_from_simplex(), and operator()().
|
staticconstexprprivate |
Definition at line 7590 of file geom_algorithms.H.
Referenced by operator()().