pub struct HeightField<N: RealField + Copy> { /* private fields */ }
Expand description
An heightfield implicitly discretized with triangles.
Implementations§
Source§impl<N: RealField + Copy> HeightField<N>
impl<N: RealField + Copy> HeightField<N>
Sourcepub fn new(heights: DMatrix<N>, scale: Vector<N>) -> Self
pub fn new(heights: DMatrix<N>, scale: Vector<N>) -> Self
Initializes a new heightfield with the given heights and a scaling factor.
Sourcepub fn cell_at_point(&self, pt: &Point3<N>) -> Option<(usize, usize)>
pub fn cell_at_point(&self, pt: &Point3<N>) -> Option<(usize, usize)>
The pair of index of the cell containing the vertical projection of the given point.
Sourcepub fn x_at(&self, j: usize) -> N
pub fn x_at(&self, j: usize) -> N
The smallest x coordinate of the j
-th column of this heightfield.
Sourcepub fn z_at(&self, i: usize) -> N
pub fn z_at(&self, i: usize) -> N
The smallest z coordinate of the start of the i
-th row of this heightfield.
Sourcepub fn triangles<'a>(&'a self) -> impl Iterator<Item = Triangle<N>> + 'a
pub fn triangles<'a>(&'a self) -> impl Iterator<Item = Triangle<N>> + 'a
An iterator through all the triangles of this heightfield.
Sourcepub fn triangles_at(
&self,
i: usize,
j: usize,
) -> (Option<Triangle<N>>, Option<Triangle<N>>)
pub fn triangles_at( &self, i: usize, j: usize, ) -> (Option<Triangle<N>>, Option<Triangle<N>>)
The two triangles at the cell (i, j) of this heightfield.
Returns None
fore triangles that have been removed because of their user-defined status
flags (described by the HeightFieldCellStatus
bitfield).
Sourcepub fn cell_status(&self, i: usize, j: usize) -> HeightFieldCellStatus
pub fn cell_status(&self, i: usize, j: usize) -> HeightFieldCellStatus
The status of the (i, j)
-th cell.
Sourcepub fn set_cell_status(
&mut self,
i: usize,
j: usize,
status: HeightFieldCellStatus,
)
pub fn set_cell_status( &mut self, i: usize, j: usize, status: HeightFieldCellStatus, )
Set the status of the (i, j)
-th cell.
Sourcepub fn cells_statuses(&self) -> &DMatrix<HeightFieldCellStatus>
pub fn cells_statuses(&self) -> &DMatrix<HeightFieldCellStatus>
The statuses of all the cells of this heightfield.
Sourcepub fn cells_statuses_mut(&mut self) -> &mut DMatrix<HeightFieldCellStatus>
pub fn cells_statuses_mut(&mut self) -> &mut DMatrix<HeightFieldCellStatus>
The mutable statuses of all the cells of this heightfield.
Sourcepub fn cell_width(&self) -> N
pub fn cell_width(&self) -> N
The width (extent along its local x
axis) of each cell of this heightmap, including the scale factor.
Sourcepub fn cell_height(&self) -> N
pub fn cell_height(&self) -> N
The height (extent along its local z
axis) of each cell of this heightmap, including the scale factor.
Sourcepub fn unit_cell_width(&self) -> N
pub fn unit_cell_width(&self) -> N
The width (extent along its local x
axis) of each cell of this heightmap, excluding the scale factor.
Sourcepub fn unit_cell_height(&self) -> N
pub fn unit_cell_height(&self) -> N
The height (extent along its local z
axis) of each cell of this heightmap, excluding the scale factor.
Sourcepub fn convert_triangle_feature_id(
&self,
i: usize,
j: usize,
left: bool,
fid: FeatureId,
) -> FeatureId
pub fn convert_triangle_feature_id( &self, i: usize, j: usize, left: bool, fid: FeatureId, ) -> FeatureId
Converts the FeatureID of the left or right triangle at the cell (i, j)
into a FeatureId
of the whole heightfield.
Sourcepub fn map_elements_in_local_aabb(
&self,
aabb: &AABB<N>,
f: &mut impl FnMut(usize, &Triangle<N>, &dyn ContactPreprocessor<N>),
)
pub fn map_elements_in_local_aabb( &self, aabb: &AABB<N>, f: &mut impl FnMut(usize, &Triangle<N>, &dyn ContactPreprocessor<N>), )
Applies the function f
to all the triangles of this heightfield intersecting the given AABB.
Trait Implementations§
Source§impl<N: Clone + RealField + Copy> Clone for HeightField<N>
impl<N: Clone + RealField + Copy> Clone for HeightField<N>
Source§fn clone(&self) -> HeightField<N>
fn clone(&self) -> HeightField<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for HeightField<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for HeightField<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, BoundingSphere<N>> for HeightField<N>
impl<N: RealField + Copy> HasBoundingVolume<N, BoundingSphere<N>> for HeightField<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> BoundingSphere<N>
fn bounding_volume(&self, m: &Isometry<N>) -> BoundingSphere<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> BoundingSphere<N>
fn local_bounding_volume(&self) -> BoundingSphere<N>
self
.Source§impl<N: RealField + Copy> PointQuery<N> for HeightField<N>
impl<N: RealField + Copy> PointQuery<N> for HeightField<N>
Source§fn project_point(
&self,
m: &Isometry<N>,
point: &Point<N>,
_: bool,
) -> PointProjection<N>
fn project_point( &self, m: &Isometry<N>, point: &Point<N>, _: bool, ) -> PointProjection<N>
self
transformed by m
.Source§fn project_point_with_feature(
&self,
m: &Isometry<N>,
point: &Point<N>,
) -> (PointProjection<N>, FeatureId)
fn project_point_with_feature( &self, m: &Isometry<N>, point: &Point<N>, ) -> (PointProjection<N>, FeatureId)
self
transformed by m
and retuns the id of the
feature the point was projected on.Source§impl<N: RealField + Copy> PointQueryWithLocation<N> for HeightField<N>
impl<N: RealField + Copy> PointQueryWithLocation<N> for HeightField<N>
Source§type Location = (usize, TrianglePointLocation<N>)
type Location = (usize, TrianglePointLocation<N>)
Source§fn project_point_with_location(
&self,
_m: &Isometry<N>,
_point: &Point<N>,
_: bool,
) -> (PointProjection<N>, Self::Location)
fn project_point_with_location( &self, _m: &Isometry<N>, _point: &Point<N>, _: bool, ) -> (PointProjection<N>, Self::Location)
self
transformed by m
.Source§impl<N: RealField + Copy> RayCast<N> for HeightField<N>
impl<N: RealField + Copy> RayCast<N> for HeightField<N>
Source§fn toi_and_normal_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<RayIntersection<N>>
fn toi_and_normal_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<RayIntersection<N>>
Source§fn toi_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<N>
fn toi_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<N>
Source§fn toi_and_normal_and_uv_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<RayIntersection<N>>
fn toi_and_normal_and_uv_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<RayIntersection<N>>
Source§impl<N: RealField + Copy> Shape<N> for HeightField<N>
impl<N: RealField + Copy> Shape<N> for HeightField<N>
Source§fn local_aabb(&self) -> AABB<N>
fn local_aabb(&self) -> AABB<N>
self
.Source§fn bounding_sphere(&self, m: &Isometry<N>) -> BoundingSphere<N>
fn bounding_sphere(&self, m: &Isometry<N>) -> BoundingSphere<N>
self
transformed by m
.Source§fn as_ray_cast(&self) -> Option<&dyn RayCast<N>>
fn as_ray_cast(&self) -> Option<&dyn RayCast<N>>
RayCast
implementation of self
.Source§fn as_point_query(&self) -> Option<&dyn PointQuery<N>>
fn as_point_query(&self) -> Option<&dyn PointQuery<N>>
PointQuery
implementation of self
.Source§fn tangent_cone_contains_dir(
&self,
_fid: FeatureId,
_m: &Isometry<N>,
_deformations: Option<&[N]>,
_dir: &Unit<Vector<N>>,
) -> bool
fn tangent_cone_contains_dir( &self, _fid: FeatureId, _m: &Isometry<N>, _deformations: Option<&[N]>, _dir: &Unit<Vector<N>>, ) -> bool
_feature
of the i-th
subshape of self
transformed by m
has a tangent
cone that contains dir
at the point pt
.Source§fn subshape_containing_feature(&self, _id: FeatureId) -> usize
fn subshape_containing_feature(&self, _id: FeatureId) -> usize
Source§fn local_bounding_sphere(&self) -> BoundingSphere<N>
fn local_bounding_sphere(&self) -> BoundingSphere<N>
self
.Source§fn as_convex_polyhedron(&self) -> Option<&dyn ConvexPolyhedron<N>>
fn as_convex_polyhedron(&self) -> Option<&dyn ConvexPolyhedron<N>>
self
if applicable.Source§fn as_support_map(&self) -> Option<&dyn SupportMap<N>>
fn as_support_map(&self) -> Option<&dyn SupportMap<N>>
self
if applicable.Source§fn as_composite_shape(&self) -> Option<&dyn CompositeShape<N>>
fn as_composite_shape(&self) -> Option<&dyn CompositeShape<N>>
self
if applicable.Source§fn as_deformable_shape(&self) -> Option<&dyn DeformableShape<N>>
fn as_deformable_shape(&self) -> Option<&dyn DeformableShape<N>>
self
if applicable.Source§fn as_deformable_shape_mut(&mut self) -> Option<&mut dyn DeformableShape<N>>
fn as_deformable_shape_mut(&mut self) -> Option<&mut dyn DeformableShape<N>>
self
if applicable.Source§fn is_convex_polyhedron(&self) -> bool
fn is_convex_polyhedron(&self) -> bool
self
uses a convex polyhedron representation.Source§fn is_support_map(&self) -> bool
fn is_support_map(&self) -> bool
self
uses a support-mapping based representation.Source§fn is_composite_shape(&self) -> bool
fn is_composite_shape(&self) -> bool
self
uses a composite shape-based representation.Source§fn is_deformable_shape(&self) -> bool
fn is_deformable_shape(&self) -> bool
self
uses a composite shape-based representation.Auto Trait Implementations§
impl<N> Freeze for HeightField<N>where
N: Freeze,
impl<N> RefUnwindSafe for HeightField<N>where
N: RefUnwindSafe,
impl<N> Send for HeightField<N>
impl<N> Sync for HeightField<N>
impl<N> Unpin for HeightField<N>where
N: Unpin,
impl<N> UnwindSafe for HeightField<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.