Module parry2d::query

source ·
Expand description

Non-persistent geometric queries.

§General cases

The most general methods provided by this module are:

  • closest_points() to compute the closest points between two shapes.
  • distance() to compute the distance between two shapes.
  • contact() to compute one pair of contact points between two shapes, including penetrating contact.
  • intersection_test() to determine if two shapes are intersecting or not.
  • time_of_impact() to determine when two shapes undergoing translational motions hit for the first time.
  • nonlinear_time_of_impact() to determine when two shapes undergoing continuous rigid motions hit for the first time.

Ray-casting and point-projection can be achieved by importing traits:

§Specific cases

The functions exported by the details submodule are more specific versions of the ones described above. For example distance_ball_ball computes the distance between two shapes known at compile-time to be balls. They are less convenient to use than the most generic version but will be slightly faster due to the lack of dynamic dispatch. The specific functions have the form [operation]_[shape1]_[shape2]() where:

  • [operation] can be closest_points, distance, contact, intersection_test or time_of_impact.
  • [shape1] is the type of the first shape passed to the function, e.g., ball, or halfspace. Can also identify a trait implemented by supported shapes, e.g., support_map.
  • [shape2] is the type of the second shape passed to the function, e.g., ball, or halfspace. Can also identify a trait implemented by supported shapes, e.g., support_map.

Re-exports§

Modules§

  • Implementation details of the closest_points function.
  • Implementation details of the contact and contacts functions.
  • Queries dedicated to specific pairs of shapes.
  • The EPA algorithm for penetration depth computation.
  • The GJK algorithm for distance computation.
  • Point inclusion and projection.
  • Application of the Separating-Axis-Theorem (SAT).
  • Visitors for performing geometric queries exploiting spatial partitioning data structures.

Structs§

Enums§

Traits§

Functions§

  • Computes the minimum distance separating two shapes.
  • Tests whether two shapes are intersecting.
  • Computes the smallest time of impact of two shapes under translational an rotational movements.
  • Computes the smallest time when two shapes under translational movement are separated by a distance smaller or equal to distance.