Struct collision::algorithm::minkowski::GJK
[−]
[src]
pub struct GJK<SP, E> { /* fields omitted */ }
Gilbert-Johnson-Keerthi narrow phase collision detection algorithm.
Type parameters:
S
: simplex processor type. Should be eitherSimplexProcessor2
orSimplexProcessor3
E
: EPA algorithm implementation type. Should be eitherEPA2
orEPA3
Methods
impl<SP, E> GJK<SP, E> where
SP: SimplexProcessor,
<SP::Point as EuclideanSpace>::Scalar: BaseFloat,
E: EPA<Point = SP::Point>,
[src]
SP: SimplexProcessor,
<SP::Point as EuclideanSpace>::Scalar: BaseFloat,
E: EPA<Point = SP::Point>,
fn new() -> Self
[src]
Create a new GJK algorithm implementation
fn intersect<P, PL, PR, TL, TR>(
&self,
left: &PL,
left_transform: &TL,
right: &PR,
right_transform: &TR
) -> Option<Vec<SupportPoint<P>>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
SP: SimplexProcessor<Point = P>,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
TL: Transform<P>,
TR: Transform<P>,
[src]
&self,
left: &PL,
left_transform: &TL,
right: &PR,
right_transform: &TR
) -> Option<Vec<SupportPoint<P>>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
SP: SimplexProcessor<Point = P>,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
TL: Transform<P>,
TR: Transform<P>,
Do intersection test on the given primitives
Parameters:
left
: left primitiveleft_transform
: model-to-world-transform for the left primitiveright
: right primitive,right_transform
: model-to-world-transform for the right primitive
Returns:
Will return a simplex if a collision was detected. For 2D, the simplex will be a triangle, for 3D, it will be a tetrahedron. The simplex will enclose the origin. If no collision was detected, None is returned.
fn intersection_time_of_impact<P, PL, PR, TL, TR>(
&self,
left: &PL,
left_transform: Range<&TL>,
right: &PR,
right_transform: Range<&TR>
) -> Option<Contact<P>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
SP: SimplexProcessor<Point = P>,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
TL: Transform<P> + TranslationInterpolate<P::Scalar>,
TR: Transform<P> + TranslationInterpolate<P::Scalar>,
[src]
&self,
left: &PL,
left_transform: Range<&TL>,
right: &PR,
right_transform: Range<&TR>
) -> Option<Contact<P>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
SP: SimplexProcessor<Point = P>,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
TL: Transform<P> + TranslationInterpolate<P::Scalar>,
TR: Transform<P> + TranslationInterpolate<P::Scalar>,
Do time of impact intersection testing on the given primitives, and return a valid contact at the time of impact.
Parameters:
left
: left primitiveleft_transform
: model-to-world-transform for the left primitiveright
: right primitive,right_transform
: model-to-world-transform for the right primitive
Returns:
Will optionally return a contact manifold at the time of impact. If no collision was detected, None is returned.
fn distance<P, PL, PR, TL, TR>(
&self,
left: &PL,
left_transform: &TL,
right: &PR,
right_transform: &TR
) -> Option<P::Scalar> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
SP: SimplexProcessor<Point = P>,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
TL: Transform<P>,
TR: Transform<P>,
[src]
&self,
left: &PL,
left_transform: &TL,
right: &PR,
right_transform: &TR
) -> Option<P::Scalar> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
SP: SimplexProcessor<Point = P>,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
TL: Transform<P>,
TR: Transform<P>,
Compute the distance between the given primitives.
Parameters:
left
: left primitiveleft_transform
: model-to-world-transform for the left primitiveright
: right primitive,right_transform
: model-to-world-transform for the right primitive
Returns:
Will optionally return the distance between the objects. Will return None, if the objects are colliding.
fn get_contact_manifold<P, PL, PR, TL, TR>(
&self,
simplex: &mut Vec<SupportPoint<P>>,
left: &PL,
left_transform: &TL,
right: &PR,
right_transform: &TR
) -> Option<Contact<P>> where
P: EuclideanSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P>,
TR: Transform<P>,
SP: SimplexProcessor<Point = P>,
[src]
&self,
simplex: &mut Vec<SupportPoint<P>>,
left: &PL,
left_transform: &TL,
right: &PR,
right_transform: &TR
) -> Option<Contact<P>> where
P: EuclideanSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P>,
TR: Transform<P>,
SP: SimplexProcessor<Point = P>,
Given a GJK simplex that encloses the origin, compute the contact manifold.
Uses the EPA algorithm to find the contact information from the simplex.
fn intersection<P, PL, PR, TL, TR>(
&self,
strategy: &CollisionStrategy,
left: &PL,
left_transform: &TL,
right: &PR,
right_transform: &TR
) -> Option<Contact<P>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P>,
TR: Transform<P>,
SP: SimplexProcessor<Point = P>,
[src]
&self,
strategy: &CollisionStrategy,
left: &PL,
left_transform: &TL,
right: &PR,
right_transform: &TR
) -> Option<Contact<P>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P>,
TR: Transform<P>,
SP: SimplexProcessor<Point = P>,
Do intersection testing on the given primitives, and return the contact manifold.
Parameters:
strategy
: strategy to use, ifCollisionOnly
it will only return a boolean result, otherwise, EPA will be used to compute the exact contact point.left
: left primitiveleft_transform
: model-to-world-transform for the left primitiveright
: right primitive,right_transform
: model-to-world-transform for the right primitive
Returns:
Will optionally return a Contact
if a collision was detected. In CollisionOnly
mode,
this contact will only be a boolean result. For FullResolution
mode, the contact will
contain a full manifold (collision normal, penetration depth and contact point).
fn intersection_complex<P, PL, PR, TL, TR>(
&self,
strategy: &CollisionStrategy,
left: &[(PL, TL)],
left_transform: &TL,
right: &[(PR, TR)],
right_transform: &TR
) -> Option<Contact<P>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P>,
TR: Transform<P>,
SP: SimplexProcessor<Point = P>,
[src]
&self,
strategy: &CollisionStrategy,
left: &[(PL, TL)],
left_transform: &TL,
right: &[(PR, TR)],
right_transform: &TR
) -> Option<Contact<P>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P>,
TR: Transform<P>,
SP: SimplexProcessor<Point = P>,
Do intersection test on the given complex shapes, and return the actual intersection point
Parameters:
strategy
: strategy to use, ifCollisionOnly
it will only return a boolean result, otherwise, EPA will be used to compute the exact contact point.left
: shape consisting of a slice of primitive + local-to-model-transform for each primitive,left_transform
: model-to-world-transform for the left shaperight
: shape consisting of a slice of primitive + local-to-model-transform for each primitive,right_transform
: model-to-world-transform for the right shape
Returns:
Will optionally return a Contact
if a collision was detected. In CollisionOnly
mode,
this contact will only be a boolean result. For FullResolution
mode, the contact will
contain a full manifold (collision normal, penetration depth and contact point), for the
contact with the highest penetration depth.
fn distance_complex<P, PL, PR, TL, TR>(
&self,
left: &[(PL, TL)],
left_transform: &TL,
right: &[(PR, TR)],
right_transform: &TR
) -> Option<P::Scalar> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P>,
TR: Transform<P>,
SP: SimplexProcessor<Point = P>,
[src]
&self,
left: &[(PL, TL)],
left_transform: &TL,
right: &[(PR, TR)],
right_transform: &TR
) -> Option<P::Scalar> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P>,
TR: Transform<P>,
SP: SimplexProcessor<Point = P>,
Compute the distance between the given shapes.
Parameters:
left
: left shapeleft_transform
: model-to-world-transform for the left shaperight
: right shape,right_transform
: model-to-world-transform for the right shape
Returns:
Will optionally return the smallest distance between the objects. Will return None, if the objects are colliding.
fn intersection_complex_time_of_impact<P, PL, PR, TL, TR>(
&self,
strategy: &CollisionStrategy,
left: &[(PL, TL)],
left_transform: Range<&TL>,
right: &[(PR, TR)],
right_transform: Range<&TR>
) -> Option<Contact<P>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P> + TranslationInterpolate<P::Scalar>,
TR: Transform<P> + TranslationInterpolate<P::Scalar>,
SP: SimplexProcessor<Point = P>,
[src]
&self,
strategy: &CollisionStrategy,
left: &[(PL, TL)],
left_transform: Range<&TL>,
right: &[(PR, TR)],
right_transform: Range<&TR>
) -> Option<Contact<P>> where
P: EuclideanSpace,
P::Scalar: BaseFloat,
P::Diff: Neg<Output = P::Diff> + InnerSpace,
PL: SupportFunction<Point = P>,
PR: SupportFunction<Point = P>,
TL: Transform<P> + TranslationInterpolate<P::Scalar>,
TR: Transform<P> + TranslationInterpolate<P::Scalar>,
SP: SimplexProcessor<Point = P>,
Do intersection time of impact test on the given complex shapes, and return the contact at the time of impact
Parameters:
strategy
: strategy to use, ifCollisionOnly
it will only return a boolean result, otherwise, a full contact manifold will be returned.left
: shape consisting of a slice of primitive + local-to-model-transform for each primitive,left_transform
: model-to-world-transform for the left shaperight
: shape consisting of a slice of primitive + local-to-model-transform for each primitive,right_transform
: model-to-world-transform for the right shape
Returns:
Will optionally return the contact if a collision was detected.
In CollisionOnly
mode, this contact will only be a time of impact. For FullResolution
mode, the time of impact will be the earliest found among all shape primitives.
Will return None if no collision was found.