Trait parry3d::query::details::NormalConstraints
source · pub trait NormalConstraints: 'static {
// Required method
fn project_local_normal_mut(&self, normal: &mut Vector<Real>) -> bool;
// Provided methods
fn project_local_normal(&self, normal: Vector<Real>) -> Option<Vector<Real>> { ... }
fn project_local_normal1(
&self,
pos12: &Isometry<Real>,
normal1: &mut Vector<Real>,
normal2: &mut Vector<Real>
) -> bool { ... }
fn project_local_normal2(
&self,
pos12: &Isometry<Real>,
normal1: &mut Vector<Real>,
normal2: &mut Vector<Real>
) -> bool { ... }
}
Expand description
Constraints of contact normals, generally for internal edges resolution.
This trait used for applying constraints on normal direction for contact manifolds calculation. Non-convex shapes will generally simplify collision-detection as a collection of simpler convex-based collision-detection problems. However, that partial convex formulation allows some contact normals that are theoretically impossible (in a convex analysis sense). The normal constraints aims to correct/remove invalid normals, avoiding some artifacts in physics simulations. In particular, this addresses the well-known “internal edges” problem on triangle meshes and heightfields.
Required Methods§
sourcefn project_local_normal_mut(&self, normal: &mut Vector<Real>) -> bool
fn project_local_normal_mut(&self, normal: &mut Vector<Real>) -> bool
Corrects in-place or discards the specified normal (assumed to be unit-sized) based on the
constraints encoded by Self
.
If this method returns false
then the contacts associated to that normal should be
considered invalid and be ignored by the collision-detection pipeline.
Provided Methods§
sourcefn project_local_normal(&self, normal: Vector<Real>) -> Option<Vector<Real>>
fn project_local_normal(&self, normal: Vector<Real>) -> Option<Vector<Real>>
Corrects or discards the specified normal (assumed to be unit-sized) based on the constraints
encoded by Self
.
If this method returns None
then the contacts associated to that normal should be
considered invalid and be ignored by the collision-detection pipeline.
sourcefn project_local_normal1(
&self,
pos12: &Isometry<Real>,
normal1: &mut Vector<Real>,
normal2: &mut Vector<Real>
) -> bool
fn project_local_normal1( &self, pos12: &Isometry<Real>, normal1: &mut Vector<Real>, normal2: &mut Vector<Real> ) -> bool
Applies normal correction to the unit vectors normal1
and normal2
based on the
assumption that normal1
is in the same coordinates space as Self
.
The normal2
will be modified to be equal to -normal1
expressed in the local coordinate
space of the second shape.
If this method returns false
then the contacts associated to that normal should be
considered invalid and be ignored by the collision-detection pipeline.
sourcefn project_local_normal2(
&self,
pos12: &Isometry<Real>,
normal1: &mut Vector<Real>,
normal2: &mut Vector<Real>
) -> bool
fn project_local_normal2( &self, pos12: &Isometry<Real>, normal1: &mut Vector<Real>, normal2: &mut Vector<Real> ) -> bool
Applies normal correction to the unit vectors normal1
and normal2
based on the
assumption that normal2
is in the same coordinates space as Self
.
The normal1
will be modified to be equal to -normal2
expressed in the local coordinate
space of the first shape.
If this method returns false
then the contacts associated to that normal should be
considered invalid and be ignored by the collision-detection pipeline.