[][src]Trait cgmath::prelude::InnerSpace

pub trait InnerSpace: VectorSpace where
    Self: MetricSpace<Metric = Self::Scalar>, 
{ pub fn dot(self, other: Self) -> Self::Scalar; pub fn is_perpendicular(self, other: Self) -> bool
    where
        Self::Scalar: UlpsEq
, { ... }
pub fn magnitude2(self) -> Self::Scalar { ... }
pub fn angle(self, other: Self) -> Rad<Self::Scalar>
    where
        Self::Scalar: BaseFloat
, { ... }
pub fn project_on(self, other: Self) -> Self { ... }
pub fn magnitude(self) -> Self::Scalar
    where
        Self::Scalar: Float
, { ... }
pub fn normalize(self) -> Self
    where
        Self::Scalar: Float
, { ... }
pub fn normalize_to(self, magnitude: Self::Scalar) -> Self
    where
        Self::Scalar: Float
, { ... } }

Vectors that also have a dot (or inner) product.

The dot product allows for the definition of other useful operations, like finding the magnitude of a vector or normalizing it.

Examples include vectors and quaternions.

Required methods

pub fn dot(self, other: Self) -> Self::Scalar[src]

Vector dot (or inner) product.

Loading content...

Provided methods

pub fn is_perpendicular(self, other: Self) -> bool where
    Self::Scalar: UlpsEq
[src]

Returns true if the vector is perpendicular (at right angles) to the other vector.

pub fn magnitude2(self) -> Self::Scalar[src]

Returns the squared magnitude.

This does not perform an expensive square root operation like in InnerSpace::magnitude method, and so can be used to compare magnitudes more efficiently.

pub fn angle(self, other: Self) -> Rad<Self::Scalar> where
    Self::Scalar: BaseFloat
[src]

Returns the angle between two vectors in radians.

pub fn project_on(self, other: Self) -> Self[src]

Returns the vector projection of the current inner space projected onto the supplied argument.

pub fn magnitude(self) -> Self::Scalar where
    Self::Scalar: Float
[src]

The distance from the tail to the tip of the vector.

pub fn normalize(self) -> Self where
    Self::Scalar: Float
[src]

Returns a vector with the same direction, but with a magnitude of 1.

pub fn normalize_to(self, magnitude: Self::Scalar) -> Self where
    Self::Scalar: Float
[src]

Returns a vector with the same direction and a given magnitude.

Loading content...

Implementors

impl<S: BaseFloat> InnerSpace for Quaternion<S>[src]

impl<S: BaseNum> InnerSpace for Vector1<S>[src]

impl<S: BaseNum> InnerSpace for Vector2<S>[src]

impl<S: BaseNum> InnerSpace for Vector3<S>[src]

impl<S: BaseNum> InnerSpace for Vector4<S>[src]

Loading content...