pub struct ConvexPolygonalFeature<N>{
pub vertices: [OPoint<N, Const<2>>; 2],
pub nvertices: usize,
pub normal: Option<Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>>,
pub feature_id: FeatureId,
pub vertices_id: [FeatureId; 2],
}Expand description
A feature (face or vertex) of a 2D convex polygon.
Fields§
§vertices: [OPoint<N, Const<2>>; 2]The vertices of this face.
nvertices: usizeNumber of vertices in vertices to be considered.
normal: Option<Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>>The normal of this feature if it is an edge.
feature_id: FeatureIdThe shape-dependent identifier of this feature.
vertices_id: [FeatureId; 2]The shape-dependent indentifier of each vertex of this feature.
Implementations§
Source§impl<N> ConvexPolygonalFeature<N>
impl<N> ConvexPolygonalFeature<N>
Sourcepub fn new() -> ConvexPolygonalFeature<N>
pub fn new() -> ConvexPolygonalFeature<N>
Creates a new empty convex polygonal faces.
Sourcepub fn transform_by(&mut self, m: &Isometry<N, Unit<Complex<N>>, 2>)
pub fn transform_by(&mut self, m: &Isometry<N, Unit<Complex<N>>, 2>)
Transforms all the vertices and normal of this feature by the given isometry.
Sourcepub fn push(&mut self, pt: OPoint<N, Const<2>>, id: FeatureId)
pub fn push(&mut self, pt: OPoint<N, Const<2>>, id: FeatureId)
Adds a vertex to this face.
It is not checked whether pt breaks the convexity of the polyhedral face.
Sourcepub fn set_normal(
&mut self,
normal: Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>,
)
pub fn set_normal( &mut self, normal: Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>, )
Sets the outward normal of this convex polygonal face.
Sourcepub fn set_feature_id(&mut self, id: FeatureId)
pub fn set_feature_id(&mut self, id: FeatureId)
Sets the identifier of the feature represented by this convex polygon.
Sourcepub fn project_point(&self, pt: &OPoint<N, Const<2>>) -> Option<Contact<N>>
pub fn project_point(&self, pt: &OPoint<N, Const<2>>) -> Option<Contact<N>>
Projects a point on this feature.
Sourcepub fn clip(
&self,
other: &ConvexPolygonalFeature<N>,
normal: &Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>,
prediction: &ContactPrediction<N>,
out: &mut Vec<(Contact<N>, FeatureId, FeatureId)>,
)
pub fn clip( &self, other: &ConvexPolygonalFeature<N>, normal: &Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>>, prediction: &ContactPrediction<N>, out: &mut Vec<(Contact<N>, FeatureId, FeatureId)>, )
Generate contacts between self and other using polygonal clipping, iif. they both have at least
two vertices.
If either self or other has less than two vertices, this does nothing.
Sourcepub fn add_contact_to_manifold(
&self,
other: &ConvexPolygonalFeature<N>,
c: Contact<N>,
m1: &Isometry<N, Unit<Complex<N>>, 2>,
f1: FeatureId,
proc1: Option<&dyn ContactPreprocessor<N>>,
m2: &Isometry<N, Unit<Complex<N>>, 2>,
f2: FeatureId,
proc2: Option<&dyn ContactPreprocessor<N>>,
manifold: &mut ContactManifold<N>,
)
pub fn add_contact_to_manifold( &self, other: &ConvexPolygonalFeature<N>, c: Contact<N>, m1: &Isometry<N, Unit<Complex<N>>, 2>, f1: FeatureId, proc1: Option<&dyn ContactPreprocessor<N>>, m2: &Isometry<N, Unit<Complex<N>>, 2>, f2: FeatureId, proc2: Option<&dyn ContactPreprocessor<N>>, manifold: &mut ContactManifold<N>, )
Given a contact between two polygonal features, adds it to a contact manifold.
Trait Implementations§
Source§impl<N> Clone for ConvexPolygonalFeature<N>
impl<N> Clone for ConvexPolygonalFeature<N>
Source§fn clone(&self) -> ConvexPolygonalFeature<N>
fn clone(&self) -> ConvexPolygonalFeature<N>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<N> Freeze for ConvexPolygonalFeature<N>where
N: Freeze,
impl<N> RefUnwindSafe for ConvexPolygonalFeature<N>where
N: RefUnwindSafe,
impl<N> Send for ConvexPolygonalFeature<N>
impl<N> Sync for ConvexPolygonalFeature<N>
impl<N> Unpin for ConvexPolygonalFeature<N>where
N: Unpin,
impl<N> UnsafeUnpin for ConvexPolygonalFeature<N>where
N: UnsafeUnpin,
impl<N> UnwindSafe for ConvexPolygonalFeature<N>where
N: UnwindSafe,
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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> 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.