Trait zoom::vector::Vector
[−]
[src]
pub trait Vector<D>: Sized + Clone + Copy + Zero + Add<Self, Output=Self> + Sub<Self, Output=Self> + Neg<Output=Self> + Mul<D, Output=Self> + Div<D, Output=Self> where D: Float { fn space_ball(d: D) -> D; fn dot(lhs: &Self, rhs: &Self) -> D; fn space_box(&self) -> D; fn displacement(&self) -> D; fn displacement_squared(&self) -> D { ... } fn normalized(&self) -> Self { ... } fn normalize(&mut self) { ... } }
Trait that implements all the functions necessary for any n-dimensional particle.
Required Methods
fn space_ball(d: D) -> D
Returns the space contained by an n-sphere with edge displacement d in the dimensional system of this vector
fn dot(lhs: &Self, rhs: &Self) -> D
Returns the result of the cos of the angle between two vectors multiplied by their magnitudes
fn space_box(&self) -> D
Returns the space contained by the vector relative to the origin forming a box
fn displacement(&self) -> D
Returns the length of a vector
Provided Methods
fn displacement_squared(&self) -> D
Returns the squared length of a vector; this is more efficient than displacement() for cartesian vectors
fn normalized(&self) -> Self
Returns a vector in the same direction as this one, but with length 1
fn normalize(&mut self)
Make this vector normalized().
Implementors
impl<D> Vector<D> for Cartesian1<D> where D: Float + FromPrimitive
impl<D> Vector<D> for Cartesian2<D> where D: Float + FromPrimitive
impl<D> Vector<D> for Cartesian3<D> where D: Float + FromPrimitive