pub struct Mesh {
pub faces: Vec<[PointIdx; 3]>,
pub attributes: Vec<Attribute>,
/* private fields */
}Expand description
The geometry container the encoder consumes, and the builder used to assemble one.
Everything needed to drive the encoder is reachable from draco_oxide alone:
use draco_oxide::{
Attribute, AttributeDomain, AttributeType, ComponentDataType, ConfigType, Mesh,
MeshBuilder, NdVector,
};
use draco_oxide::encode::Config;
let _builder = MeshBuilder::new();
let _cfg = <Config as ConfigType>::default();
let _ty = AttributeType::Position;
let _dom = AttributeDomain::Position;
let _ct = ComponentDataType::F32;
fn _drives(_m: Mesh, _a: Attribute, _v: NdVector<3, f32>) {}Represents a 3D mesh. It consists of a list of faces, where each face is defined by three vertex indices, and a list of attributes (Attribute) that can be associated with the mesh.
Fields§
§faces: Vec<[PointIdx; 3]>The faces as point-index triples.
attributes: Vec<Attribute>The attributes attached to the mesh.
Implementations§
Source§impl Mesh
impl Mesh
Sourcepub fn get_attributes(&self) -> &[Attribute]
pub fn get_attributes(&self) -> &[Attribute]
Returns the attributes of the mesh.
Sourcepub fn get_faces(&self) -> &[[PointIdx; 3]]
pub fn get_faces(&self) -> &[[PointIdx; 3]]
Returns the faces of the mesh as point-index triples.
Sourcepub fn get_attributes_mut(&mut self) -> &mut [Attribute]
pub fn get_attributes_mut(&mut self) -> &mut [Attribute]
Returns the attributes of the mesh mutably.
Sourcepub fn get_attributes_mut_by_indices<'a>(
&'a mut self,
indices: &[usize],
) -> Vec<&'a mut Attribute>
pub fn get_attributes_mut_by_indices<'a>( &'a mut self, indices: &[usize], ) -> Vec<&'a mut Attribute>
Returns mutable references to the attributes at the given indices.
The indices must be pairwise distinct; duplicate indices would produce two mutable references to the same attribute. Panics if any index is out of bounds.
Sourcepub fn diff_l2_norm(&self, other: &Mesh) -> f64
pub fn diff_l2_norm(&self, other: &Mesh) -> f64
Computes a symmetric point-to-surface L2 distance between the position
attributes of self and other, normalized by the total number of
points. Panics if a position attribute does not have three float
components.
Source§impl Mesh
impl Mesh
Sourcepub fn into_point_cloud(self) -> Result<PointCloud, Err>
pub fn into_point_cloud(self) -> Result<PointCloud, Err>
Drops the faces, materializing one attribute value per point.