|
Aleph-w 7.10.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 7104 of file geom_algorithms.H.
|
inlinestaticprivate |
Definition at line 7178 of file geom_algorithms.H.
References Aleph::Array< T >::size().
Referenced by operator()().
|
inlinestaticprivate |
Definition at line 7256 of file geom_algorithms.H.
References Aleph::ConvexPolygonDistanceGJK::SupportPoint::a, ah_domain_error_if, Aleph::and, Aleph::ConvexPolygonDistanceGJK::SupportPoint::b, dot2(), Aleph::Point::get_x(), Aleph::Point::get_y(), kEps, lerp_point(), norm2(), out, 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 7151 of file geom_algorithms.H.
Referenced by closest_from_simplex(), norm2(), and support().
|
inlinestaticprivate |
Definition at line 7453 of file geom_algorithms.H.
References ah_domain_error_if, Aleph::Point::distance_squared_to(), Aleph::ConvexPolygonDistanceGJK::Result::intersects, out, polygons_intersect_or_contain(), Aleph::Segment::project(), Aleph::Array< T >::size(), and Aleph::square_root().
Referenced by operator()().
|
inlinestaticprivate |
Definition at line 7169 of file geom_algorithms.H.
References Aleph::Point::get_x(), Aleph::Point::get_y(), point_from_double(), and to_double().
Referenced by closest_from_simplex().
|
inlinestaticprivatenoexcept |
Definition at line 7159 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 7530 of file geom_algorithms.H.
References ah_domain_error_if, centroid_of(), closest_from_simplex(), Aleph::ConvexPolygonDistanceGJK::ClosestSimplexResult::contains_origin, Aleph::ConvexPolygonDistanceGJK::ClosestSimplexResult::cx, Aleph::ConvexPolygonDistanceGJK::ClosestSimplexResult::cy, exact_refine_disjoint(), Aleph::GeomPolygonUtils::extract_vertices(), Aleph::Point::get_x(), Aleph::Point::get_y(), Aleph::ConvexPolygonDistanceGJK::Result::gjk_iterations, Aleph::Polygon::is_closed(), Aleph::GeomPolygonUtils::is_convex(), kEps, kMaxIters, norm2(), polygons_intersect_or_contain(), r, Aleph::ConvexPolygonDistanceGJK::ClosestSimplexResult::reduced_simplex, Aleph::Polygon::size(), support(), to_double(), Aleph::ConvexPolygonDistanceGJK::ClosestSimplexResult::witness_a, and Aleph::ConvexPolygonDistanceGJK::ClosestSimplexResult::witness_b.
|
inlinestaticprivate |
Definition at line 7164 of file geom_algorithms.H.
References y.
Referenced by closest_from_simplex(), and lerp_point().
|
inlinestaticprivate |
Definition at line 7229 of file geom_algorithms.H.
References Aleph::PointInPolygonWinding::contains(), Aleph::Polygon::Segment_Iterator::has_curr(), Aleph::Dlink::Iterator::has_curr(), and Aleph::Segment::intersects_with().
Referenced by exact_refine_disjoint(), and operator()().
|
inlinestaticprivate |
Definition at line 7191 of file geom_algorithms.H.
References dot2(), Aleph::Point::get_x(), Aleph::Point::get_y(), Aleph::Array< T >::size(), and to_double().
Referenced by operator()().
|
inlinestaticprivate |
Definition at line 7146 of file geom_algorithms.H.
References Aleph::geom_number_to_double().
Referenced by closest_from_simplex(), lerp_point(), operator()(), and support().
|
staticconstexprprivate |
Definition at line 7144 of file geom_algorithms.H.
Referenced by closest_from_simplex(), and operator()().
|
staticconstexprprivate |
Definition at line 7143 of file geom_algorithms.H.
Referenced by operator()().