pub struct PointCloud<T: Real> {
    pub vertex_positions: IntrinsicAttribute<[T; 3], VertexIndex>,
    pub vertex_attributes: AttribDict<VertexIndex>,
}
Expand description

A collection of disconnected points, possibly but not necessarily representing some geometry. The points may have arbitrary attributes assigned to them such as orientation.

Fields§

§vertex_positions: IntrinsicAttribute<[T; 3], VertexIndex>

Vertex positions.

§vertex_attributes: AttribDict<VertexIndex>

Vertex attribute data.

Implementations§

source§

impl<T: Real> PointCloud<T>

source

pub fn new(verts: Vec<[T; 3]>) -> PointCloud<T>

Construct a PointCloud from an array of vertices.

Examples
use meshx::mesh::{PointCloud, VertexPositions};
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 ptcloud = PointCloud::new(points.clone());

let positions = ptcloud.vertex_positions().to_vec();
assert_eq!(positions, points);

Trait Implementations§

source§

impl<T: Real> Attrib for PointCloud<T>

source§

fn attrib_size<I: AttribIndex<Self>>(&self) -> usize

Get the size of the attribute at the appropriate mesh location determined by I.
source§

fn attrib_dict<I: AttribIndex<Self>>(&self) -> &AttribDict<I>

Read only access to the attribute dictionary.
source§

fn attrib_dict_mut<I: AttribIndex<Self>>(&mut self) -> &mut AttribDict<I>

Read and write access to the attribute dictionary.
source§

fn attrib_dict_and_cache_mut<I: AttribIndex<Self>>( &mut self ) -> (&mut AttribDict<I>, Option<&mut AttribValueCache>)

Read and write access to the attribute dictionary along with a cache for indirect attribute values.
source§

fn insert_attrib_with_default<'a, T, I: AttribIndex<Self>>( &mut self, name: &'a str, def: T ) -> Result<&mut Attribute<I>, Error>
where T: AttributeValue,

Insert an attribute at the appropriate location with a given default. Read more
source§

fn insert_attrib_data<'a, T, I: AttribIndex<Self>>( &mut self, name: &'a str, data: Vec<T> ) -> Result<&mut Attribute<I>, Error>

Construct an attribute from a given data Vec<T>. data must have exactly the right size for the attribute to be inserted successfully. Read more
source§

fn reset_attrib_to_default<'a, T, I: AttribIndex<Self>>( &mut self, name: &'a str, def: T ) -> Result<&mut Attribute<I>, Error>
where T: AttributeValue,

Resets the attribute to the specified default value whether or not it already exists.
source§

fn set_attrib_data<'a, T, I: AttribIndex<Self>>( &mut self, name: &'a str, data: Vec<T> ) -> Result<&mut Attribute<I>, Error>

Set an attribute to the given data vector. data must have exactly the right size for the attribute to be set successfully. Read more
source§

fn insert_indirect_attrib<'a, T, I: AttribIndex<Self>>( &mut self, name: &'a str, def: T ) -> Result<(&mut Attribute<I>, &mut AttribValueCache), Error>

Insert an indirect attribute at the appropriate location with a given default.
source§

fn set_indirect_attrib<'a, T, I: AttribIndex<Self>>( &mut self, name: &'a str, def: T ) -> Result<(&mut Attribute<I>, &mut AttribValueCache), Error>

Sets the indirect attribute to the specified default value whether or not it already exists.
source§

fn insert_indirect_attrib_data<'a, I: AttribIndex<Self>>( &mut self, name: &'a str, data: IndirectData ) -> Result<(&mut Attribute<I>, &mut AttribValueCache), Error>

Construct an indirect attribute from a given IndirectData. data must have exactly the right size for the attribute to be inserted successfully.
source§

fn set_indirect_attrib_data<'a, I: AttribIndex<Self>>( &mut self, name: &'a str, data: IndirectData ) -> Result<(&mut Attribute<I>, &mut AttribValueCache), Error>

Set an indirect attribute to the given IndirectData instance. data must have exactly the right size for the attribute to be set successfully.
source§

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,

Makes a copy of an existing attribute. Read more
source§

fn remove_attrib<I: AttribIndex<Self>>( &mut self, name: &str ) -> Result<Attribute<I>, Error>

Remove an attribute from the attribute dictionary. Read more
source§

fn insert_attrib<I: AttribIndex<Self>>( &mut self, name: &str, attrib: Attribute<I> ) -> Result<Option<Attribute<I>>, Error>

Inserts an attribute into the dictionary with the usual HashMap semantics. Read more
source§

fn attrib_or_insert_with_default<'a, T, I: AttribIndex<Self>>( &mut self, name: &'a str, def: T ) -> Result<&mut Attribute<I>, Error>
where T: AttributeValue,

Retrieve the attribute with the given name and if it doesn’t exist, insert a new one and set it to a given default value. In either case the mutable reference to the attribute is returned.
source§

fn attrib_or_insert_data<'a, T, I: AttribIndex<Self>>( &mut self, name: &'a str, data: &[T] ) -> Result<&mut Attribute<I>, Error>

Retrieve the attribute with the given name and if it doesn’t exist, set its data to what’s in the given slice. In either case the mutable reference to the attribute is returned.
source§

fn attrib_or_insert_indirect<'a, T, I: AttribIndex<Self>>( &mut self, name: &'a str, def: T ) -> Result<(&mut Attribute<I>, &mut AttribValueCache), Error>

Retrieve the indirect attribute with the given name and if it doesn’t exist, insert a new one and set it to a given default value. In either case the mutable reference to the attribute is returned.
source§

fn direct_attrib_iter<'a, 'b, T, I: 'b + AttribIndex<Self>>( &'b self, name: &'a str ) -> Result<Iter<'_, T>, Error>
where T: Any + Clone,

Get the attribute iterator for a direct attribute.
source§

fn attrib_iter_mut<'a, 'b, T, I: 'b + AttribIndex<Self>>( &'b mut self, name: &'a str ) -> Result<IterMut<'_, T>, Error>
where T: Any + Clone,

Get the attribute mutable iterator for a direct attribute. Read more
source§

fn attrib_iter<'b, T, I: 'b + AttribIndex<Self>>( &'b self, name: &str ) -> Result<Box<dyn Iterator<Item = &'b T> + 'b>, Error>
where T: Any + Clone,

Get the iterator for an attribute no matter what kind. Read more
source§

fn indirect_attrib_update_with<'a, 'b, T, I, F>( &'b mut self, name: &'a str, f: F ) -> Result<(&'b mut Attribute<I>, &'b mut AttribValueCache), Error>
where T: AttributeValueHash, I: 'b + AttribIndex<Self>, F: FnMut(usize, &Irc<T>) -> Option<Irc<T>>,

Update indirect attribute entries with the given closure. Read more
source§

fn attrib_exists<I: AttribIndex<Self>>(&self, name: &str) -> bool

Return true if the given attribute exists at the given location, and false otherwise, even if the specified attribute location is invalid for the mesh.
source§

fn attrib_check<'a, T: Any, I: AttribIndex<Self>>( &self, name: &'a str ) -> Result<&Attribute<I>, Error>

Determine if the given attribute is valid and exists at the given location. Read more
source§

fn attrib_as_slice<'a, 'b, T: 'static, I: 'b + AttribIndex<Self>>( &'b self, name: &'a str ) -> Result<&'b [T], Error>

Expose the underlying direct attribute as a slice. Read more
source§

fn attrib_as_mut_slice<'a, 'b, T: 'static, I: 'b + AttribIndex<Self>>( &'b mut self, name: &'a str ) -> Result<&'b mut [T], Error>

Expose the underlying direct attribute as a mutable slice. Read more
source§

fn attrib_clone_into_vec<'a, 'b, T, I: 'b + AttribIndex<Self>>( &'b self, name: &'a str ) -> Result<Vec<T>, Error>

Clone attribute data into a Vec<T>. Read more
source§

fn direct_attrib_clone_into_vec<'a, 'b, T, I: 'b + AttribIndex<Self>>( &'b self, name: &'a str ) -> Result<Vec<T>, Error>
where T: AttributeValue,

Clone direct attribute data into a Vec<T>. Read more
source§

fn attrib<'a, I: AttribIndex<Self>>( &self, name: &'a str ) -> Result<&Attribute<I>, Error>

Borrow the raw attribute from the attribute dictionary. Read more
source§

fn attrib_mut<'a, I: AttribIndex<Self>>( &mut self, name: &'a str ) -> Result<&mut Attribute<I>, Error>

Get the raw mutable attribute from the attribute dictionary. Read more
source§

impl<T: Clone + Real> Clone for PointCloud<T>

source§

fn clone(&self) -> PointCloud<T>

Returns a copy 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<T: Debug + Real> Debug for PointCloud<T>

source§

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

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

impl<T: Real> Default for PointCloud<T>

source§

fn default() -> Self

Produce an empty PointCloud.

This is not particularly useful on its own, however it can be used as a null case for various mesh algorithms.

source§

impl<T: Real, M: VertexMesh<T>> From<&M> for PointCloud<T>

Convert a borrow of any VertexMesh into a PointCloud. Since we can’t destructure a generic type, it’s sufficient to do the conversion from a reference to a mesh.

source§

fn from(mesh: &M) -> PointCloud<T>

Converts to this type from the input type.
source§

impl<T: Real> From<PointCloud<T>> for Mesh<T>

Convert a point cloud into a mesh.

source§

fn from(mesh: PointCloud<T>) -> Mesh<T>

Converts to this type from the input type.
source§

impl<T: Real> From<PointCloud<T>> for PolyMesh<T>

Convert a point cloud into a polygon mesh.

source§

fn from(mesh: PointCloud<T>) -> PolyMesh<T>

Converts to this type from the input type.
source§

impl<T: Real> From<PolyMesh<T>> for PointCloud<T>

Convert a polygon mesh to a point cloud by erasing all polygon data.

source§

fn from(polymesh: PolyMesh<T>) -> PointCloud<T>

Converts to this type from the input type.
source§

impl<T: Real> From<QuadMesh<T>> for PointCloud<T>

Convert a quad mesh to a point cloud by erasing all quad data.

source§

fn from(mesh: QuadMesh<T>) -> PointCloud<T>

Converts to this type from the input type.
source§

impl<T: Real> From<TetMesh<T>> for PointCloud<T>

Convert a tet mesh to a point cloud by erasing all tet data.

source§

fn from(mesh: TetMesh<T>) -> PointCloud<T>

Converts to this type from the input type.
source§

impl<T: Real> From<TriMesh<T>> for PointCloud<T>

Convert a triangle mesh to a point cloud by erasing all triangle data.

source§

fn from(mesh: TriMesh<T>) -> PointCloud<T>

Converts to this type from the input type.
source§

impl<T: Real> Merge for PointCloud<T>

source§

fn merge(&mut self, other: Self) -> &mut Self

Merge another object into self and return the resulting merged object as a mutable reference.
source§

fn merge_iter(iterable: impl IntoIterator<Item = Self>) -> Self
where Self: Default,

Merge an iterator of objects into one of the same type.
source§

fn merge_vec(vec: Vec<Self>) -> Self
where Self: Default,

Merge a Vec of objects into one of the same type.
source§

fn merge_slice(slice: &[Self]) -> Self
where Self: Clone + Default,

In contrast to merge_vec, this function takes an immutable reference to a collection of meshes, and creates a brand new mesh that is a union of all the given meshes.
source§

impl<T: Real> NumVertices for PointCloud<T>

source§

impl<T: PartialEq + Real> PartialEq for PointCloud<T>

source§

fn eq(&self, other: &PointCloud<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Real> VertexAttrib for PointCloud<T>

source§

fn topo_attrib_size(&self) -> usize

Mesh implementation of the attribute size getter.
source§

fn topo_attrib_dict(&self) -> &AttribDict<VertexIndex>

Mesh implementation of the attribute dictionary getter.
source§

fn topo_attrib_dict_mut(&mut self) -> &mut AttribDict<VertexIndex>

Mesh implementation of the attribute dictionary mutable getter.
source§

fn topo_attrib_dict_and_cache_mut( &mut self ) -> (&mut AttribDict<VertexIndex>, Option<&mut AttribValueCache>)

Mesh implementation of the attribute dictionary and cache mutable getter.
source§

impl<T: Real> VertexPositions for PointCloud<T>

§

type Element = [T; 3]

source§

fn vertex_positions(&self) -> &[Self::Element]

Vertex positions as a slice of triplets.
source§

fn vertex_positions_mut(&mut self) -> &mut [Self::Element]

Vertex positions as a mutable slice of triplets.
source§

fn vertex_position_iter(&self) -> Iter<'_, Self::Element>

Vertex iterator.
source§

fn vertex_position_iter_mut(&mut self) -> IterMut<'_, Self::Element>

Mutable vertex iterator.
source§

impl<T: Real> StructuralPartialEq for PointCloud<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for PointCloud<T>
where T: RefUnwindSafe,

§

impl<T> Send for PointCloud<T>

§

impl<T> Sync for PointCloud<T>

§

impl<T> Unpin for PointCloud<T>
where T: Unpin,

§

impl<T> UnwindSafe for PointCloud<T>
where T: UnwindSafe,

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<M, T> BoundingBox<T> for M
where T: Real, M: VertexPositions<Element = [T; 3]>,

source§

fn bounding_box(&self) -> BBox<T>

Compute the bounding box of this object.

source§

impl<T> Bytes for T

source§

fn as_bytes(&self) -> &[u8]

Get a slice of bytes representing Self.
source§

fn interpret_bytes(bytes: &[u8]) -> &Self

Panics if the size of the given bytes slice is not equal to the size of Self.
source§

impl<T> CloneBytes for T
where T: Clone + 'static,

source§

unsafe fn clone_bytes(src: &[MaybeUninit<u8>]) -> Box<[MaybeUninit<u8>]>

source§

unsafe fn clone_from_bytes(dst: &mut [MaybeUninit<u8>], src: &[MaybeUninit<u8>])

source§

unsafe fn clone_into_raw_bytes( src: &[MaybeUninit<u8>], dst: &mut [MaybeUninit<u8>] )

source§

impl<T> DebugBytes for T
where T: Debug + 'static,

source§

unsafe fn fmt_bytes( bytes: &[MaybeUninit<u8>], f: &mut Formatter<'_> ) -> Result<(), Error>

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> DropBytes for T
where T: 'static,

source§

unsafe fn drop_bytes(bytes: &mut [MaybeUninit<u8>])

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<'a, S, I> Get<'a, I> for S
where I: GetIndex<'a, S>,

§

type Output = <I as GetIndex<'a, S>>::Output

source§

fn get(&self, idx: I) -> Option<<I as GetIndex<'a, S>>::Output>

source§

fn at(&self, idx: I) -> Self::Output

Return a value at the given index. This is provided as the checked version of get that will panic if the equivalent get call is None, which typically means that the given index is out of bounds. Read more
source§

unsafe fn at_unchecked(&self, idx: I) -> Self::Output

Return a value at the given index. Read more
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<S, I> Isolate<I> for S
where I: IsolateIndex<S>,

§

type Output = <I as IsolateIndex<S>>::Output

source§

unsafe fn isolate_unchecked(self, idx: I) -> <S as Isolate<I>>::Output

Unchecked version of isolate. Read more
source§

fn try_isolate(self, idx: I) -> Option<<S as Isolate<I>>::Output>

source§

fn isolate(self, idx: I) -> Self::Output
where Self: Sized,

Return a value at the given index. This is provided as the checked version of try_isolate that will panic if the equivalent try_isolate call is None, which typically means that the given index is out of bounds. Read more
source§

impl<T> PartialEqBytes for T
where T: PartialEq + 'static,

source§

unsafe fn eq_bytes(a: &[MaybeUninit<u8>], b: &[MaybeUninit<u8>]) -> bool

source§

impl<M> Partition for M
where M: Attrib,

source§

fn partition_by_attrib<T, Src>(&self, attrib: &str) -> (Vec<usize>, usize)
where T: AttributeValueHash, Src: AttribIndex<M>,

Returns a partitioning by unique values of the given attribute. Read more
source§

fn partition_by_attrib_by_sort<T, Src>( &self, attrib: &str ) -> (Vec<usize>, usize)

Returns a partitioning by unique values of the given attribute. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, N> PushArrayToVec<N> for T
where T: Clone, N: Array<T>,

source§

fn push_to_vec(element: <N as Array<T>>::Array, set: &mut Vec<T>)

This method tells this type how it can be pushed to a Vec as an array.
source§

impl<T, M> Rotate<T> for M
where T: RealField + Float, M: VertexPositions<Element = [T; 3]>,

source§

fn rotate_by_matrix(&mut self, mtx: [[T; 3]; 3])

Rotate the mesh using the given column-major rotation matrix.

source§

fn rotate(&mut self, axis: [T; 3], theta: T)

Rotate the object around the given unit vector u by the given angle theta (in radians). Read more
source§

fn rotate_by_vector(&mut self, e: [T; 3])
where T: Zero,

Rotate the object using the given Euler vector (or rotation vector) e. The direction of e specifies the axis of rotation and its magnitude is the angle in radians.
source§

impl<S, T> Rotated<T> for S
where T: RealField, S: Rotate<T>,

source§

fn rotated(self, u: [T; 3], theta: T) -> S

Return a version of self rotated about the unit vector u by the given angle theta (in radians). Read more
source§

fn rotated_by_matrix(self, mtx: [[T; 3]; 3]) -> S

Return a version of self rotated using the given column-major rotation matrix
source§

fn rotated_by_vector(self, e: [T; 3]) -> S

Return a version of self rotated about the Euler vector e.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, M> Scale<T> for M
where T: RealField, M: VertexPositions<Element = [T; 3]>,

source§

fn scale(&mut self, _: [T; 3])

Scale a mesh in 3D by a given vector of scale factors. s = [1.0; 3] corresponds to a noop.

source§

fn uniform_scale(&mut self, s: T)

Uniformly scale the given object by the given factor in all dimensions.
source§

impl<S, T> Scaled<T> for S
where T: Copy, S: Scale<T>,

source§

fn scaled(self, s: [T; 3]) -> S

Return a scaled version of self.
source§

fn uniformly_scaled(self, s: T) -> S

Return a uniformly scaled version of self.
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

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

§

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, M> Translate<T> for M
where T: RealField, M: VertexPositions<Element = [T; 3]>,

source§

fn translate(&mut self, _: [T; 3])

Translate the mesh by the given translation vector (displacement) t.

source§

impl<S, T> Translated<T> for S
where S: Translate<T>,

source§

fn translated(self, t: [T; 3]) -> S

Return a version of self translated by the given translation vector t.
source§

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

§

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>,

§

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.
source§

impl<T> AttributeValue for T
where T: Clone + PartialEq + Debug + Send + Sync + 'static,

source§

impl<T> Elem for T
where T: Any + DropBytes,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

source§

impl<M, T> VertexMesh<T> for M