Struct nalgebra::Quat [] [src]

pub struct Quat<N> {
    pub w: N,
    pub i: N,
    pub j: N,
    pub k: N,
}

A quaternion.

Fields

w: N

The scalar component of the quaternion.

i: N

The first vector component of the quaternion.

j: N

The second vector component of the quaternion.

k: N

The third vector component of the quaternion.

Methods

impl<N> Quat<N>
[src]

fn new(w: N, i: N, j: N, k: N) -> Quat<N>

Creates a new quaternion from its components.

fn vector<'a>(&'a self) -> &'a Vec3<N>

The vector part (i, j, k) of this quaternion.

fn scalar<'a>(&'a self) -> &'a N

The scalar part w of this quaternion.

impl<N: Neg<Output=N> + Copy> Quat<N>
[src]

fn conjugate(&self) -> Quat<N>

Compute the conjugate of this quaternion.

fn conjugate_mut(&mut self)

Replaces this quaternion by its conjugate.

impl<N: Zero + One> Quat<N>
[src]

fn w() -> Quat<N>

Create a unit vector with its $compN component equal to 1.0.

fn i() -> Quat<N>

Create a unit vector with its $compN component equal to 1.0.

fn j() -> Quat<N>

Create a unit vector with its $compN component equal to 1.0.

fn k() -> Quat<N>

Create a unit vector with its $compN component equal to 1.0.

impl<N> Quat<N>
[src]

fn as_array(&self) -> &[N; 4]

View this vector as an array.

fn as_array_mut(&mut self) -> &mut [N; 4]

View this vector as a mutable array.

fn from_array_ref(array: &[N; 4]) -> &Quat<N>

View an array as a vector.

fn from_array_mut(array: &mut [N; 4]) -> &mut Quat<N>

View an array as a vector.

impl<N: Copy> Quat<N>
[src]

unsafe fn at_fast(&self, i: usize) -> N

Unsafe read access to a vector element by index.

unsafe fn set_fast(&mut self, i: usize, val: N)

Unsafe write access to a vector element by index.

impl<N> Quat<N>
[src]

fn len(&self) -> usize

Trait Implementations

impl<N: Copy> Copy for Quat<N>
[src]

impl<N: Debug> Debug for Quat<N>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<N: Hash> Hash for Quat<N>
[src]

fn hash<__HN: Hasher>(&self, __arg_0: &mut __HN)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl<N: Clone> Clone for Quat<N>
[src]

fn clone(&self) -> Quat<N>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<N: Decodable> Decodable for Quat<N>
[src]

fn decode<__DN: Decoder>(__arg_0: &mut __DN) -> Result<Quat<N>, __DN::Error>

impl<N: Encodable> Encodable for Quat<N>
[src]

fn encode<__SN: Encoder>(&self, __arg_0: &mut __SN) -> Result<(), __SN::Error>

impl<N: PartialEq> PartialEq for Quat<N>
[src]

fn eq(&self, __arg_0: &Quat<N>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Quat<N>) -> bool

This method tests for !=.

impl<N: Eq> Eq for Quat<N>
[src]

impl<N: BaseFloat + ApproxEq<N>> Inv for Quat<N>
[src]

fn inv(&self) -> Option<Quat<N>>

Returns the inverse of m.

fn inv_mut(&mut self) -> bool

In-place version of inverse.

impl<N: BaseFloat> Norm<N> for Quat<N>
[src]

fn sqnorm(&self) -> N

Computes the squared norm of self. Read more

fn normalize(&self) -> Quat<N>

Gets the normalized version of a copy of v.

fn normalize_mut(&mut self) -> N

Normalizes self.

fn norm(&self) -> N

Computes the norm of self.

impl<N> Mul<Quat<N>> for Quat<N> where N: Copy + Mul<N, Output=N> + Sub<N, Output=N> + Add<N, Output=N>
[src]

type Output = Quat<N>

The resulting type after applying the * operator

fn mul(self, right: Quat<N>) -> Quat<N>

The method for the * operator

impl<N: ApproxEq<N> + BaseFloat> Div<Quat<N>> for Quat<N>
[src]

type Output = Quat<N>

The resulting type after applying the / operator

fn div(self, right: Quat<N>) -> Quat<N>

The method for the / operator

impl<N: Rand> Rand for Quat<N>
[src]

fn rand<R: Rng>(rng: &mut R) -> Quat<N>

Generates a random instance of this type using the specified source of randomness. Read more

impl<N: BaseFloat> POrd for Quat<N>
[src]

fn inf(&self, other: &Quat<N>) -> Quat<N>

Returns the infimum of this value and another

fn sup(&self, other: &Quat<N>) -> Quat<N>

Returns the supremum of this value and another

fn partial_cmp(&self, other: &Quat<N>) -> POrdering

Compare self and other using a partial ordering relation.

fn partial_lt(&self, other: &Quat<N>) -> bool

Returns true iff self and other are comparable and self < other.

fn partial_le(&self, other: &Quat<N>) -> bool

Returns true iff self and other are comparable and self <= other.

fn partial_gt(&self, other: &Quat<N>) -> bool

Returns true iff self and other are comparable and self > other.

fn partial_ge(&self, other: &Quat<N>) -> bool

Returns true iff self and other are comparable and self >= other.

fn partial_min<'a>(&'a self, other: &'a Self) -> Option<&'a Self>

Return the minimum of self and other if they are comparable.

fn partial_max<'a>(&'a self, other: &'a Self) -> Option<&'a Self>

Return the maximum of self and other if they are comparable.

fn partial_clamp<'a>(&'a self, min: &'a Self, max: &'a Self) -> Option<&'a Self>

Clamp value between min and max. Returns None if value is not comparable to min or max. Read more

impl<Nin: Copy, Nout: Copy + Cast<Nin>> Cast<Quat<Nin>> for Quat<Nout>
[src]

fn from(v: Quat<Nin>) -> Quat<Nout>

Converts an element of type T to an element of type Self.

impl<N> Index<usize> for Quat<N>
[src]

type Output = N

The returned type after indexing

fn index(&self, i: usize) -> &N

The method for the indexing (Foo[Bar]) operation

impl<N> IndexMut<usize> for Quat<N>
[src]

fn index_mut(&mut self, i: usize) -> &mut N

The method for the indexing (Foo[Bar]) operation

impl<N> Shape<usize> for Quat<N>
[src]

fn shape(&self) -> usize

Returns the shape of an indexable object.

impl<N: Copy> Indexable<usize, N> for Quat<N>
[src]

fn swap(&mut self, i1: usize, i2: usize)

Swaps the i-th element of self with its j-th element.

unsafe fn unsafe_at(&self, i: usize) -> N

Reads the i-th element of self. Read more

unsafe fn unsafe_set(&mut self, i: usize, val: N)

Writes to the i-th element of self. Read more

impl<N: Copy> Repeat<N> for Quat<N>
[src]

fn repeat(val: N) -> Quat<N>

Creates a new vector with all its components equal to a given value.

impl<N> Dim for Quat<N>
[src]

fn dim(_: Option<Quat<N>>) -> usize

The dimension of the object.

impl<N: Add<N, Output=N>> Add<Quat<N>> for Quat<N>
[src]

type Output = Quat<N>

The resulting type after applying the + operator

fn add(self, right: Quat<N>) -> Quat<N>

The method for the + operator

impl<N: Sub<N, Output=N>> Sub<Quat<N>> for Quat<N>
[src]

type Output = Quat<N>

The resulting type after applying the - operator

fn sub(self, right: Quat<N>) -> Quat<N>

The method for the - operator

impl<N: Copy + Add<N, Output=N>> Add<N> for Quat<N>
[src]

type Output = Quat<N>

The resulting type after applying the + operator

fn add(self, right: N) -> Quat<N>

The method for the + operator

impl<N: Copy + Sub<N, Output=N>> Sub<N> for Quat<N>
[src]

type Output = Quat<N>

The resulting type after applying the - operator

fn sub(self, right: N) -> Quat<N>

The method for the - operator

impl<N: Copy + Mul<N, Output=N>> Mul<N> for Quat<N>
[src]

type Output = Quat<N>

The resulting type after applying the * operator

fn mul(self, right: N) -> Quat<N>

The method for the * operator

impl<N: Copy + Div<N, Output=N>> Div<N> for Quat<N>
[src]

type Output = Quat<N>

The resulting type after applying the / operator

fn div(self, right: N) -> Quat<N>

The method for the / operator

impl<N: Neg<Output=N> + Copy> Neg for Quat<N>
[src]

type Output = Quat<N>

The resulting type after applying the - operator

fn neg(self) -> Quat<N>

The method for the unary - operator

impl<N> One for Quat<N> where N: Copy + One + Sub<N, Output=N> + Add<N, Output=N>
[src]

fn one() -> Quat<N>

Returns the multiplicative identity element of Self, 1. Read more

impl<N: Zero> Zero for Quat<N>
[src]

fn zero() -> Quat<N>

Returns the additive identity element of Self, 0. Read more

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.

impl<N: ApproxEq<N>> ApproxEq<N> for Quat<N>
[src]

fn approx_epsilon(_: Option<Quat<N>>) -> N

Default epsilon for approximation.

fn approx_ulps(_: Option<Quat<N>>) -> u32

Default ULPs for approximation.

fn approx_eq(&self, other: &Quat<N>) -> bool

Tests approximate equality.

fn approx_eq_eps(&self, other: &Quat<N>, eps: &N) -> bool

Tests approximate equality using a custom epsilon.

fn approx_eq_ulps(&self, other: &Quat<N>, ulps: u32) -> bool

Tests approximate equality using units in the last place (ULPs)

impl<N> FromIterator<N> for Quat<N>
[src]

fn from_iter<I: IntoIterator<Item=N>>(iterator: I) -> Quat<N>

Creates a value from an iterator. Read more

impl<N: Bounded> Bounded for Quat<N>
[src]

fn max_value() -> Quat<N>

The maximum value.

fn min_value() -> Quat<N>

The minimum value.

impl<N: Axpy<N>> Axpy<N> for Quat<N>
[src]

fn axpy(&mut self, a: &N, x: &Quat<N>)

Adds $$a * x$$ to self.

impl<N> Iterable<N> for Quat<N>
[src]

fn iter<'l>(&'l self) -> Iter<'l, N>

Gets a vector-like read-only iterator.

impl<N> IterableMut<N> for Quat<N>
[src]

fn iter_mut<'l>(&'l mut self) -> IterMut<'l, N>

Gets a vector-like read-write iterator.