Struct splashsurf_lib::mesh::TriMesh3d
source · pub struct TriMesh3d<R: Real> {
pub vertices: Vec<Vector3<R>>,
pub triangles: Vec<[usize; 3]>,
}
Expand description
A triangle (surface) mesh in 3D
Fields§
§vertices: Vec<Vector3<R>>
Coordinates of all vertices of the mesh
triangles: Vec<[usize; 3]>
The triangles of the mesh identified by their vertex indices
Implementations§
source§impl<R: Real> TriMesh3d<R>
impl<R: Real> TriMesh3d<R>
sourcepub fn triangle_cells(&self) -> &[TriangleCell]
pub fn triangle_cells(&self) -> &[TriangleCell]
Returns a slice of all triangles of the mesh as TriangleCell
s
sourcepub fn append(&mut self, other: &mut TriMesh3d<R>)
pub fn append(&mut self, other: &mut TriMesh3d<R>)
Appends the other mesh to this mesh
This operation appends the content of the other mesh’s vertex and triangle storage tho this mesh. The vertex indices of the appended triangles are adjusted accordingly. The other mesh will be empty after this operation.
sourcepub fn vertex_normal_directions_inplace(
&self,
normal_directions: &mut [Vector3<R>]
)
pub fn vertex_normal_directions_inplace( &self, normal_directions: &mut [Vector3<R>] )
Computes the mesh’s vertex normal directions inplace using an area weighted average of the adjacent triangle faces
Note that this function only computes the normal directions, these vectors are not normalized!
See Self::vertex_normals_inplace
if actual normal vectors are needed.
The method will panic if the length of the output slice is different from the number of vertices of the mesh.
The method does not make any assumptions about the values in the output slice.
sourcepub fn vertex_normal_directions(&self) -> Vec<Vector3<R>>
pub fn vertex_normal_directions(&self) -> Vec<Vector3<R>>
Computes the mesh’s vertex normal directions using an area weighted average of the adjacent triangle faces
Note that this function only computes the normal directions, these vectors are not normalized!
See Self::vertex_normals
if actual normal vectors are needed.
sourcepub fn vertex_normals_inplace(&self, normals: &mut [Unit<Vector3<R>>])
pub fn vertex_normals_inplace(&self, normals: &mut [Unit<Vector3<R>>])
Computes the mesh’s vertex normals inplace using an area weighted average of the adjacent triangle faces
The method will panic if the length of the output slice is different from the number of vertices of the mesh.
The method does not make any assumptions about the values in the output slice.
sourcepub fn vertex_normals(&self) -> Vec<Unit<Vector3<R>>>
pub fn vertex_normals(&self) -> Vec<Unit<Vector3<R>>>
Computes the mesh’s vertex normals using an area weighted average of the adjacent triangle faces
sourcepub fn par_vertex_normals_inplace(&self, normals: &mut [Unit<Vector3<R>>])
pub fn par_vertex_normals_inplace(&self, normals: &mut [Unit<Vector3<R>>])
Computes the mesh’s vertex normals inplace using an area weighted average of the adjacent triangle faces (parallelized version)
The method will panic if the length of the output slice is different from the number of vertices of the mesh.
The method does not make any assumptions about the values in the output slice.
sourcepub fn par_vertex_normals(&self) -> Vec<Unit<Vector3<R>>>
pub fn par_vertex_normals(&self) -> Vec<Unit<Vector3<R>>>
Computes the mesh’s vertex normals using an area weighted average of the adjacent triangle faces (parallelized version)
sourcepub fn compute_edge_information(&self) -> MeshEdgeInformation
pub fn compute_edge_information(&self) -> MeshEdgeInformation
Computes a helper struct with information about all edges in the mesh (i.e. number of incident triangles etc.)
sourcepub fn find_non_manifold_vertices(&self) -> Vec<usize>
pub fn find_non_manifold_vertices(&self) -> Vec<usize>
Returns all non-manifold vertices of this mesh
A non-manifold vertex is generated by pinching two surface sheets together at that vertex such that the vertex is incident to more than one fan of triangles.
Note: This function assumes that all edges in the mesh are manifold edges! If there are non- manifold edges, it is possible to connect two triangle fans using a third fan which is not detected by this function.
sourcepub fn compute_manifold_information(&self) -> MeshManifoldInformation
pub fn compute_manifold_information(&self) -> MeshManifoldInformation
Returns a struct with lists of all boundary edges, non-manifold edges and non-manifold vertices
Note that the output order is not necessarily deterministic due to the internal use of hashmaps.
Trait Implementations§
source§impl<I: Index, R: Real> From<SurfaceReconstruction<I, R>> for TriMesh3d<R>
impl<I: Index, R: Real> From<SurfaceReconstruction<I, R>> for TriMesh3d<R>
source§fn from(result: SurfaceReconstruction<I, R>) -> Self
fn from(result: SurfaceReconstruction<I, R>) -> Self
Extracts the reconstructed mesh
source§impl<R: Real> IntoVtkUnstructuredGridPiece for &TriMesh3d<R>
Available on crate feature vtk_extras
only.
impl<R: Real> IntoVtkUnstructuredGridPiece for &TriMesh3d<R>
vtk_extras
only.fn into_unstructured_grid(self) -> UnstructuredGridPiece
source§impl<R: Real> IntoVtkUnstructuredGridPiece for TriMesh3d<R>
Available on crate feature vtk_extras
only.
impl<R: Real> IntoVtkUnstructuredGridPiece for TriMesh3d<R>
vtk_extras
only.fn into_unstructured_grid(self) -> UnstructuredGridPiece
source§impl<R: Real> Mesh3d<R> for TriMesh3d<R>
impl<R: Real> Mesh3d<R> for TriMesh3d<R>
§type Cell = TriangleCell
type Cell = TriangleCell
source§fn vertices_mut(&mut self) -> &mut [Vector3<R>]
fn vertices_mut(&mut self) -> &mut [Vector3<R>]
source§fn cells(&self) -> &[TriangleCell]
fn cells(&self) -> &[TriangleCell]
source§fn from_vertices_and_connectivity(
vertices: Vec<Vector3<R>>,
triangles: Vec<Self::Cell>
) -> Self
fn from_vertices_and_connectivity( vertices: Vec<Vector3<R>>, triangles: Vec<Self::Cell> ) -> Self
source§fn vertex_vertex_connectivity(&self) -> Vec<Vec<usize>>
fn vertex_vertex_connectivity(&self) -> Vec<Vec<usize>>
source§fn vertex_cell_connectivity(&self) -> Vec<Vec<usize>>
fn vertex_cell_connectivity(&self) -> Vec<Vec<usize>>
source§fn keep_cells(&self, cell_indices: &[usize], keep_vertices: bool) -> Self
fn keep_cells(&self, cell_indices: &[usize], keep_vertices: bool) -> Self
source§impl<R: Real> TriMesh3dExt<R> for TriMesh3d<R>
impl<R: Real> TriMesh3dExt<R> for TriMesh3d<R>
source§fn tri_vertices(&self) -> &[Vector3<R>]
fn tri_vertices(&self) -> &[Vector3<R>]
source§fn tri_area_ijk<RComp: Real>(&self, ijk: &[usize; 3]) -> RComp
fn tri_area_ijk<RComp: Real>(&self, ijk: &[usize; 3]) -> RComp
source§fn tri_normal_ijk<RComp: Real>(&self, ijk: &[usize; 3]) -> Vector3<RComp>
fn tri_normal_ijk<RComp: Real>(&self, ijk: &[usize; 3]) -> Vector3<RComp>
source§fn tri_min_max_angles_ijk<RComp: Real>(
&self,
ijk: &[usize; 3]
) -> (RComp, RComp)
fn tri_min_max_angles_ijk<RComp: Real>( &self, ijk: &[usize; 3] ) -> (RComp, RComp)
Auto Trait Implementations§
impl<R> RefUnwindSafe for TriMesh3d<R>where R: RefUnwindSafe,
impl<R> Send for TriMesh3d<R>
impl<R> Sync for TriMesh3d<R>
impl<R> Unpin for TriMesh3d<R>where R: Unpin,
impl<R> UnwindSafe for TriMesh3d<R>where R: 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> IntoVtkDataSet for Twhere
T: IntoVtkUnstructuredGridPiece,
impl<T> IntoVtkDataSet for Twhere T: IntoVtkUnstructuredGridPiece,
source§fn into_dataset(self) -> DataSet
fn into_dataset(self) -> DataSet
vtk_extras
only.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.