pub enum GJKResult {
Intersection,
ClosestPoints(Point<f32>, Point<f32>, Unit<Vector<f32>>),
Proximity(Unit<Vector<f32>>),
NoIntersection(Unit<Vector<f32>>),
}Expand description
Results of the GJK algorithm.
This enum represents the different outcomes when running the GJK algorithm to find the distance between two shapes. The result depends on whether the shapes are intersecting, how far apart they are, and what information was requested.
§Understanding the Results
- Intersection: The shapes are overlapping. The origin lies inside the Minkowski difference.
- ClosestPoints: The exact closest points on both shapes were computed, along with the separation direction.
- Proximity: The shapes are close but not intersecting. Only an approximate separation direction is provided (used when exact distance computation is not needed).
- NoIntersection: The shapes are too far apart (beyond the specified
max_distthreshold).
§Coordinate Spaces
All points and vectors in this result are expressed in the local-space of the first shape
(the shape passed as g1 to the GJK functions). This is important when working with
transformed shapes.
Variants§
Intersection
The shapes are intersecting (overlapping).
This means the origin is inside the Minkowski difference of the two shapes. GJK cannot compute penetration depth; use the EPA (Expanding Polytope Algorithm) for that purpose.
ClosestPoints(Point<f32>, Point<f32>, Unit<Vector<f32>>)
The closest points on both shapes were found.
§Fields
- First
Point: The closest point on the first shape (in local-space of shape 1) - Second
Point: The closest point on the second shape (in local-space of shape 1) Unit<Vector>: The unit direction vector from shape 1 to shape 2 (separation axis)
This variant is returned when exact_dist is true in the GJK algorithm and the
shapes are not intersecting.
Proximity(Unit<Vector<f32>>)
The shapes are in proximity (close but not intersecting).
§Fields
Unit<Vector>: An approximate separation axis (unit direction from shape 1 to shape 2)
This variant is returned when exact_dist is false and the algorithm determines
the shapes are close but not intersecting. It’s faster than computing exact closest
points when you only need to know if shapes are nearby.
NoIntersection(Unit<Vector<f32>>)
The shapes are too far apart.
§Fields
Unit<Vector>: A separation axis (unit direction from shape 1 to shape 2)
This variant is returned when the minimum distance between the shapes exceeds
the max_dist parameter passed to the GJK algorithm.
Trait Implementations§
impl StructuralPartialEq for GJKResult
Auto Trait Implementations§
impl Freeze for GJKResult
impl RefUnwindSafe for GJKResult
impl Send for GJKResult
impl Sync for GJKResult
impl Unpin for GJKResult
impl UnwindSafe for GJKResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.