pub struct Attribute { /* private fields */ }Expand description
Represents an attribute in a mesh. An attribute can be an array of values representing potisions
of vertices, or it can be an array of values representing normals of vertices or corners, or faces.
Note that the struct does not have the static type information, so the attribute value can be a
vector of any type of any dimension, as long as it implements the Vector trait. The information about
the type of the attribute, component type, and the number of components is stored in dynamically.
Implementations§
Source§impl Attribute
impl Attribute
pub fn new<Data, const N: usize>(
data: Vec<Data>,
att_type: AttributeType,
domain: AttributeDomain,
parents: Vec<AttributeId>,
) -> Selfwhere
Data: Vector<N>,
pub fn new_empty( id: AttributeId, att_type: AttributeType, domain: AttributeDomain, component_type: ComponentDataType, num_components: usize, ) -> Self
pub fn get<Data, const N: usize>(&self, p_idx: PointIdx) -> Data
pub fn get_unique_val<Data, const N: usize>( &self, val_idx: AttributeValueIdx, ) -> Data
pub fn get_component_type(&self) -> ComponentDataType
pub fn get_id(&self) -> AttributeId
pub fn get_num_components(&self) -> usize
pub fn get_attribute_type(&self) -> AttributeType
pub fn get_domain(&self) -> AttributeDomain
pub fn get_parents(&self) -> &Vec<AttributeId>
pub fn num_unique_values(&self) -> usize
pub fn get_unique_val_idx(&self, idx: PointIdx) -> AttributeValueIdx
pub fn set_name(&mut self, name: String)
pub fn get_name(&self) -> Option<&String>
Sourcepub fn unique_vals_as_slice<Data>(&self) -> &[Data]
pub fn unique_vals_as_slice<Data>(&self) -> &[Data]
returns the data values as a slice of values casted to the given type.
Sourcepub fn unique_vals_as_slice_mut<Data>(&mut self) -> &mut [Data]
pub fn unique_vals_as_slice_mut<Data>(&mut self) -> &mut [Data]
returns the data values as a mutable slice of values casted to the given type.
Sourcepub unsafe fn unique_vals_as_slice_unchecked<Data>(&self) -> &[Data]
pub unsafe fn unique_vals_as_slice_unchecked<Data>(&self) -> &[Data]
returns the data values as a slice of values casted to the given type.
§Safety:
This function assumes that the buffer’s data is properly aligned and matches the type Data.
Sourcepub unsafe fn unique_vals_as_slice_unchecked_mut<Data>(&mut self) -> &mut [Data]
pub unsafe fn unique_vals_as_slice_unchecked_mut<Data>(&mut self) -> &mut [Data]
returns the data values as a mutable slice of values casted to the given type.
§Safety:
This function assumes that the buffer’s data is properly aligned and matches the type Data.
Sourcepub fn permute(&mut self, indices: &[usize])
pub fn permute(&mut self, indices: &[usize])
permutes the data in the buffer according to the given indices, i.e.
i-th element in the buffer will be moved to indices[i]-th position.
Sourcepub fn permute_unchecked(&mut self, indices: &[usize])
pub fn permute_unchecked(&mut self, indices: &[usize])
permutes the data in the buffer according to the given indices, i.e.
i-th element in the buffer will be moved to indices[i]-th position.
§Safety:
This function assumes that the indices are valid, i.e. they are within the bounds of the buffer.
Sourcepub fn swap(&mut self, i: usize, j: usize)
pub fn swap(&mut self, i: usize, j: usize)
swaps the elements at indices i and j in the buffer.
pub fn take_values<Data, const N: usize>(self) -> Vec<Data>where
Data: Vector<N>,
pub fn into_parts<Data, const N: usize>(
self,
) -> (Vec<Data>, Option<VecPointIdx<AttributeValueIdx>>, Self)where
Data: Vector<N>,
pub fn set_values<Data, const N: usize>(&mut self, data: Vec<Data>)where
Data: Vector<N>,
pub fn remove_duplicate_values<Data, const N: usize>(&mut self)where
Data: Vector<N>,
pub fn remove_unique_val_dyn(&mut self, val_idx: usize)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Attribute
impl RefUnwindSafe for Attribute
impl !Send for Attribute
impl !Sync for Attribute
impl Unpin for Attribute
impl UnwindSafe for Attribute
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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>
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>
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