# [−][src]Module ncollide2d::query

Non-persistent geometric queries.

# General cases

The most general methods provided by this module are:

- [
`query::closest_points()`

] to compute the closest points between two shapes. - [
`query::distance()`

] to compute the distance between two shapes. - [
`query::contact()`

] to compute one pair of contact points between two shapes, including penetrating contact. - [
`query::proximity()`

] to determine if two shapes are intersecting or not. - [
`query::time_of_impact()`

] to determine when two shapes undergoing translational motions hit for the first time. - [
`query::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:

- [
`query::RayCast`

] for ray-casting. - [
`query::PointQuery`

] for point projection.

# Specific cases

All the other functions exported by this module 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.
Generally, the specific functions have the form `[operation]_[shape1]_[shape2]()`

where:

`[operation]`

can be`closest_points`

,`distance`

,`contact`

,`proximity`

or`time_of_impact`

.`[shape1]`

is the type of the first shape passed to the function, e.g.,`ball`

, or`plane`

. 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`plane`

. Can also identify a trait implemented by supported shapes, e.g.,`support_map`

.

## Modules

algorithms | Algorithms needed for distance and penetration depth computation. |

visitors | Visitors for performing geometric queries exploiting spatial partitioning data structures. |

## Structs

Contact | Geometric description of a contact. |

ContactId | A contact identifier which is unique within a contact manifold. |

ContactKinematic | Local contact kinematic of a pair of solids around two given points. |

ContactManifold | A contact manifold. |

ContactPrediction | The prediction parameters for contact determination. |

LocalShapeApproximation | The approximation of a shape on the neighborhood of a point. |

PointProjection | Description of the projection of a point on a shape. |

Ray | A Ray. |

RayIntersection | Structure containing the result of a successful ray cast. |

TOI | The result of a time-of-impact (TOI) computation. |

TrackedContact | A contact combined with contact kinematic information as well as a persistent identifier. |

## Enums

ClosestPoints | Closest points information. |

ContactTrackingMode | The technique used for contact tracking. |

NeighborhoodGeometry | A shape geometry type at the neighborhood of a point. |

Proximity | Proximity information. |

TOIStatus | The status of the time-of-impact computation algorithm. |

## Traits

ContactPreprocessor | Pre-process a contact before it is added to a contact manifold. |

PointQuery | Trait of objects that can be tested for point inclusion and projection. |

PointQueryWithLocation | Returns shape-specific info in addition to generic projection information |

RayCast | Traits of objects which can be transformed and tested for intersection with a ray. |

## Functions

closest_points | Computes the pair of closest points between two shapes. |

closest_points_ball_ball | Proximity between balls. |

closest_points_composite_shape_shape | Closest points between a composite shape and any other shape. |

closest_points_line_line | Closest points between two segments. |

closest_points_line_line_parameters | Closest points between two lines. |

closest_points_line_line_parameters_eps | Closest points between two lines with a custom tolerance epsilon. |

closest_points_plane_support_map | Closest points between a plane and a support-mapped shape (Cuboid, ConvexHull, etc.) |

closest_points_segment_segment | Closest points between segments. |

closest_points_segment_segment_with_locations | Closest points between two segments. |

closest_points_segment_segment_with_locations_nD | Segment-segment closest points computation in an arbitrary dimension. |

closest_points_shape_composite_shape | Closest points between a shape and a composite shape. |

closest_points_support_map_plane | Closest points between a support-mapped shape (Cuboid, ConvexHull, etc.) and a plane. |

closest_points_support_map_support_map | Closest points between support-mapped shapes ( |

closest_points_support_map_support_map_with_params | Closest points between support-mapped shapes ( |

contact | Computes one contact point between two shapes. |

contact_ball_ball | Contact between balls. |

contact_composite_shape_shape | Best contact between a composite shape ( |

contact_plane_support_map | Contact between a plane and a support-mapped shape (Cuboid, ConvexHull, etc.) |

contact_shape_composite_shape | Best contact between a shape and a composite ( |

contact_support_map_plane | Contact between a support-mapped shape (Cuboid, ConvexHull, etc.) and a plane. |

contact_support_map_support_map | Contact between support-mapped shapes ( |

contact_support_map_support_map_with_params | Contact between support-mapped shapes ( |

distance | Computes the minimum distance separating two shapes. |

distance_ball_ball | Distance between balls. |

distance_composite_shape_shape | Smallest distance between a composite shape and any other shape. |

distance_plane_support_map | Distance between a plane and a support-mapped shape. |

distance_shape_composite_shape | Smallest distance between a shape and a composite shape. |

distance_support_map_plane | Distance between a support-mapped shape and a plane. |

distance_support_map_support_map | Distance between support-mapped shapes. |

distance_support_map_support_map_with_params | Distance between support-mapped shapes. |

line_toi_with_plane | Computes the toi of an unbounded line with a plane described by its center and normal. |

nonlinear_time_of_impact | Computes the smallest time of impact of two shapes under translational movement. |

nonlinear_time_of_impact_ball_ball | Non-linear Time Of Impact of two balls under a rigid motion (translation + rotation). |

nonlinear_time_of_impact_composite_shape_shape | Time Of Impact of a composite shape with any other shape, under a rigid motion (translation + rotation). |

nonlinear_time_of_impact_shape_composite_shape | Time Of Impact of any shape with a composite shape, under a rigid motion (translation + rotation). |

nonlinear_time_of_impact_support_map_support_map | Time of impacts between two support-mapped shapes under a rigid motion. |

nonlinear_time_of_impact_support_map_support_map_with_closest_points_function | Time of impacts between two support-mapped shapes under a rigid motion. |

point_projection_on_support_map | Projects a point on a shape using the GJK algorithm. |

proximity | Tests whether two shapes are in intersecting or separated by a distance smaller than |

proximity_ball_ball | Proximity between balls. |

proximity_composite_shape_shape | Proximity between a composite shape ( |

proximity_plane_support_map | Proximity between a plane and a support-mapped shape (Cuboid, ConvexHull, etc.) |

proximity_shape_composite_shape | Proximity between a shape and a composite ( |

proximity_support_map_plane | Proximity between a support-mapped shape (Cuboid, ConvexHull, etc.) and a plane. |

proximity_support_map_support_map | Proximity between support-mapped shapes ( |

proximity_support_map_support_map_with_params | Proximity between support-mapped shapes ( |

ray_intersection_with_support_map_with_params | Cast a ray on a shape using the GJK algorithm. |

ray_toi_with_ball | Computes the time of impact of a ray on a ball. |

ray_toi_with_plane | Computes the toi of a ray with a plane described by its center and normal. |

time_of_impact | Computes the smallest time at with two shapes under translational movement are separated by a
distance smaller or equal to |

time_of_impact_ball_ball | Time Of Impact of two balls under translational movement. |

time_of_impact_composite_shape_shape | Time Of Impact of a composite shape with any other shape, under translational movement. |

time_of_impact_plane_support_map | Time Of Impact of a plane with a support-mapped shape under translational movement. |

time_of_impact_shape_composite_shape | Time Of Impact of any shape with a composite shape, under translational movement. |

time_of_impact_support_map_plane | Time Of Impact of a plane with a support-mapped shape under translational movement. |

time_of_impact_support_map_support_map | Time of impacts between two support-mapped shapes under translational movement. |