pub struct Mesh {Show 18 fields
pub halfedge: HashMap<usize, HashMap<usize, Option<usize>>>,
pub vertex: HashMap<usize, VertexData>,
pub face: HashMap<usize, Vec<usize>>,
pub facedata: HashMap<usize, HashMap<String, f32>>,
pub edgedata: HashMap<(usize, usize), HashMap<String, f32>>,
pub default_vertex_attributes: HashMap<String, f32>,
pub default_face_attributes: HashMap<String, f32>,
pub default_edge_attributes: HashMap<String, f32>,
pub triangulation: HashMap<usize, Vec<[usize; 3]>>,
max_vertex: usize,
max_face: usize,
pub guid: String,
pub name: String,
pub pointcolors: Vec<Color>,
pub facecolors: Vec<Color>,
pub linecolors: Vec<Color>,
pub widths: Vec<f32>,
pub xform: Xform,
}
Expand description
A halfedge mesh data structure for representing polygonal surfaces
Fields§
§halfedge: HashMap<usize, HashMap<usize, Option<usize>>>
§vertex: HashMap<usize, VertexData>
§face: HashMap<usize, Vec<usize>>
§facedata: HashMap<usize, HashMap<String, f32>>
§edgedata: HashMap<(usize, usize), HashMap<String, f32>>
§default_vertex_attributes: HashMap<String, f32>
§default_face_attributes: HashMap<String, f32>
§default_edge_attributes: HashMap<String, f32>
§triangulation: HashMap<usize, Vec<[usize; 3]>>
§max_vertex: usize
§max_face: usize
§guid: String
§name: String
§pointcolors: Vec<Color>
§facecolors: Vec<Color>
§linecolors: Vec<Color>
§widths: Vec<f32>
§xform: Xform
Implementations§
Source§impl Mesh
impl Mesh
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
pub fn number_of_vertices(&self) -> usize
pub fn number_of_faces(&self) -> usize
pub fn number_of_edges(&self) -> usize
pub fn euler(&self) -> i32
pub fn add_vertex(&mut self, position: Point, key: Option<usize>) -> usize
pub fn add_face( &mut self, vertices: Vec<usize>, fkey: Option<usize>, ) -> Option<usize>
pub fn vertex_position(&self, vertex_key: usize) -> Option<Point>
pub fn face_vertices(&self, face_key: usize) -> Option<&Vec<usize>>
pub fn vertex_neighbors(&self, vertex_key: usize) -> Vec<usize>
pub fn vertex_faces(&self, vertex_key: usize) -> Vec<usize>
pub fn is_vertex_on_boundary(&self, vertex_key: usize) -> bool
pub fn face_normal(&self, face_key: usize) -> Option<Vector>
pub fn vertex_normal(&self, vertex_key: usize) -> Option<Vector>
pub fn vertex_normal_weighted( &self, vertex_key: usize, weighting: NormalWeighting, ) -> Option<Vector>
pub fn face_area(&self, face_key: usize) -> Option<f32>
pub fn vertex_angle_in_face( &self, vertex_key: usize, face_key: usize, ) -> Option<f32>
pub fn face_normals(&self) -> HashMap<usize, Vector>
pub fn vertex_normals(&self) -> HashMap<usize, Vector>
pub fn vertex_normals_weighted( &self, weighting: NormalWeighting, ) -> HashMap<usize, Vector>
pub fn vertex_index(&self) -> HashMap<usize, usize>
pub fn to_vertices_and_faces(&self) -> (Vec<Point>, Vec<Vec<usize>>)
pub fn from_polygons(polygons: Vec<Vec<Point>>, precision: Option<f32>) -> Self
pub fn set_vertex_color(&mut self, index: usize, color: Color)
pub fn set_face_color(&mut self, index: usize, color: Color)
pub fn set_edge_color(&mut self, index: usize, color: Color)
pub fn set_edge_width(&mut self, index: usize, width: f32)
pub fn jsonload(data: &Value) -> Option<Self>
pub fn to_json(&self, filename: &str) -> Result<()>
pub fn from_json(filename: &str) -> Result<Self>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mesh
impl<'de> Deserialize<'de> for Mesh
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Mesh
impl RefUnwindSafe for Mesh
impl Send for Mesh
impl Sync for Mesh
impl Unpin 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