[][src]Trait plexus::FromRawBuffersWithArity

pub trait FromRawBuffersWithArity<N, G>: Sized {
    type Error: Debug;
    fn from_raw_buffers_with_arity<I, J>(
        indices: I,
        vertices: J,
        arity: usize
    ) -> Result<Self, Self::Error>
    where
        I: IntoIterator<Item = N>,
        J: IntoIterator<Item = G>
; }

Associated Types

type Error: Debug

Loading content...

Required methods

fn from_raw_buffers_with_arity<I, J>(
    indices: I,
    vertices: J,
    arity: usize
) -> Result<Self, Self::Error> where
    I: IntoIterator<Item = N>,
    J: IntoIterator<Item = G>, 

Loading content...

Implementors

impl<N, G, H> FromRawBuffersWithArity<N, H> for MeshGraph<G> where
    N: Integer + ToPrimitive + Unsigned,
    G: GraphGeometry,
    H: IntoGeometry<G::Vertex>, 
[src]

type Error = GraphError

fn from_raw_buffers_with_arity<I, J>(
    indices: I,
    vertices: J,
    arity: usize
) -> Result<Self, Self::Error> where
    I: IntoIterator<Item = N>,
    J: IntoIterator<Item = H>, 
[src]

Creates a MeshGraph from raw index and vertex buffers. The arity of the polygons in the index buffer must be known and constant.

Errors

Returns an error if the arity of the index buffer is not constant, any index is out of bounds, or there is an error inserting topology into the graph.

Examples

use nalgebra::Point3;
use plexus::graph::MeshGraph;
use plexus::index::{Flat3, LruIndexer};
use plexus::prelude::*;
use plexus::primitive::generate::Position;
use plexus::primitive::sphere::UvSphere;

let (indices, positions) = UvSphere::new(16, 16)
    .polygons::<Position<Point3<f64>>>()
    .triangulate()
    .index_vertices::<Flat3, _>(LruIndexer::with_capacity(256));
let mut graph =
    MeshGraph::<Point3<f64>>::from_raw_buffers_with_arity(indices, positions, 3).unwrap();
Loading content...