Trait theon::AsPosition
source · [−]pub trait AsPosition {
type Position: EuclideanSpace;
fn as_position(&self) -> &Self::Position;
}
Expand description
Immutable positional data.
This trait exposes positional data for geometric types along with its
mutable variant AsPositionMut
.
Examples
Exposing immutable 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
}
}