[][src]Trait theon::AsPosition

pub trait AsPosition {
    type Position: EuclideanSpace;
    fn as_position(&self) -> &Self::Position;
fn as_position_mut(&mut self) -> &mut Self::Position; fn transform<F>(&mut self, f: F)
    where
        F: FnMut(&Self::Position) -> Self::Position
, { ... }
fn map_position<F>(self, f: F) -> Self
    where
        Self: Sized,
        F: FnMut(&Self::Position) -> Self::Position
, { ... } }

Positional data.

This trait exposes positional data for geometric types.

Examples

Exposing positional data for a vertex:

use nalgebra::{Point3, Vector3};
use theon::AsPosition;

pub struct Vertex {
    position: Point3<f64>,
    normal: Vector3<f64>,
}

impl AsPosition for Vertex {
    type Position = Point3<f64>;

    fn as_position(&self) -> &Self::Position {
        &self.position
    }

    fn as_position_mut(&mut self) -> &mut Self::Position {
        &mut self.position
    }
}

Associated Types

type Position: EuclideanSpace

Loading content...

Required methods

fn as_position(&self) -> &Self::Position

fn as_position_mut(&mut self) -> &mut Self::Position

Loading content...

Provided methods

fn transform<F>(&mut self, f: F) where
    F: FnMut(&Self::Position) -> Self::Position

fn map_position<F>(self, f: F) -> Self where
    Self: Sized,
    F: FnMut(&Self::Position) -> Self::Position

Loading content...

Implementors

impl<S> AsPosition for S where
    S: EuclideanSpace
[src]

type Position = Self

Loading content...