ncollide3d::shape

Trait Shape

Source
pub trait Shape<N: RealField + Copy>:
    Send
    + Sync
    + Downcast
    + ShapeClone<N> {
Show 17 methods // Required methods fn aabb(&self, m: &Isometry<N>) -> AABB<N>; fn tangent_cone_contains_dir( &self, _feature: FeatureId, _m: &Isometry<N>, _deformations: Option<&[N]>, _dir: &Unit<Vector<N>>, ) -> bool; // Provided methods fn local_aabb(&self) -> AABB<N> { ... } fn bounding_sphere(&self, m: &Isometry<N>) -> 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>) -> AABB<N>

The AABB of self transformed by m.

Source

fn tangent_cone_contains_dir( &self, _feature: FeatureId, _m: &Isometry<N>, _deformations: Option<&[N]>, _dir: &Unit<Vector<N>>, ) -> 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>) -> 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: Shape<N>>(&self) -> bool

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

Source

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

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: Shape<N>>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>

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: Shape<N>>(&self) -> Option<&__T>

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: Shape<N>>(&mut self) -> Option<&mut __T>

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: RealField + Copy> dyn Shape<N>

Trait for casting shapes to its exact represetation.

Source

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

Tests if this shape has a specific type T.

Source

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

Performs the cast.

Trait Implementations§

Source§

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

Source§

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

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

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

Source§

fn bounding_volume(&self, m: &Isometry<N>) -> 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: RealField + Copy> HasBoundingVolume<N, BoundingSphere<N>> for dyn Shape<N>

Source§

fn bounding_volume(&self, m: &Isometry<N>) -> 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: RealField + Copy> PointQuery<N> for dyn Shape<N>

Source§

fn project_point( &self, m: &Isometry<N>, pt: &Point<N>, solid: bool, ) -> PointProjection<N>

Projects a point on self transformed by m.
Source§

fn project_point_with_feature( &self, m: &Isometry<N>, pt: &Point<N>, ) -> (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>, pt: &Point<N>, solid: bool) -> N

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

fn contains_point(&self, m: &Isometry<N>, pt: &Point<N>) -> bool

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

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

Source§

fn toi_with_ray( &self, m: &Isometry<N>, 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>, 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 toi_and_normal_and_uv_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<RayIntersection<N>>

Computes time of impact, normal, and texture coordinates (uv) between this transformed shape and a ray.
Source§

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

Tests whether a ray intersects this transformed shape.

Implementors§

Source§

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

Source§

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

Source§

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

Source§

impl<N: RealField + Copy> Shape<N> for ConvexHull<N>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<N: RealField + Copy> Shape<N> for TriMesh<N>

Source§

impl<N: RealField + Copy> Shape<N> for Triangle<N>