Struct nalgebra::Quaternion
[−]
[src]
pub struct Quaternion<N> { pub w: N, pub i: N, pub j: N, pub k: N, }
A quaternion. See UnitQuaternion
for a quaternion that can be used as a rotation.
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> Quaternion<N>
[src]
fn new(w: N, i: N, j: N, k: N) -> Quaternion<N>
Creates a new quaternion from its components.
fn vector<'a>(&'a self) -> &'a Vector3<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> Quaternion<N>
[src]
fn conjugate(&self) -> Quaternion<N>
Compute the conjugate of this quaternion.
fn conjugate_mut(&mut self)
Replaces this quaternion by its conjugate.
impl<N: Zero + One> Quaternion<N>
[src]
fn w() -> Quaternion<N>
Create a unit vector with its $compN
component equal to 1.0.
fn i() -> Quaternion<N>
Create a unit vector with its $compN
component equal to 1.0.
fn j() -> Quaternion<N>
Create a unit vector with its $compN
component equal to 1.0.
fn k() -> Quaternion<N>
Create a unit vector with its $compN
component equal to 1.0.
impl<N: Copy> Quaternion<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> Quaternion<N>
[src]
Trait Implementations
impl<N: Eq> Eq for Quaternion<N>
[src]
impl<N: PartialEq> PartialEq for Quaternion<N>
[src]
fn eq(&self, __arg_0: &Quaternion<N>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Quaternion<N>) -> bool
This method tests for !=
.
impl<N: Encodable> Encodable for Quaternion<N>
[src]
impl<N: Decodable> Decodable for Quaternion<N>
[src]
fn decode<__DN: Decoder>(__arg_0: &mut __DN) -> Result<Quaternion<N>, __DN::Error>
impl<N: Clone> Clone for Quaternion<N>
[src]
fn clone(&self) -> Quaternion<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: Hash> Hash for Quaternion<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: Debug> Debug for Quaternion<N>
[src]
impl<N: Copy> Copy for Quaternion<N>
[src]
impl<N: BaseFloat + ApproxEq<N>> Inverse for Quaternion<N>
[src]
fn inverse(&self) -> Option<Quaternion<N>>
Returns the inverse of m
.
fn inverse_mut(&mut self) -> bool
In-place version of inverse
.
impl<N: BaseFloat> Norm<N> for Quaternion<N>
[src]
fn norm_squared(&self) -> N
Computes the squared norm of self
. Read more
fn normalize(&self) -> Quaternion<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<Quaternion<N>> for Quaternion<N> where N: Copy + Mul<N, Output=N> + Sub<N, Output=N> + Add<N, Output=N>
[src]
type Output = Quaternion<N>
The resulting type after applying the *
operator
fn mul(self, right: Quaternion<N>) -> Quaternion<N>
The method for the *
operator
impl<N> MulAssign<Quaternion<N>> for Quaternion<N> where N: Copy + Mul<N, Output=N> + Sub<N, Output=N> + Add<N, Output=N>
[src]
fn mul_assign(&mut self, right: Quaternion<N>)
The method for the *=
operator
impl<N: ApproxEq<N> + BaseFloat> Div<Quaternion<N>> for Quaternion<N>
[src]
type Output = Quaternion<N>
The resulting type after applying the /
operator
fn div(self, right: Quaternion<N>) -> Quaternion<N>
The method for the /
operator
impl<N: ApproxEq<N> + BaseFloat> DivAssign<Quaternion<N>> for Quaternion<N>
[src]
fn div_assign(&mut self, right: Quaternion<N>)
The method for the /=
operator
impl<N: Display> Display for Quaternion<N>
[src]
impl<N: Rand> Rand for Quaternion<N>
[src]
fn rand<R: Rng>(rng: &mut R) -> Quaternion<N>
Generates a random instance of this type using the specified source of randomness. Read more
impl<N: BaseFloat> PartialOrder for Quaternion<N>
[src]
fn inf(&self, other: &Quaternion<N>) -> Quaternion<N>
Returns the infimum of this value and another
fn sup(&self, other: &Quaternion<N>) -> Quaternion<N>
Returns the supremum of this value and another
fn partial_cmp(&self, other: &Quaternion<N>) -> PartialOrdering
Compare self
and other
using a partial ordering relation.
fn partial_lt(&self, other: &Quaternion<N>) -> bool
Returns true
iff self
and other
are comparable and self < other
.
fn partial_le(&self, other: &Quaternion<N>) -> bool
Returns true
iff self
and other
are comparable and self <= other
.
fn partial_gt(&self, other: &Quaternion<N>) -> bool
Returns true
iff self
and other
are comparable and self > other
.
fn partial_ge(&self, other: &Quaternion<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<Quaternion<Nin>> for Quaternion<Nout>
[src]
fn from(v: Quaternion<Nin>) -> Quaternion<Nout>
Converts an element of type T
to an element of type Self
.
impl<N> AsRef<[N; 4]> for Quaternion<N>
[src]
impl<N> AsMut<[N; 4]> for Quaternion<N>
[src]
impl<'a, N> From<&'a [N; 4]> for &'a Quaternion<N>
[src]
fn from(arr: &'a [N; 4]) -> &'a Quaternion<N>
Performs the conversion.
impl<'a, N> From<&'a mut [N; 4]> for &'a mut Quaternion<N>
[src]
fn from(arr: &'a mut [N; 4]) -> &'a mut Quaternion<N>
Performs the conversion.
impl<'a, N: Clone> From<&'a [N; 4]> for Quaternion<N>
[src]
fn from(arr: &'a [N; 4]) -> Quaternion<N>
Performs the conversion.
impl<N, T> Index<T> for Quaternion<N> where [N]: Index<T>
[src]
type Output = [N]::Output
The returned type after indexing
fn index(&self, i: T) -> &[N]::Output
The method for the indexing (Foo[Bar]
) operation
impl<N, T> IndexMut<T> for Quaternion<N> where [N]: IndexMut<T>
[src]
impl<N> Shape<usize> for Quaternion<N>
[src]
impl<N: Copy> Indexable<usize, N> for Quaternion<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 Quaternion<N>
[src]
fn repeat(val: N) -> Quaternion<N>
Creates a new vector with all its components equal to a given value.
impl<N> Dimension for Quaternion<N>
[src]
fn dimension(_: Option<Quaternion<N>>) -> usize
The dimension of the object.
impl<N: Add<N, Output=N>> Add<Quaternion<N>> for Quaternion<N>
[src]
type Output = Quaternion<N>
The resulting type after applying the +
operator
fn add(self, right: Quaternion<N>) -> Quaternion<N>
The method for the +
operator
impl<N: AddAssign<N>> AddAssign<Quaternion<N>> for Quaternion<N>
[src]
fn add_assign(&mut self, right: Quaternion<N>)
The method for the +=
operator
impl<N: Sub<N, Output=N>> Sub<Quaternion<N>> for Quaternion<N>
[src]
type Output = Quaternion<N>
The resulting type after applying the -
operator
fn sub(self, right: Quaternion<N>) -> Quaternion<N>
The method for the -
operator
impl<N: SubAssign<N>> SubAssign<Quaternion<N>> for Quaternion<N>
[src]
fn sub_assign(&mut self, right: Quaternion<N>)
The method for the -=
operator
impl<N: Copy + Add<N, Output=N>> Add<N> for Quaternion<N>
[src]
type Output = Quaternion<N>
The resulting type after applying the +
operator
fn add(self, right: N) -> Quaternion<N>
The method for the +
operator
impl<N: Copy + AddAssign<N>> AddAssign<N> for Quaternion<N>
[src]
fn add_assign(&mut self, right: N)
The method for the +=
operator
impl<N: Copy + Sub<N, Output=N>> Sub<N> for Quaternion<N>
[src]
type Output = Quaternion<N>
The resulting type after applying the -
operator
fn sub(self, right: N) -> Quaternion<N>
The method for the -
operator
impl<N: Copy + SubAssign<N>> SubAssign<N> for Quaternion<N>
[src]
fn sub_assign(&mut self, right: N)
The method for the -=
operator
impl<N: Copy + Mul<N, Output=N>> Mul<N> for Quaternion<N>
[src]
type Output = Quaternion<N>
The resulting type after applying the *
operator
fn mul(self, right: N) -> Quaternion<N>
The method for the *
operator
impl<N: Copy + MulAssign<N>> MulAssign<N> for Quaternion<N>
[src]
fn mul_assign(&mut self, right: N)
The method for the *=
operator
impl<N: Copy + Div<N, Output=N>> Div<N> for Quaternion<N>
[src]
type Output = Quaternion<N>
The resulting type after applying the /
operator
fn div(self, right: N) -> Quaternion<N>
The method for the /
operator
impl<N: Copy + DivAssign<N>> DivAssign<N> for Quaternion<N>
[src]
fn div_assign(&mut self, right: N)
The method for the /=
operator
impl<N: Neg<Output=N> + Copy> Neg for Quaternion<N>
[src]
type Output = Quaternion<N>
The resulting type after applying the -
operator
fn neg(self) -> Quaternion<N>
The method for the unary -
operator
impl<N> One for Quaternion<N> where N: Copy + One + Sub<N, Output=N> + Add<N, Output=N>
[src]
fn one() -> Quaternion<N>
Returns the multiplicative identity element of Self
, 1
. Read more
impl<N: Zero> Zero for Quaternion<N>
[src]
fn zero() -> Quaternion<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 Quaternion<N>
[src]
fn approx_epsilon(_: Option<Quaternion<N>>) -> N
Default epsilon for approximation.
fn approx_ulps(_: Option<Quaternion<N>>) -> u32
Default ULPs for approximation.
fn approx_eq(&self, other: &Quaternion<N>) -> bool
Tests approximate equality.
fn approx_eq_eps(&self, other: &Quaternion<N>, eps: &N) -> bool
Tests approximate equality using a custom epsilon.
fn approx_eq_ulps(&self, other: &Quaternion<N>, ulps: u32) -> bool
Tests approximate equality using units in the last place (ULPs)
impl<N> FromIterator<N> for Quaternion<N>
[src]
fn from_iter<I: IntoIterator<Item=N>>(iterator: I) -> Quaternion<N>
Creates a value from an iterator. Read more
impl<N: Bounded> Bounded for Quaternion<N>
[src]
fn max_value() -> Quaternion<N>
The maximum value.
fn min_value() -> Quaternion<N>
The minimum value.
impl<N: Axpy<N>> Axpy<N> for Quaternion<N>
[src]
fn axpy(&mut self, a: &N, x: &Quaternion<N>)
Adds $$a * x$$ to self
.