pub struct Mesh {
pub nodes: Vec<[f64; 3]>,
pub cells: Vec<[usize; 3]>,
}Expand description
Represents a standard 3D mesh.
A Mesh consists of nodes representing points in 3D space,
and cells which are triangles connecting these points.
§Example
let nodes = vec![[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]];
let cells = vec![[0, 1, 2]];
let mesh = Mesh::new(nodes, cells);Fields§
§nodes: Vec<[f64; 3]>§cells: Vec<[usize; 3]>Implementations§
Source§impl Mesh
impl Mesh
Sourcepub fn from_stl(filename: &str) -> Result<Self>
pub fn from_stl(filename: &str) -> Result<Self>
Reads a mesh from an ASCII STL file using read_stl.
See read_stl
Sourcepub fn from_obj(filename: &str) -> Result<Self>
pub fn from_obj(filename: &str) -> Result<Self>
Reads a mesh from an OBJ file using read_obj.
See read_obj
Sourcepub fn write_stl(
&self,
filename: Option<&str>,
format: Option<StlFormat>,
) -> Result<()>
pub fn write_stl( &self, filename: Option<&str>, format: Option<StlFormat>, ) -> Result<()>
Writes the mesh to an STL file.
See write_stl
Sourcepub fn write_obj(&self, filename: Option<&str>) -> Result<()>
pub fn write_obj(&self, filename: Option<&str>) -> Result<()>
Writes the mesh to an OBJ file.
See write_obj
Sourcepub fn triangles(&self) -> Vec<[[f64; 3]; 3]>
pub fn triangles(&self) -> Vec<[[f64; 3]; 3]>
Get nodes that make up cell triangles.
See get_mesh_triangles
Sourcepub fn cell_normals(&self) -> Vec<[f64; 3]>
pub fn cell_normals(&self) -> Vec<[f64; 3]>
Get cell normals.
See get_mesh_cell_normals
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mesh
impl RefUnwindSafe for Mesh
impl Send for Mesh
impl Sync for Mesh
impl Unpin for Mesh
impl UnsafeUnpin for Mesh
impl UnwindSafe for Mesh
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more