Struct Mesh

Source
pub struct Mesh {
    pub vertices: Vec<Vertex>,
    pub vertex_count: usize,
    pub faces: Vec<Face>,
    pub face_count: usize,
    pub halfedges: Vec<Halfedge>,
    pub halfedge_count: usize,
    pub edges: FnvHashMap<EdgeEndpoints, Id>,
}

Fields§

§vertices: Vec<Vertex>§vertex_count: usize§faces: Vec<Face>§face_count: usize§halfedges: Vec<Halfedge>§halfedge_count: usize§edges: FnvHashMap<EdgeEndpoints, Id>

Implementations§

Source§

impl Mesh

Source

pub fn new() -> Self

Source

pub fn vertex(&self, id: Id) -> Option<&Vertex>

Source

pub fn vertex_mut(&mut self, id: Id) -> Option<&mut Vertex>

Source

pub fn peek_same_halfedge(&self, any_paired_id: Id) -> Id

Source

pub fn edge_center(&self, id: Id) -> Point3<f32>

Source

pub fn face_center(&self, id: Id) -> Point3<f32>

Source

pub fn face_norm(&self, id: Id) -> Vector3<f32>

Source

pub fn face(&self, id: Id) -> Option<&Face>

Source

pub fn face_adj_id(&self, id: Id) -> Option<Id>

Source

pub fn face_adj(&self, id: Id) -> Option<&Face>

Source

pub fn halfedge_next_id(&self, id: Id) -> Option<Id>

Source

pub fn halfedge_prev_id(&self, id: Id) -> Option<Id>

Source

pub fn halfedge_opposite_id(&self, id: Id) -> Option<Id>

Source

pub fn face_first_halfedge_id(&self, id: Id) -> Option<Id>

Source

pub fn halfedge_start_vertex_id(&self, id: Id) -> Option<Id>

Source

pub fn halfedge_face_id(&self, id: Id) -> Option<Id>

Source

pub fn halfedge_opposite_face_id(&self, id: Id) -> Option<Id>

Source

pub fn halfedge_direct(&self, id: Id) -> Vector3<f32>

Source

pub fn set_halfedge_start_vertex_id(&mut self, halfedge_id: Id, vertex_id: Id)

Source

pub fn halfedge_start_vertex_mut(&mut self, id: Id) -> Option<&mut Vertex>

Source

pub fn halfedge_start_vertex(&self, id: Id) -> Option<&Vertex>

Source

pub fn set_halfedge_opposite_id(&mut self, halfedge_id: Id, opposite_id: Id)

Source

pub fn halfedge_start_vertex_alt_halfedge_id( &self, halfedge_id: Id, ) -> Option<Id>

Source

pub fn remove_face(&mut self, id: Id)

Source

pub fn face_mut(&mut self, id: Id) -> Option<&mut Face>

Source

pub fn halfedge(&self, id: Id) -> Option<&Halfedge>

Source

pub fn halfedge_mut(&mut self, id: Id) -> Option<&mut Halfedge>

Source

pub fn add_vertex(&mut self, position: Point3<f32>) -> usize

Source

pub fn add_halfedge(&mut self) -> Id

Source

pub fn pair_halfedges(&mut self, first: Id, second: Id)

Source

pub fn unpair_halfedges(&mut self, first: Id, second: Id)

Source

pub fn add_face(&mut self) -> Id

Source

pub fn add_linked_vertices( &mut self, linked_vertices: &mut HashMap<Id, Id>, ) -> Id

Source

pub fn add_vertices(&mut self, added_vertices: Vec<Id>) -> Id

Source

pub fn add_positions(&mut self, added_positions: Vec<Point3<f32>>) -> Id

Source

pub fn add_halfedges_and_vertices(&mut self, added_halfedges: &[(Id, Id)]) -> Id

Source

pub fn extrude_halfedges( &mut self, halfedges: &Vec<Id>, normal: Vector3<f32>, amount: f32, )

Source

pub fn extrude_face( &mut self, face_id: Id, normal: Vector3<f32>, amount: f32, ) -> &mut Self

Source

pub fn add_plane(&mut self, width: f32, depth: f32) -> Id

Source

pub fn transform(&mut self, mat: &Matrix4<f32>) -> &mut Self

Source

pub fn translate(&mut self, x: f32, y: f32, z: f32) -> &mut Self

Source

pub fn scale(&mut self, value: f32) -> &mut Self

Source

pub fn weld(&self) -> Self

Source

pub fn add_mesh(&mut self, other: &Mesh)

Source

pub fn flip_mesh(&self) -> Mesh

Source

pub fn split_mesh_by_other(&self, other: &Mesh) -> (Mesh, Mesh)

Source

pub fn union_convex_mesh(&self, other: &Mesh) -> Mesh

Source

pub fn diff_convex_mesh(&self, other: &Mesh) -> Mesh

Source

pub fn intersect_convex_mesh(&self, other: &Mesh) -> Mesh

Source

pub fn split_mesh_by_plane( &self, pt_on_plane: Point3<f32>, norm: Vector3<f32>, fill_cut: bool, ) -> (Mesh, Mesh)

Source

pub fn fix_tjunction(&mut self) -> &mut Self

Source

pub fn remove_extra_vertices(&self) -> Self

Source

pub fn combine_coplanar_faces(&self) -> Self

Source

pub fn combine_adj_faces_round(&self) -> (bool, Self)

Source

pub fn combine_adj_faces(&self) -> Self

Source

pub fn trim(&self, normalize: bool) -> Self

Source

pub fn is_triangulated_mesh_manifold(&self) -> bool

Source

pub fn broken_face_set(&self) -> HashSet<Id>

Source

pub fn mirror_in_x(&self, center_x: f32) -> Self

Source

pub fn mirror_in_z(&self, center_z: f32) -> Self

Source

pub fn fix_hole(&self) -> Self

Source

pub fn smooth(&mut self, factor: f32, limit_vertices: Option<&HashSet<usize>>)

Trait Implementations§

Source§

impl Add for Mesh

Source§

type Output = Mesh

The resulting type after applying the + operator.
Source§

fn add(self, other: Mesh) -> Mesh

Performs the + operation. Read more
Source§

impl AddAssign for Mesh

Source§

fn add_assign(&mut self, other: Mesh)

Performs the += operation. Read more
Source§

impl Clone for Mesh

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Mesh

Source§

fn add_debug_norm(&mut self, origin: Point3<f32>, norm: Vector3<f32>)

Source§

impl Debug for Mesh

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Export for Mesh

Source§

fn export(&self, filename: &str) -> Result<()>

Source§

impl Import for Mesh

Source§

fn import(&mut self, filename: &str) -> Result<()>

Source§

impl Subdivide for Mesh

Source§

fn subdivide(&self) -> Self

Source§

impl Triangulate for Mesh

Source§

fn triangulate(&self) -> Self

Triangulate without knowing stats about the input mesh.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.