pub type TriMesh = GenericTriMesh<DefaultStorage>;
Expand description
A triangle-mesh.
Aliased Type§
struct TriMesh { /* private fields */ }
Implementations§
source§impl TriMesh
impl TriMesh
sourcepub fn bounding_sphere(&self, pos: &Isometry<Real>) -> BoundingSphere
pub fn bounding_sphere(&self, pos: &Isometry<Real>) -> BoundingSphere
Computes the world-space bounding sphere of this triangle mesh, transformed by pos
.
sourcepub fn local_bounding_sphere(&self) -> BoundingSphere
pub fn local_bounding_sphere(&self) -> BoundingSphere
Computes the local-space bounding sphere of this triangle mesh.
source§impl TriMesh
impl TriMesh
sourcepub fn canonical_split(
&self,
axis: usize,
bias: Real,
epsilon: Real
) -> SplitResult<Self>
pub fn canonical_split( &self, axis: usize, bias: Real, epsilon: Real ) -> SplitResult<Self>
Splits this TriMesh
along the given canonical axis.
This will split the Aabb by a plane with a normal with it’s axis
-th component set to 1.
The splitting plane is shifted wrt. the origin by the bias
(i.e. it passes through the point
equal to normal * bias
).
§Result
Returns the result of the split. The first mesh returned is the piece lying on the negative half-space delimited by the splitting plane. The second mesh returned is the piece lying on the positive half-space delimited by the splitting plane.
sourcepub fn split(
&self,
position: &Isometry<Real>,
axis: &UnitVector<Real>,
bias: Real,
epsilon: Real
) -> SplitResult<Self>
pub fn split( &self, position: &Isometry<Real>, axis: &UnitVector<Real>, bias: Real, epsilon: Real ) -> SplitResult<Self>
Splits this mesh, transformed by position
by a plane identified by its normal local_axis
and the bias
(i.e. the plane passes through the point equal to normal * bias
).
sourcepub fn local_split(
&self,
local_axis: &UnitVector<Real>,
bias: Real,
epsilon: Real
) -> SplitResult<Self>
pub fn local_split( &self, local_axis: &UnitVector<Real>, bias: Real, epsilon: Real ) -> SplitResult<Self>
Splits this mesh by a plane identified by its normal local_axis
and the bias
(i.e. the plane passes through the point equal to normal * bias
).
sourcepub fn canonical_intersection_with_plane(
&self,
axis: usize,
bias: Real,
epsilon: Real
) -> IntersectResult<Polyline>
pub fn canonical_intersection_with_plane( &self, axis: usize, bias: Real, epsilon: Real ) -> IntersectResult<Polyline>
Computes the intersection Polyline
s between this mesh and the plane identified by
the given canonical axis.
This will intersect the mesh by a plane with a normal with it’s axis
-th component set to 1.
The splitting plane is shifted wrt. the origin by the bias
(i.e. it passes through the point
equal to normal * bias
).
Note that the resultant polyline may have multiple connected components
sourcepub fn intersection_with_plane(
&self,
position: &Isometry<Real>,
axis: &UnitVector<Real>,
bias: Real,
epsilon: Real
) -> IntersectResult<Polyline>
pub fn intersection_with_plane( &self, position: &Isometry<Real>, axis: &UnitVector<Real>, bias: Real, epsilon: Real ) -> IntersectResult<Polyline>
Computes the intersection Polyline
s between this mesh, transformed by position
,
and a plane identified by its normal axis
and the bias
(i.e. the plane passes through the point equal to normal * bias
).
sourcepub fn intersection_with_local_plane(
&self,
local_axis: &UnitVector<Real>,
bias: Real,
epsilon: Real
) -> IntersectResult<Polyline>
pub fn intersection_with_local_plane( &self, local_axis: &UnitVector<Real>, bias: Real, epsilon: Real ) -> IntersectResult<Polyline>
Computes the intersection Polyline
s between this mesh
and a plane identified by its normal local_axis
and the bias
(i.e. the plane passes through the point equal to normal * bias
).
sourcepub fn intersection_with_aabb(
&self,
position: &Isometry<Real>,
flip_mesh: bool,
aabb: &Aabb,
flip_cuboid: bool,
epsilon: Real
) -> Option<Self>
pub fn intersection_with_aabb( &self, position: &Isometry<Real>, flip_mesh: bool, aabb: &Aabb, flip_cuboid: bool, epsilon: Real ) -> Option<Self>
Computes the intersection mesh between an Aabb and this mesh.
source§impl TriMesh
impl TriMesh
sourcepub fn new(vertices: Vec<Point<Real>>, indices: Vec<[u32; 3]>) -> Self
pub fn new(vertices: Vec<Point<Real>>, indices: Vec<[u32; 3]>) -> Self
Creates a new triangle mesh from a vertex buffer and an index buffer.
sourcepub fn with_flags(
vertices: Vec<Point<Real>>,
indices: Vec<[u32; 3]>,
flags: TriMeshFlags
) -> Self
pub fn with_flags( vertices: Vec<Point<Real>>, indices: Vec<[u32; 3]>, flags: TriMeshFlags ) -> Self
Creates a new triangle mesh from a vertex buffer and an index buffer, and flags controlling optional properties.
sourcepub fn set_flags(&mut self, flags: TriMeshFlags) -> Result<(), TopologyError>
pub fn set_flags(&mut self, flags: TriMeshFlags) -> Result<(), TopologyError>
Sets the flags of this triangle mesh, controlling its optional associated data.
sourcepub fn transform_vertices(&mut self, transform: &Isometry<Real>)
pub fn transform_vertices(&mut self, transform: &Isometry<Real>)
Transforms in-place the vertices of this triangle mesh.
sourcepub fn scaled(self, scale: &Vector<Real>) -> Self
pub fn scaled(self, scale: &Vector<Real>) -> Self
Returns a scaled version of this triangle mesh.
sourcepub fn flat_indices(&self) -> &[u32]
pub fn flat_indices(&self) -> &[u32]
A flat view of the index buffer of this mesh.
sourcepub fn triangles(&self) -> impl ExactSizeIterator<Item = Triangle> + '_
pub fn triangles(&self) -> impl ExactSizeIterator<Item = Triangle> + '_
An iterator through all the triangles of this mesh.
Trait Implementations§
source§impl<Storage: HeightFieldStorage> From<GenericHeightField<Storage>> for TriMesh
impl<Storage: HeightFieldStorage> From<GenericHeightField<Storage>> for TriMesh
source§fn from(heightfield: GenericHeightField<Storage>) -> Self
fn from(heightfield: GenericHeightField<Storage>) -> Self
source§impl RayCast for TriMesh
impl RayCast for TriMesh
source§fn cast_local_ray(&self, ray: &Ray, max_toi: Real, solid: bool) -> Option<Real>
fn cast_local_ray(&self, ray: &Ray, max_toi: Real, solid: bool) -> Option<Real>
source§fn cast_local_ray_and_get_normal(
&self,
ray: &Ray,
max_toi: Real,
solid: bool
) -> Option<RayIntersection>
fn cast_local_ray_and_get_normal( &self, ray: &Ray, max_toi: Real, solid: bool ) -> Option<RayIntersection>
source§fn intersects_local_ray(&self, ray: &Ray, max_toi: Real) -> bool
fn intersects_local_ray(&self, ray: &Ray, max_toi: Real) -> bool
source§fn cast_ray(
&self,
m: &Isometry<Real>,
ray: &Ray,
max_toi: Real,
solid: bool
) -> Option<Real>
fn cast_ray( &self, m: &Isometry<Real>, ray: &Ray, max_toi: Real, solid: bool ) -> Option<Real>
source§fn cast_ray_and_get_normal(
&self,
m: &Isometry<Real>,
ray: &Ray,
max_toi: Real,
solid: bool
) -> Option<RayIntersection>
fn cast_ray_and_get_normal( &self, m: &Isometry<Real>, ray: &Ray, max_toi: Real, solid: bool ) -> Option<RayIntersection>
source§impl Shape for TriMesh
impl Shape for TriMesh
source§fn compute_local_aabb(&self) -> Aabb
fn compute_local_aabb(&self) -> Aabb
Aabb
of this shape.source§fn compute_local_bounding_sphere(&self) -> BoundingSphere
fn compute_local_bounding_sphere(&self) -> BoundingSphere
source§fn compute_aabb(&self, position: &Isometry<Real>) -> Aabb
fn compute_aabb(&self, position: &Isometry<Real>) -> Aabb
Aabb
of this shape with the given position.