[−][src]Struct gut::mesh::polymesh::PolyMesh
Mesh with arbitrarily shaped faces. It could have polygons with any number of sides. All faces are assumed to be closed polygons.
Fields
vertex_positions: IntrinsicAttribute<[T; 3], VertexIndex>
Vertex positions intrinsic attribute.
indices: Vec<usize>
Indices into vertices
representing face vertices.
offsets: Vec<usize>
Offsets into indices
representing individual faces. The last element in this Vec
is
always the length of indices
for convenience.
vertex_attributes: AttribDict<VertexIndex>
Vertex attributes.
face_attributes: AttribDict<FaceIndex>
Polygon attributes.
face_vertex_attributes: AttribDict<FaceVertexIndex>
Polygon vertex attributes.
face_edge_attributes: AttribDict<FaceEdgeIndex>
Polygon edge attributes.
Methods
impl<T: Real> PolyMesh<T>
[src]
pub fn new(verts: Vec<[T; 3]>, faces: &[usize]) -> PolyMesh<T>
[src]
Construct a PolyMesh
from an array of vertices and an array of indices marking the vertex
indices into the vertex array for each face preceeded by the number of vertices in the
corresponding face. I.e. faces
is expected to be structured as a contiguous array of
a number (corresponding to the number of vertices in the face) followed by the vertex
indices (in the same face):
n i_1 i_2 ... i_n m j_1 j_2 ... j_m ...
Examples
use gut::mesh::PolyMesh; let points = vec![ [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [1.0, 1.0, 0.0], [0.0, 0.0, 1.0], [1.0, 0.0, 1.0]]; let faces = vec![3, 0, 1, 2, // first triangle 3, 1, 3, 2, // second triangle 4, 0, 1, 5, 4]; // quadrilateral let polymesh = PolyMesh::new(points, &faces); assert_eq!(polymesh.indices, [0, 1, 2, 1, 3, 2, 0, 1, 5, 4]); assert_eq!(polymesh.offsets, [0, 3, 6, 10]);
ⓘImportant traits for DynamicIndexSliceIter<'a>pub fn face_iter(&self) -> DynamicIndexSliceIter
[src]
ⓘImportant traits for DynamicIndexSliceIterMut<'a>pub fn face_iter_mut(&mut self) -> DynamicIndexSliceIterMut
[src]
pub fn reverse(&mut self)
[src]
Reverse the order of each polygon in this mesh.
pub fn reversed(self) -> PolyMesh<T>
[src]
Reverse the order of each polygon in this mesh. This is the consuming version of the
reverse
method.
Trait Implementations
impl<T: Real> SplitIntoConnectedComponents<VertexFaceIndex> for PolyMesh<T>
[src]
fn split_into_connected_components(self) -> Vec<Self>
[src]
impl<T: Real> Merge for PolyMesh<T>
[src]
fn merge(&mut self, other: Self) -> &mut Self
[src]
Attributes with the same name but different types won't be merged.
fn merge_vec(vec: Vec<Self>) -> Self where
Self: Default,
[src]
Self: Default,
fn merge_slice(slice: &[Self]) -> Self where
Self: Clone + Default,
[src]
Self: Clone + Default,
impl<T: Real> NumVertices for PolyMesh<T>
[src]
fn num_vertices(&self) -> usize
[src]
impl<T: Real> NumFaces for PolyMesh<T>
[src]
impl<T: Real> Attrib for PolyMesh<T>
[src]
fn attrib_size<I: AttribIndex<Self>>(&self) -> usize
[src]
fn attrib_dict<I: AttribIndex<Self>>(&self) -> &AttribDict<I>
[src]
fn attrib_dict_mut<I: AttribIndex<Self>>(&mut self) -> &mut AttribDict<I>
[src]
fn add_attrib<'a, T, I: AttribIndex<Self>>(
&mut self,
name: &'a str,
def: T
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone,
[src]
&mut self,
name: &'a str,
def: T
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone,
fn add_attrib_data<'a, T, I: AttribIndex<Self>>(
&mut self,
name: &'a str,
data: Vec<T>
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone + Default,
[src]
&mut self,
name: &'a str,
data: Vec<T>
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone + Default,
fn set_attrib<'a, T, I: AttribIndex<Self>>(
&mut self,
name: &'a str,
def: T
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone,
[src]
&mut self,
name: &'a str,
def: T
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone,
fn set_attrib_data<'a, T, I: AttribIndex<Self>>(
&mut self,
name: &'a str,
data: &[T]
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone + Default,
[src]
&mut self,
name: &'a str,
data: &[T]
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone + Default,
fn duplicate_attrib<'a, 'b, T, I: AttribIndex<Self>>(
&mut self,
name: &'a str,
new_name: &'b str
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone,
[src]
&mut self,
name: &'a str,
new_name: &'b str
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone,
fn remove_attrib<'a, I: AttribIndex<Self>>(
&mut self,
name: &'a str
) -> Result<Attribute<I>, Error>
[src]
&mut self,
name: &'a str
) -> Result<Attribute<I>, Error>
fn insert_attrib<'a, I: AttribIndex<Self>>(
&mut self,
name: &'a str,
attrib: Attribute<I>
) -> Result<Option<Attribute<I>>, Error>
[src]
&mut self,
name: &'a str,
attrib: Attribute<I>
) -> Result<Option<Attribute<I>>, Error>
fn attrib_or_add<'a, T, I: AttribIndex<Self>>(
&mut self,
name: &'a str,
def: T
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone,
[src]
&mut self,
name: &'a str,
def: T
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone,
fn attrib_or_add_data<'a, T, I: AttribIndex<Self>>(
&mut self,
name: &'a str,
data: &[T]
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone + Default,
[src]
&mut self,
name: &'a str,
data: &[T]
) -> Result<&mut Attribute<I>, Error> where
T: Any + Clone + Default,
fn attrib_iter<'a, 'b, T, I: 'b + AttribIndex<Self>>(
&'b self,
name: &'a str
) -> Result<Iter<T>, Error> where
T: 'static + Clone,
[src]
&'b self,
name: &'a str
) -> Result<Iter<T>, Error> where
T: 'static + Clone,
fn attrib_iter_mut<'a, 'b, T, I: 'b + AttribIndex<Self>>(
&'b mut self,
name: &'a str
) -> Result<IterMut<T>, Error> where
T: 'static + Clone,
[src]
&'b mut self,
name: &'a str
) -> Result<IterMut<T>, Error> where
T: 'static + Clone,
fn attrib_exists<'a, I: AttribIndex<Self>>(&self, name: &'a str) -> bool
[src]
fn attrib_check<'a, T: Any, I: AttribIndex<Self>>(
&self,
name: &'a str
) -> Result<(), Error>
[src]
&self,
name: &'a str
) -> Result<(), Error>
fn attrib_as_slice<'a, 'b, T: 'static, I: 'b + AttribIndex<Self>>(
&'b self,
name: &'a str
) -> Result<&'b [T], Error>
[src]
&'b self,
name: &'a str
) -> Result<&'b [T], Error>
fn attrib_as_mut_slice<'a, 'b, T: 'static, I: 'b + AttribIndex<Self>>(
&'b mut self,
name: &'a str
) -> Result<&'b mut [T], Error>
[src]
&'b mut self,
name: &'a str
) -> Result<&'b mut [T], Error>
fn attrib_clone_into_vec<'a, 'b, T, I: 'b + AttribIndex<Self>>(
&'b self,
name: &'a str
) -> Result<Vec<T>, Error> where
T: 'static + Clone,
[src]
&'b self,
name: &'a str
) -> Result<Vec<T>, Error> where
T: 'static + Clone,
fn attrib<'a, I: AttribIndex<Self>>(
&self,
name: &'a str
) -> Result<&Attribute<I>, Error>
[src]
&self,
name: &'a str
) -> Result<&Attribute<I>, Error>
fn attrib_mut<'a, I: AttribIndex<Self>>(
&mut self,
name: &'a str
) -> Result<&mut Attribute<I>, Error>
[src]
&mut self,
name: &'a str
) -> Result<&mut Attribute<I>, Error>
impl<T: Real> VertexPositions for PolyMesh<T>
[src]
type Element = [T; 3]
fn vertex_positions(&self) -> &[Self::Element]
[src]
fn vertex_positions_mut(&mut self) -> &mut [Self::Element]
[src]
fn vertex_position_iter(&self) -> Iter<Self::Element>
[src]
fn vertex_position_iter_mut(&mut self) -> IterMut<Self::Element>
[src]
fn vertex_position<VI>(&self, vidx: VI) -> Self::Element where
VI: Into<VertexIndex>,
[src]
VI: Into<VertexIndex>,
impl<T: Real> FaceVertex for PolyMesh<T>
[src]
fn face_to_vertex<FI>(&self, fidx: FI, which: usize) -> Option<VertexIndex> where
FI: Copy + Into<FaceIndex>,
[src]
FI: Copy + Into<FaceIndex>,
Given the index of a polygonal face fidx
, return the index of the vertex the which
th
vertex within the face.
fn face_vertex<FI>(&self, fidx: FI, which: usize) -> Option<FaceVertexIndex> where
FI: Copy + Into<FaceIndex>,
[src]
FI: Copy + Into<FaceIndex>,
fn num_face_vertices(&self) -> usize
[src]
fn num_vertices_at_face<FI>(&self, fidx: FI) -> usize where
FI: Copy + Into<FaceIndex>,
[src]
FI: Copy + Into<FaceIndex>,
fn reverse_topo(&self) -> (Vec<usize>, Vec<usize>) where
Self: NumFaces + NumVertices,
[src]
Self: NumFaces + NumVertices,
impl<T: Real> FaceEdge for PolyMesh<T>
[src]
fn face_to_edge<FI>(&self, fidx: FI, which: usize) -> Option<EdgeIndex> where
FI: Copy + Into<FaceIndex>,
[src]
FI: Copy + Into<FaceIndex>,
fn face_edge<FI>(&self, fidx: FI, which: usize) -> Option<FaceEdgeIndex> where
FI: Copy + Into<FaceIndex>,
[src]
FI: Copy + Into<FaceIndex>,
fn num_face_edges(&self) -> usize
[src]
fn num_edges_at_face<FI>(&self, fidx: FI) -> usize where
FI: Copy + Into<FaceIndex>,
[src]
FI: Copy + Into<FaceIndex>,
impl<T: Real> VertexAttrib for PolyMesh<T>
[src]
fn impl_attrib_size(&self) -> usize
[src]
fn impl_attrib_dict(&self) -> &AttribDict<VertexIndex>
[src]
fn impl_attrib_dict_mut(&mut self) -> &mut AttribDict<VertexIndex>
[src]
impl<T: Real> FaceAttrib for PolyMesh<T>
[src]
fn impl_attrib_size(&self) -> usize
[src]
fn impl_attrib_dict(&self) -> &AttribDict<FaceIndex>
[src]
fn impl_attrib_dict_mut(&mut self) -> &mut AttribDict<FaceIndex>
[src]
impl<T: Real> FaceVertexAttrib for PolyMesh<T>
[src]
fn impl_attrib_size(&self) -> usize
[src]
fn impl_attrib_dict(&self) -> &AttribDict<FaceVertexIndex>
[src]
fn impl_attrib_dict_mut(&mut self) -> &mut AttribDict<FaceVertexIndex>
[src]
impl<T: Real> FaceEdgeAttrib for PolyMesh<T>
[src]
fn impl_attrib_size(&self) -> usize
[src]
fn impl_attrib_dict(&self) -> &AttribDict<FaceEdgeIndex>
[src]
fn impl_attrib_dict_mut(&mut self) -> &mut AttribDict<FaceEdgeIndex>
[src]
impl<T: Real> From<PolyMesh<T>> for PointCloud<T>
[src]
Convert a polygon mesh to a point cloud by erasing all polygon data.
fn from(polymesh: PolyMesh<T>) -> PointCloud<T>
[src]
impl<T: Real> From<TriMesh<T>> for PolyMesh<T>
[src]
Convert a triangle mesh into a polygon mesh.
impl<T: Real> From<QuadMesh<T>> for PolyMesh<T>
[src]
Convert a quad mesh into a polygon mesh.
impl<T: Real> From<PointCloud<T>> for PolyMesh<T>
[src]
Convert a point cloud into a polygon mesh.
fn from(mesh: PointCloud<T>) -> PolyMesh<T>
[src]
impl<T: Real> From<TetMesh<T>> for PolyMesh<T>
[src]
impl<T: Real> From<PolyMesh<T>> for TriMeshExt<T>
[src]
Convert a triangle mesh to a polygon mesh.
fn from(mesh: PolyMesh<T>) -> TriMeshExt<T>
[src]
impl<T: Real> From<PolyMesh<T>> for TriMesh<T>
[src]
Convert a triangle mesh to a polygon mesh.
impl<T: Clone + Real> Clone for PolyMesh<T>
[src]
impl<T: Real> Default for PolyMesh<T>
[src]
fn default() -> Self
[src]
Produce an empty mesh. This is not particularly useful on its own, however it can be used as a null case for various mesh algorithms.
impl<T: PartialEq + Real> PartialEq<PolyMesh<T>> for PolyMesh<T>
[src]
impl<T: Debug + Real> Debug for PolyMesh<T>
[src]
impl<T: Real> StructuralPartialEq for PolyMesh<T>
[src]
Auto Trait Implementations
impl<T> Send for PolyMesh<T>
impl<T> Sync for PolyMesh<T>
impl<T> Unpin for PolyMesh<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for PolyMesh<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for PolyMesh<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, M> Scale<T> for M where
M: VertexPositions<Element = [T; 3]>,
T: BaseFloat,
[src]
M: VertexPositions<Element = [T; 3]>,
T: BaseFloat,
fn scale(&mut Self, [T; 3])
[src]
Scale a mesh in 3D by a given vector of scale factors.
s = [1.0; 3]
corresponds to a noop.
fn uniform_scale(&mut self, s: T)
[src]
impl<T, M> Rotate<T> for M where
M: VertexPositions<Element = [T; 3]>,
T: BaseFloat,
[src]
M: VertexPositions<Element = [T; 3]>,
T: BaseFloat,
fn rotate_by_matrix(&mut Self, [[T; 3]; 3])
[src]
Rotate the mesh using the given column-major rotation matrix.
fn rotate(&mut self, [x, y, z]: [T; 3], theta: T)
[src]
fn rotate_by_vector(&mut self, e: [T; 3]) where
T: Zero,
[src]
T: Zero,
impl<T, M> Translate<T> for M where
M: VertexPositions<Element = [T; 3]>,
T: BaseFloat,
[src]
M: VertexPositions<Element = [T; 3]>,
T: BaseFloat,
fn translate(&mut Self, [T; 3])
[src]
Translate the mesh by the given translation vector (displacement) t
.
impl<S, T> Scaled<T> for S where
S: Scale<T>,
T: Copy,
[src]
S: Scale<T>,
T: Copy,
impl<S, T> Rotated<T> for S where
S: Rotate<T>,
T: BaseFloat,
[src]
S: Rotate<T>,
T: BaseFloat,
fn rotated(Self, [T; 3], T) -> S
[src]
fn rotated_by_matrix(Self, [[T; 3]; 3]) -> S
[src]
fn rotated_by_vector(Self, [T; 3]) -> S
[src]
impl<S, T> Translated<T> for S where
S: Translate<T>,
[src]
S: Translate<T>,
fn translated(Self, [T; 3]) -> S
[src]
impl<M, T> BoundingBox<T> for M where
M: VertexPositions<Element = [T; 3]>,
T: Real,
[src]
M: VertexPositions<Element = [T; 3]>,
T: Real,
fn bounding_box(&Self) -> BBox<T>
[src]
Compute the bounding box of this object.
impl<M> Connectivity<VertexFaceIndex> for M where
M: NumVertices + NumFaces + FaceVertex,
[src]
M: NumVertices + NumFaces + FaceVertex,
fn precompute_reverse_topo(&Self) -> (Vec<usize>, Vec<usize>)
[src]
fn num_elements(&Self) -> usize
[src]
fn push_neighbours(
&Self,
VertexIndex,
&mut Vec<VertexIndex>,
&(Vec<usize>, Vec<usize>)
)
[src]
&Self,
VertexIndex,
&mut Vec<VertexIndex>,
&(Vec<usize>, Vec<usize>)
)
fn connectivity(&self) -> (Vec<usize>, usize)
[src]
impl<T> Bytes for T
[src]
impl<M, T> VertexMesh<T> for M where
M: Attrib + VertexAttrib + NumVertices + VertexPositions<Element = [T; 3]>,
T: Real,
[src]
M: Attrib + VertexAttrib + NumVertices + VertexPositions<Element = [T; 3]>,
T: Real,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,