Type Alias parry3d::shape::TriMesh

source ·
pub type TriMesh = GenericTriMesh<DefaultStorage>;
Expand description

A triangle-mesh.

Aliased Type§

struct TriMesh { /* private fields */ }

Implementations§

source§

impl TriMesh

source

pub fn bounding_sphere(&self, pos: &Isometry<Real>) -> BoundingSphere

Computes the world-space bounding sphere of this triangle mesh, transformed by pos.

source

pub fn local_bounding_sphere(&self) -> BoundingSphere

Computes the local-space bounding sphere of this triangle mesh.

source§

impl TriMesh

source

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.

source

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).

source

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).

source

pub fn canonical_intersection_with_plane( &self, axis: usize, bias: Real, epsilon: Real ) -> IntersectResult<Polyline>

Computes the intersection Polylines 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

source

pub fn intersection_with_plane( &self, position: &Isometry<Real>, axis: &UnitVector<Real>, bias: Real, epsilon: Real ) -> IntersectResult<Polyline>

Computes the intersection Polylines 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).

source

pub fn intersection_with_local_plane( &self, local_axis: &UnitVector<Real>, bias: Real, epsilon: Real ) -> IntersectResult<Polyline>

Computes the intersection Polylines 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).

source

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

pub fn intersection_with_cuboid( &self, position: &Isometry<Real>, flip_mesh: bool, cuboid: &Cuboid, cuboid_position: &Isometry<Real>, flip_cuboid: bool, epsilon: Real ) -> Option<Self>

Computes the intersection mesh between a cuboid and this mesh transformed by position.

source

pub fn intersection_with_local_cuboid( &self, flip_mesh: bool, cuboid: &Cuboid, cuboid_position: &Isometry<Real>, flip_cuboid: bool, _epsilon: Real ) -> Option<Self>

Computes the intersection mesh between a cuboid and this mesh.

source§

impl TriMesh

source

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.

source

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.

source

pub fn set_flags(&mut self, flags: TriMeshFlags) -> Result<(), TopologyError>

Sets the flags of this triangle mesh, controlling its optional associated data.

source

pub fn transform_vertices(&mut self, transform: &Isometry<Real>)

Transforms in-place the vertices of this triangle mesh.

source

pub fn scaled(self, scale: &Vector<Real>) -> Self

Returns a scaled version of this triangle mesh.

source

pub fn append(&mut self, rhs: &TriMesh)

Appends a second triangle mesh to this triangle mesh.

source

pub fn flat_indices(&self) -> &[u32]

A flat view of the index buffer of this mesh.

source

pub fn reverse(&mut self)

Reverse the orientation of the triangle mesh.

source

pub fn triangles(&self) -> impl ExactSizeIterator<Item = Triangle> + '_

An iterator through all the triangles of this mesh.

Trait Implementations§

source§

impl From<Cuboid> for TriMesh

source§

fn from(cuboid: Cuboid) -> Self

Converts to this type from the input type.
source§

impl<Storage: HeightFieldStorage> From<GenericHeightField<Storage>> for TriMesh

source§

fn from(heightfield: GenericHeightField<Storage>) -> Self

Converts to this type from the input type.
source§

impl RayCast for TriMesh

source§

fn cast_local_ray(&self, ray: &Ray, max_toi: Real, solid: bool) -> Option<Real>

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

fn cast_local_ray_and_get_normal( &self, ray: &Ray, max_toi: Real, solid: bool ) -> Option<RayIntersection>

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

fn intersects_local_ray(&self, ray: &Ray, max_toi: Real) -> bool

Tests whether a ray intersects this transformed shape.
source§

fn cast_ray( &self, m: &Isometry<Real>, ray: &Ray, max_toi: Real, solid: bool ) -> Option<Real>

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

fn cast_ray_and_get_normal( &self, m: &Isometry<Real>, ray: &Ray, max_toi: Real, solid: bool ) -> Option<RayIntersection>

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

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

Tests whether a ray intersects this transformed shape.
source§

impl Shape for TriMesh

source§

fn clone_box(&self) -> Box<dyn Shape>

Clones this shape into a boxed trait-object.
source§

fn compute_local_aabb(&self) -> Aabb

Computes the Aabb of this shape.
source§

fn compute_local_bounding_sphere(&self) -> BoundingSphere

Computes the bounding-sphere of this shape.
source§

fn compute_aabb(&self, position: &Isometry<Real>) -> Aabb

Computes the Aabb of this shape with the given position.
source§

fn mass_properties(&self, density: Real) -> MassProperties

Compute the mass-properties of this shape given its uniform density.
source§

fn shape_type(&self) -> ShapeType

Gets the type tag of this shape.
source§

fn as_typed_shape(&self) -> TypedShape<'_>

Gets the underlying shape as an enum.
source§

fn ccd_thickness(&self) -> Real

source§

fn ccd_angular_thickness(&self) -> Real

source§

fn as_composite_shape(&self) -> Option<&dyn SimdCompositeShape>

source§

fn compute_bounding_sphere(&self, position: &Isometry<Real>) -> BoundingSphere

Computes the bounding-sphere of this shape with the given position.
source§

fn is_convex(&self) -> bool

Is this shape known to be convex? Read more
source§

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

Convents this shape into its support mapping, if it has one.
source§

fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, Real)>

Converts this shape to a polygonal feature-map, if it is one.
source§

fn feature_normal_at_point( &self, _feature: FeatureId, _point: &Point<Real> ) -> Option<Unit<Vector<Real>>>

The shape’s normal at the given point located on a specific feature.
source§

fn compute_swept_aabb( &self, start_pos: &Isometry<Real>, end_pos: &Isometry<Real> ) -> Aabb

Computes the swept Aabb of this shape, i.e., the space it would occupy by moving from the given start position to the given end position.
source§

impl SimdCompositeShape for TriMesh

source§

fn map_part_at( &self, i: u32, f: &mut dyn FnMut(Option<&Isometry<Real>>, &dyn Shape) )

Applies a function to one sub-shape of this composite shape.
source§

fn qbvh(&self) -> &Qbvh<u32>

Gets the acceleration structure of the composite shape.