Module meshx::attrib

source ·
Expand description

Attribute API.

This module defines the API used to store and access attributes in meshes. Attributes are stored inside HashMap data structures, and are accessed through the variety of getters described below. The most efficient attribute access is through iterators which are standard slice iterators, so slice operations work on attribute data. Alternatively, individual attribute values can be accessed using get, get_ref and get_mut, but each call to such a getter icurs a cost for runtime type checking. Since the type of the attribute being stored is determined at runtime, you must provide the expected type and location of the attribute when retrieving values. This is done using a “turbofish”; for example to retrieve a 3 float array attribute stored at vertices we need to specify ::<[f32; 3], VertexIndex> to the appropriate accessor. See the Attrib trait for more details.

New Mesh Types

When defining new meshes, simply “derive” the Attrib trait. The custom derive will look for a field with type AttribDict<_> where _ corresponds to an index type identifying the location where the attribute lives. For example AttribDict<VertexIndex> is a HashMap that stores attributes at vertices of the mesh. Any topology index can be used there. See the implementations of TetMesh and TriMesh for more details.

Structs

  • Mesh attribute with an associated topology I.
  • Attribute data stored directly with each associated element.
  • Mesh attribute data.
  • An intrinsic attribute type. This differs from Attribute<I> in that it is explicitly typed and it is intended to be used for attributes that are “intrinsic” to the specific mesh type. For instance, the position attribute is intrinsic to polygonal or tetrahedral meshes and point clouds. Intrinsic attributes define the geometry of the mesh type.
  • A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.

Enums

  • Mesh attribute data.
  • A view into a single entry in a map, which may either be vacant or occupied.
  • Error type specific to retrieving attributes from the attribute dictionary.

Traits

Type Aliases

  • Attribute dictionary for a specific topology I.
  • A collection of indirect attribute values cached for improved memory usage.
  • A slice of attribute values belonging to a particular attribute.
  • A mutable slice of attribute values belonging to a particular attribute.
  • A vector of values stored by a direct attribute.
  • A slice of attribute values belonging to a particular indirect attribute.
  • A mutable slice of attribute values belonging to a particular indirect attribute.
  • A vector of values stored by an indirect attribute.
  • An reference to a value stored at an indirect attribute at some index.
  • A mutable reference to a value stored at an indirect attribute at some index.
  • A reference to a value stored at an indirect attribute at some index.
  • An owned value stored at an attribute at some index.
  • A reference to a value stored at an attribute at some index.