logo
pub struct LruIndexer<T, K> where
    T: Topological,
    K: Clone + PartialEq
{ /* private fields */ }
Expand description

LRU caching vertex indexer.

This indexer uses a least recently used (LRU) cache to form an index. To function correctly, an adequate cache capacity is necessary. If the capacity is insufficient, then redundant vertex data may be emitted. See LruIndexer::with_capacity.

This indexer is useful if the vertex key data does not implement Hash. If the key data can be hashed, prefer HashIndexer instead.

Examples

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

let (indices, positions) = UvSphere::new(8, 8)
    .polygons::<Position<Point3<f64>>>()
    .triangulate()
    .index_vertices::<Flat3, _>(LruIndexer::with_capacity(64));

Implementations

Creates a new LruIndexer with a default capacity.

Creates a new LruIndexer with the specified capacity.

The capacity of the cache must be sufficient in order to generate a unique set of index and vertex data.

Trait Implementations

Returns the “default value” for a type. Read more

Indexes a vertex using a keying function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

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

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

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.