Trait oxygengine_physics_2d::prelude::Shape [−][src]
pub trait Shape<N>: Send + Sync + Downcast + ShapeClone<N> where
N: RealField + Copy, {
Show 17 methods
fn aabb(&self, m: &Isometry<N, Unit<Complex<N>>, 2_usize>) -> AABB<N>;
fn tangent_cone_contains_dir(
&self,
_feature: FeatureId,
_m: &Isometry<N, Unit<Complex<N>>, 2_usize>,
_deformations: Option<&[N]>,
_dir: &Unit<Matrix<N, Const<{_: usize}>, Const<1_usize>, ArrayStorage<N, 2_usize, 1_usize>>>
) -> bool;
fn local_aabb(&self) -> AABB<N> { ... }
fn bounding_sphere(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2_usize>
) -> 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
The AABB of self
transformed by m
.
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
fn local_aabb(&self) -> AABB<N>
fn local_aabb(&self) -> AABB<N>
The AABB of self
.
fn bounding_sphere(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2_usize>
) -> BoundingSphere<N>
fn bounding_sphere(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2_usize>
) -> BoundingSphere<N>
The bounding sphere of self
transformed by m
.
fn local_bounding_sphere(&self) -> BoundingSphere<N>
fn local_bounding_sphere(&self) -> BoundingSphere<N>
The bounding sphere of self
.
fn subshape_containing_feature(&self, _i: FeatureId) -> usize
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.
fn as_ray_cast(&self) -> Option<&dyn RayCast<N>>
fn as_ray_cast(&self) -> Option<&dyn RayCast<N>>
The RayCast
implementation of self
.
fn as_point_query(&self) -> Option<&dyn PointQuery<N>>
fn as_point_query(&self) -> Option<&dyn PointQuery<N>>
The PointQuery
implementation of self
.
fn as_convex_polyhedron(&self) -> Option<&dyn ConvexPolyhedron<N>>
fn as_convex_polyhedron(&self) -> Option<&dyn ConvexPolyhedron<N>>
The convex polyhedron representation of self
if applicable.
fn as_support_map(&self) -> Option<&dyn SupportMap<N>>
fn as_support_map(&self) -> Option<&dyn SupportMap<N>>
The support mapping of self
if applicable.
fn as_composite_shape(&self) -> Option<&dyn CompositeShape<N>>
fn as_composite_shape(&self) -> Option<&dyn CompositeShape<N>>
The composite shape representation of self
if applicable.
fn as_deformable_shape(&self) -> Option<&dyn DeformableShape<N>>
fn as_deformable_shape(&self) -> Option<&dyn DeformableShape<N>>
The deformable shape representation of self
if applicable.
fn as_deformable_shape_mut(&mut self) -> Option<&mut dyn DeformableShape<N>>
fn as_deformable_shape_mut(&mut self) -> Option<&mut dyn DeformableShape<N>>
The mutable deformable shape representation of self
if applicable.
fn is_convex_polyhedron(&self) -> bool
fn is_convex_polyhedron(&self) -> bool
Whether self
uses a convex polyhedron representation.
fn is_support_map(&self) -> bool
fn is_support_map(&self) -> bool
Whether self
uses a support-mapping based representation.
fn is_composite_shape(&self) -> bool
fn is_composite_shape(&self) -> bool
Whether self
uses a composite shape-based representation.
fn is_deformable_shape(&self) -> bool
fn is_deformable_shape(&self) -> bool
Whether self
uses a composite shape-based representation.
Implementations
Trait for casting shapes to its exact represetation.
Returns true if the trait object wraps an object of type __T
.
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.
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.
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn’t.
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn’t.
Trait Implementations
The bounding volume of self
transformed by m
.
The bounding volume of self
.
impl<N> HasBoundingVolume<N, BoundingSphere<N>> for dyn Shape<N> + 'static where
N: RealField + Copy,
impl<N> HasBoundingVolume<N, BoundingSphere<N>> for dyn Shape<N> + 'static where
N: RealField + Copy,
pub fn bounding_volume(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2_usize>
) -> BoundingSphere<N>
pub fn bounding_volume(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2_usize>
) -> BoundingSphere<N>
The bounding volume of self
transformed by m
.
The bounding volume of self
.
pub fn project_point(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2_usize>,
pt: &OPoint<N, Const<2_usize>>,
solid: bool
) -> PointProjection<N>
pub fn project_point(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2_usize>,
pt: &OPoint<N, Const<2_usize>>,
solid: bool
) -> PointProjection<N>
Projects a point on self
transformed by m
.
Projects a point on the boundary of self
transformed by m
and retuns the id of the
feature the point was projected on. Read more
Computes the minimal distance between a point and self
transformed by m
.
Computes the time of impact between this transform shape and a ray.
pub fn toi_and_normal_with_ray(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2_usize>,
ray: &Ray<N>,
max_toi: N,
solid: bool
) -> Option<RayIntersection<N>>
pub fn toi_and_normal_with_ray(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2_usize>,
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.
Computes the center of mass of this object.
pub fn unit_angular_inertia(
&self
) -> Matrix<N, Const<1_usize>, Const<1_usize>, ArrayStorage<N, 1_usize, 1_usize>>
pub fn unit_angular_inertia(
&self
) -> Matrix<N, Const<1_usize>, Const<1_usize>, ArrayStorage<N, 1_usize, 1_usize>>
Computes the angular inertia tensor of this object.
pub fn mass_properties(
&self,
density: N
) -> (N, OPoint<N, Const<2_usize>>, Matrix<N, Const<1_usize>, Const<1_usize>, ArrayStorage<N, 1_usize, 1_usize>>)
pub fn mass_properties(
&self,
density: N
) -> (N, OPoint<N, Const<2_usize>>, Matrix<N, Const<1_usize>, Const<1_usize>, ArrayStorage<N, 1_usize, 1_usize>>)
Given its density, this computes the mass, center of mass, and inertia tensor of this object.
fn angular_inertia(
&self,
mass: N
) -> Matrix<N, Const<1_usize>, Const<1_usize>, ArrayStorage<N, 1_usize, 1_usize>>
fn angular_inertia(
&self,
mass: N
) -> Matrix<N, Const<1_usize>, Const<1_usize>, ArrayStorage<N, 1_usize, 1_usize>>
Given its mass, this computes the angular inertia of this object.
Given its density and position, this computes the mass, transformed center of mass, and transformed inertia tensor of this object.