pub struct ConvexPolygonalFeature<N: RealField + Copy> {
pub vertices: Vec<Point<N>>,
pub edge_normals: Vec<Vector<N>>,
pub normal: Option<Unit<Vector<N>>>,
pub feature_id: FeatureId,
pub vertices_id: Vec<FeatureId>,
pub edges_id: Vec<FeatureId>,
}
Expand description
Represents a convex polygonal approximation of a face of a solid.
It is never checked if the vertices actually form a convex polygon. If they do not, results of any geometric query may end up being invalid.
Fields§
§vertices: Vec<Point<N>>
The vertices of this face.
edge_normals: Vec<Vector<N>>
The outward normal of the edges if it is a face.
normal: Option<Unit<Vector<N>>>
The normal of this feature if it is a face.
feature_id: FeatureId
The shape-dependent identifier of this feature.
vertices_id: Vec<FeatureId>
The shape-dependent indentifier of each vertex of this feature.
edges_id: Vec<FeatureId>
The shape-dependent indentifier of each edge of this feature.
Implementations§
Source§impl<N: RealField + Copy> ConvexPolygonalFeature<N>
impl<N: RealField + Copy> ConvexPolygonalFeature<N>
Sourcepub fn with_size(n: usize) -> Self
pub fn with_size(n: usize) -> Self
Creates a new convex polygonal feature with all field initialized with n
zero elements.
Sourcepub fn transform_by(&mut self, m: &Isometry<N>)
pub fn transform_by(&mut self, m: &Isometry<N>)
Transforms all the vertices and normals of this feature by the given isometry.
Sourcepub fn push(&mut self, pt: Point<N>, id: FeatureId)
pub fn push(&mut self, pt: Point<N>, id: FeatureId)
Adds a vertex to this face.
It is not checked whether pt
breaks the convexity of the polyhedral face.
Sourcepub fn edge(&self, edge_id: FeatureId) -> Option<Segment<N>>
pub fn edge(&self, edge_id: FeatureId) -> Option<Segment<N>>
Retrieves the edge with the given feature id.
Sourcepub fn push_scaled_edge_normal(&mut self, normal: Vector<N>)
pub fn push_scaled_edge_normal(&mut self, normal: Vector<N>)
Adds a scaled edge normal to this face.
Sourcepub fn push_edge_normal(&mut self, normal: Unit<Vector<N>>)
pub fn push_edge_normal(&mut self, normal: Unit<Vector<N>>)
Adds an edge normal to this face.
Sourcepub fn recompute_edge_normals(&mut self)
pub fn recompute_edge_normals(&mut self)
Automatically recomputes the scaled edge normals (3D only).
Panics if the ambient space is not 3D.
Sourcepub fn project_point(&self, pt: &Point<N>) -> Option<Contact<N>>
pub fn project_point(&self, pt: &Point<N>) -> Option<Contact<N>>
Transforms all the vertices of this feature by the given isometry.
Sourcepub fn set_normal(&mut self, normal: Unit<Vector<N>>)
pub fn set_normal(&mut self, normal: Unit<Vector<N>>)
Sets the outward normal of this convex polygonal face.
Sourcepub fn push_edge_feature_id(&mut self, id: FeatureId)
pub fn push_edge_feature_id(&mut self, id: FeatureId)
Add the shape-dependent identifier of a edge of this feature (if it is a face).
Sourcepub fn set_feature_id(&mut self, id: FeatureId)
pub fn set_feature_id(&mut self, id: FeatureId)
Add the shape-dependent identifier of this feature.
Sourcepub fn clip(
&self,
other: &Self,
normal: &Unit<Vector<N>>,
prediction: &ContactPrediction<N>,
cache: &mut ClippingCache<N>,
out: &mut Vec<(Contact<N>, FeatureId, FeatureId)>,
)
pub fn clip( &self, other: &Self, normal: &Unit<Vector<N>>, prediction: &ContactPrediction<N>, cache: &mut ClippingCache<N>, out: &mut Vec<(Contact<N>, FeatureId, FeatureId)>, )
Generate contacts between self
and other
using polygonal clipping, iif. they both have at least
three vertices.
If either self
or other
has less than three vertices, this does nothing.
Sourcepub fn add_contact_to_manifold(
&self,
other: &Self,
c: Contact<N>,
m1: &Isometry<N>,
f1: FeatureId,
proc1: Option<&dyn ContactPreprocessor<N>>,
m2: &Isometry<N>,
f2: FeatureId,
proc2: Option<&dyn ContactPreprocessor<N>>,
manifold: &mut ContactManifold<N>,
)
pub fn add_contact_to_manifold( &self, other: &Self, c: Contact<N>, m1: &Isometry<N>, f1: FeatureId, proc1: Option<&dyn ContactPreprocessor<N>>, m2: &Isometry<N>, 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§
Auto 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> 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<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.