Skip to main content

parry3d/query/
mod.rs

1//! Non-persistent geometric queries.
2//!
3//! # General cases
4//! The most general methods provided by this module are:
5//!
6//! * [`closest_points()`] to compute the closest points between two shapes.
7//! * [`distance()`] to compute the distance between two shapes.
8//! * [`contact()`] to compute one pair of contact points between two shapes, including penetrating contact.
9//! * [`intersection_test()`] to determine if two shapes are intersecting or not.
10//! * [`cast_shapes()`] to determine when two shapes undergoing translational motions hit for the first time.
11//! * [`cast_shapes_nonlinear()`] to determine when two shapes undergoing continuous rigid motions hit for the first time.
12//!
13//! Ray-casting and point-projection can be achieved by importing traits:
14//!
15//! * [`RayCast`] for ray-casting.
16//! * [`PointQuery`] for point projection.
17//!
18//! # Specific cases
19//! The functions exported by the `details` submodule are more specific versions of the ones described above.
20//! For example `distance_ball_ball` computes the distance between two shapes known at compile-time to be balls.
21//! They are less convenient to use than the most generic version but will be slightly faster due to the lack of dynamic dispatch.
22//! The specific functions have the form `[operation]_[shape1]_[shape2]()` where:
23//!
24//! * `[operation]` can be `closest_points`, `distance`, `contact`, `intersection_test` or `time_of_impact`.
25//! * `[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`.
26//! * `[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`.
27
28pub use self::closest_points::{closest_points, ClosestPoints};
29pub use self::contact::{contact, Contact};
30#[cfg(feature = "alloc")]
31pub use self::contact_manifolds::{
32    ContactManifold, ContactManifoldsWorkspace, TrackedContact, TypedWorkspaceData, WorkspaceData,
33};
34pub use self::default_query_dispatcher::DefaultQueryDispatcher;
35pub use self::distance::distance;
36pub use self::error::Unsupported;
37pub use self::intersection_test::intersection_test;
38pub use self::nonlinear_shape_cast::{cast_shapes_nonlinear, NonlinearRigidMotion};
39pub use self::point::{PointProjection, PointQuery, PointQueryWithLocation};
40#[cfg(feature = "alloc")]
41pub use self::query_dispatcher::PersistentQueryDispatcher;
42pub use self::query_dispatcher::{QueryDispatcher, QueryDispatcherChain};
43pub use self::ray::{Ray, RayCast, RayIntersection, SimdRay};
44pub use self::shape_cast::{cast_shapes, ShapeCastHit, ShapeCastOptions, ShapeCastStatus};
45pub use self::split::{IntersectResult, SplitResult};
46pub use self::sweep_toi::{
47    sweep_time_of_impact, SimplexCache, Sweep, SweepToiOutput, SweepToiStatus, ToiProxy,
48};
49#[cfg(feature = "alloc")]
50pub use self::sweep_toi::{sweep_time_of_impact_composite, SweepCompositeFastShape};
51
52#[cfg(all(feature = "dim3", feature = "alloc"))]
53pub use self::ray::RayCullingMode;
54
55mod clip;
56pub mod closest_points;
57pub mod contact;
58#[cfg(feature = "alloc")]
59mod contact_manifolds;
60mod default_query_dispatcher;
61mod distance;
62#[cfg(feature = "alloc")]
63pub mod epa;
64mod error;
65pub mod gjk;
66mod intersection_test;
67mod nonlinear_shape_cast;
68pub mod point;
69mod query_dispatcher;
70mod ray;
71pub mod sat;
72mod shape_cast;
73mod split;
74pub mod sweep_toi;
75
76/// Queries dedicated to specific pairs of shapes.
77pub mod details {
78    pub use super::clip::*;
79    pub use super::closest_points::*;
80    pub use super::contact::*;
81    #[cfg(feature = "alloc")]
82    pub use super::contact_manifolds::*;
83    pub use super::distance::*;
84    pub use super::intersection_test::*;
85    pub use super::nonlinear_shape_cast::*;
86    pub use super::point::*;
87    pub use super::ray::*;
88    pub use super::shape_cast::*;
89}