pub trait Shape<N>: Send + Sync + Downcast + ShapeClone<N>where
    N: RealField + Copy,{
Show 17 methods // Required methods fn aabb(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>; fn tangent_cone_contains_dir( &self, _feature: FeatureId, _m: &Isometry<N, Unit<Complex<N>>, 2>, _deformations: Option<&[N]>, _dir: &Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>> ) -> bool; // Provided methods fn local_aabb(&self) -> AABB<N> { ... } fn bounding_sphere( &self, m: &Isometry<N, Unit<Complex<N>>, 2> ) -> BoundingSphere<N> { ... } fn local_bounding_sphere(&self) -> BoundingSphere<N> { ... } fn subshape_containing_feature(&self, _i: FeatureId) -> usize { ... } fn as_ray_cast(&self) -> Option<&dyn RayCast<N>> { ... } fn as_point_query(&self) -> Option<&dyn PointQuery<N>> { ... } fn as_convex_polyhedron(&self) -> Option<&dyn ConvexPolyhedron<N>> { ... } fn as_support_map(&self) -> Option<&dyn SupportMap<N>> { ... } fn as_composite_shape(&self) -> Option<&dyn CompositeShape<N>> { ... } fn as_deformable_shape(&self) -> Option<&dyn DeformableShape<N>> { ... } fn as_deformable_shape_mut(&mut self) -> Option<&mut dyn DeformableShape<N>> { ... } fn is_convex_polyhedron(&self) -> bool { ... } fn is_support_map(&self) -> bool { ... } fn is_composite_shape(&self) -> bool { ... } fn is_deformable_shape(&self) -> bool { ... }
}
Expand description

Trait implemented by all shapes supported by ncollide.

This allows dynamic inspection of the shape capabilities.

Required Methods§

source

fn aabb(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The AABB of self transformed by m.

source

fn tangent_cone_contains_dir( &self, _feature: FeatureId, _m: &Isometry<N, Unit<Complex<N>>, 2>, _deformations: Option<&[N]>, _dir: &Unit<Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>> ) -> bool

Check if if the feature _feature of the i-th subshape of self transformed by m has a tangent cone that contains dir at the point pt.

Provided Methods§

source

fn local_aabb(&self) -> AABB<N>

The AABB of self.

source

fn bounding_sphere( &self, m: &Isometry<N, Unit<Complex<N>>, 2> ) -> BoundingSphere<N>

The bounding sphere of self transformed by m.

source

fn local_bounding_sphere(&self) -> BoundingSphere<N>

The bounding sphere of self.

source

fn subshape_containing_feature(&self, _i: FeatureId) -> usize

Returns the id of the subshape containing the specified feature.

If several subshape contains the same feature, any one is returned.

source

fn as_ray_cast(&self) -> Option<&dyn RayCast<N>>

The RayCast implementation of self.

source

fn as_point_query(&self) -> Option<&dyn PointQuery<N>>

The PointQuery implementation of self.

source

fn as_convex_polyhedron(&self) -> Option<&dyn ConvexPolyhedron<N>>

The convex polyhedron representation of self if applicable.

source

fn as_support_map(&self) -> Option<&dyn SupportMap<N>>

The support mapping of self if applicable.

source

fn as_composite_shape(&self) -> Option<&dyn CompositeShape<N>>

The composite shape representation of self if applicable.

source

fn as_deformable_shape(&self) -> Option<&dyn DeformableShape<N>>

The deformable shape representation of self if applicable.

source

fn as_deformable_shape_mut(&mut self) -> Option<&mut dyn DeformableShape<N>>

The mutable deformable shape representation of self if applicable.

source

fn is_convex_polyhedron(&self) -> bool

Whether self uses a convex polyhedron representation.

source

fn is_support_map(&self) -> bool

Whether self uses a support-mapping based representation.

source

fn is_composite_shape(&self) -> bool

Whether self uses a composite shape-based representation.

source

fn is_deformable_shape(&self) -> bool

Whether self uses a composite shape-based representation.

Implementations§

source§

impl<N> dyn Shape<N>where N: Any + 'static + RealField + Copy,

source

pub fn is<__T>(&self) -> boolwhere __T: Shape<N>,

Returns true if the trait object wraps an object of type __T.

source

pub fn downcast<__T>( self: Box<dyn Shape<N>, Global> ) -> Result<Box<__T, Global>, Box<dyn Shape<N>, Global>>where __T: Shape<N>,

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

source

pub fn downcast_rc<__T>( self: Rc<dyn Shape<N>, Global> ) -> Result<Rc<__T, Global>, Rc<dyn Shape<N>, Global>>where __T: Shape<N>,

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

source

pub fn downcast_ref<__T>(&self) -> Option<&__T>where __T: Shape<N>,

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

source

pub fn downcast_mut<__T>(&mut self) -> Option<&mut __T>where __T: Shape<N>,

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

source§

impl<N> dyn Shape<N>where N: RealField + Copy,

Trait for casting shapes to its exact represetation.

source

pub fn is_shape<T>(&self) -> boolwhere T: Shape<N>,

Tests if this shape has a specific type T.

source

pub fn as_shape<T>(&self) -> Option<&T>where T: Shape<N>,

Performs the cast.

Trait Implementations§

source§

impl<N> AsRef<dyn Shape<N>> for ShapeHandle<N>where N: RealField + Copy,

source§

fn as_ref(&self) -> &(dyn Shape<N> + 'static)

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for dyn Shape<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, BoundingSphere<N>> for dyn Shape<N>where N: RealField + Copy,

source§

fn bounding_volume( &self, m: &Isometry<N, Unit<Complex<N>>, 2> ) -> BoundingSphere<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> BoundingSphere<N>

The bounding volume of self.
source§

impl<N> PointQuery<N> for dyn Shape<N>where N: RealField + Copy,

source§

fn project_point( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>>, solid: bool ) -> PointProjection<N>

Projects a point on self transformed by m.
source§

fn project_point_with_feature( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>> ) -> (PointProjection<N>, FeatureId)

Projects a point on the boundary of self transformed by m and retuns the id of the feature the point was projected on.
source§

fn distance_to_point( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>>, solid: bool ) -> N

Computes the minimal distance between a point and self transformed by m.
source§

fn contains_point( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>> ) -> bool

Tests if the given point is inside of self transformed by m.
source§

impl<N> RayCast<N> for dyn Shape<N>where N: RealField + Copy,

source§

fn toi_with_ray( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, ray: &Ray<N>, max_toi: N, solid: bool ) -> Option<N>

Computes the time of impact between this transform shape and a ray.
source§

fn toi_and_normal_with_ray( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, ray: &Ray<N>, max_toi: N, solid: bool ) -> Option<RayIntersection<N>>

Computes the time of impact, and normal between this transformed shape and a ray.
source§

fn intersects_ray( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, ray: &Ray<N>, max_toi: N ) -> bool

Tests whether a ray intersects this transformed shape.
source§

impl<N> Volumetric<N> for dyn Shape<N>where N: RealField + Copy,

source§

fn area(&self) -> N

Computes the area of this object.
source§

fn volume(&self) -> N

Computes the volume of this object.
source§

fn center_of_mass(&self) -> OPoint<N, Const<2>>

Computes the center of mass of this object.
source§

fn unit_angular_inertia( &self ) -> Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>

Computes the angular inertia tensor of this object.
source§

fn mass_properties( &self, density: N ) -> (N, OPoint<N, Const<2>>, Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>)

Given its density, this computes the mass, center of mass, and inertia tensor of this object.
source§

fn mass(&self, density: N) -> N

Given its density, this computes the mass of this object.
source§

fn angular_inertia( &self, mass: N ) -> Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>

Given its mass, this computes the angular inertia of this object.
source§

fn transformed_mass_properties( &self, density: N, pos: &Isometry<N, Unit<Complex<N>>, 2> ) -> (OPoint<N, Const<2>>, Inertia2<N>)

Given its density and position, this computes the mass, transformed center of mass, and transformed inertia tensor of this object.
source§

fn inertia(&self, density: N) -> Inertia2<N>

Implementors§

source§

impl<N> Shape<N> for Ball<N>where N: RealField + Copy,

source§

impl<N> Shape<N> for Capsule<N>where N: RealField + Copy,

source§

impl<N> Shape<N> for Compound<N>where N: RealField + Copy,

source§

impl<N> Shape<N> for ConvexPolygon<N>where N: RealField + Copy,

source§

impl<N> Shape<N> for Cuboid<N>where N: RealField + Copy,

source§

impl<N> Shape<N> for HeightField<N>where N: RealField + Copy,

source§

impl<N> Shape<N> for Plane<N>where N: RealField + Copy,

source§

impl<N> Shape<N> for Polyline<N>where N: RealField + Copy,

source§

impl<N> Shape<N> for Segment<N>where N: RealField + Copy,