Struct nalgebra::na::PVec3
pub struct PVec3<N> { x: N, y: N, z: N, // some fields omitted }
Vector of dimension 3 with an extra component for padding.
Fields
x | First component of the vector. |
y | Second component of the vector. |
z | Third component of the vector. |
Methods
impl<N: Clone> PVec3<N>
fn new(x: N, y: N, z: N) -> PVec3<N>
Creates a new 3d vector.
impl<N: Zero + One> PVec3<N>
fn x() -> PVec3<N>
Create a unit vector with its $comp0
component equal to 1.0.
fn y() -> PVec3<N>
Create a unit vector with its $compN
component equal to 1.0.
fn z() -> PVec3<N>
Create a unit vector with its $compN
component equal to 1.0.
impl<N: Clone> PVec3<N>
unsafe fn at_fast(&self, i: uint) -> N
Unsafe read access to a vector element by index.
unsafe fn set_fast(&mut self, i: uint, val: N)
Unsafe write access to a vector element by index.
impl<N: Clone> PVec3<N>
fn new_repeat(val: N) -> PVec3<N>
Creates a new vector with all its components equal to a given value.
Trait Implementations
impl<N: Eq> Eq for PVec3<N>
Automatically derived.
impl<__E: Encoder, N: Encodable<__E>> Encodable<__E> for PVec3<N>
Automatically derived.
fn encode(&self, __arg_0: &mut __E)
impl<__D: Decoder, N: Decodable<__D>> Decodable<__D> for PVec3<N>
Automatically derived.
fn decode(__arg_0: &mut __D) -> PVec3<N>
impl<N: Clone> Clone for PVec3<N>
Automatically derived.
fn clone(&self) -> PVec3<N>
impl<N: DeepClone> DeepClone for PVec3<N>
Automatically derived.
fn deep_clone(&self) -> PVec3<N>
impl<N: IterBytes> IterBytes for PVec3<N>
Automatically derived.
fn iter_bytes(&self, __arg_0: bool, __arg_1: Cb) -> bool
impl<N: Rand> Rand for PVec3<N>
Automatically derived.
impl<N: Zero> Zero for PVec3<N>
Automatically derived.
fn zero() -> PVec3<N>
fn is_zero(&self) -> bool
impl<N: ToStr> ToStr for PVec3<N>
Automatically derived.
fn to_str(&self) -> ~str
impl<N, Rhs: PVec3MulRhs<N, Res>, Res> Mul<Rhs, Res> for PVec3<N>
fn mul(&self, other: &Rhs) -> Res
impl<N, Rhs: PVec3DivRhs<N, Res>, Res> Div<Rhs, Res> for PVec3<N>
fn div(&self, other: &Rhs) -> Res
impl<N, Rhs: PVec3AddRhs<N, Res>, Res> Add<Rhs, Res> for PVec3<N>
fn add(&self, other: &Rhs) -> Res
impl<N, Rhs: PVec3SubRhs<N, Res>, Res> Sub<Rhs, Res> for PVec3<N>
fn sub(&self, other: &Rhs) -> Res
impl<T: PVec3Cast<N>, N> Cast<T> for PVec3<N>
fn from(t: T) -> PVec3<N>
Converts an element of type T
to an element of type Self
.
impl<N: Ord> Ord for PVec3<N>
fn lt(&self, other: &PVec3<N>) -> bool
fn le(&self, other: &PVec3<N>) -> bool
fn gt(&self, other: &PVec3<N>) -> bool
fn ge(&self, other: &PVec3<N>) -> bool
impl<N: Clone + Orderable> Orderable for PVec3<N>
fn max(&self, other: &PVec3<N>) -> PVec3<N>
fn min(&self, other: &PVec3<N>) -> PVec3<N>
fn clamp(&self, min: &PVec3<N>, max: &PVec3<N>) -> PVec3<N>
impl<Nin: Clone, Nout: Clone + Cast<Nin>> PVec3Cast<Nout> for PVec3<Nin>
impl<N: Clone> Indexable<uint, N> for PVec3<N>
fn at(&self, i: uint) -> N
Reads the i
-th element of self
.
fn set(&mut self, i: uint, val: N)
Writes to the i
-th element of self
.
fn swap(&mut self, i1: uint, i2: uint)
Swaps the i
-th element of self
with its j
-th element.
unsafe fn unsafe_at(&self, i: uint) -> N
Reads the i
-th element of self
.
i
is not checked.
unsafe fn unsafe_set(&mut self, i: uint, val: N)
Writes to the i
-th element of self
.
i
is not checked.
impl<N> Dim for PVec3<N>
impl<N> Container for PVec3<N>
fn len(&self) -> uint
impl<N: Clone + Add<N, N>> PVec3AddRhs<N, PVec3<N>> for PVec3<N>
impl<N: Clone + Sub<N, N>> PVec3SubRhs<N, PVec3<N>> for PVec3<N>
impl<N: Clone + Mul<N, N>> PVec3MulRhs<N, PVec3<N>> for PVec3<N>
impl<N: Clone + Div<N, N>> PVec3DivRhs<N, PVec3<N>> for PVec3<N>
impl<N: Clone + Neg<N>> Neg<PVec3<N>> for PVec3<N>
fn neg(&self) -> PVec3<N>
impl<N: Num + Clone> Dot<N> for PVec3<N>
fn dot(a: &PVec3<N>, b: &PVec3<N>) -> N
Computes the dot (inner) product of two vectors.
fn sub_dot(a: &PVec3<N>, b: &PVec3<N>, c: &PVec3<N>) -> N
Short-cut to compute the projection of a point on a vector, but without computing intermediate vectors. The following equation must be verified:
a.sub_dot(b, c) == (a - b).dot(c)
impl<N: Clone + Add<N, N> + Neg<N>> Translation<PVec3<N>> for PVec3<N>
fn translation(&self) -> PVec3<N>
Gets the translation associated with this object.
fn inv_translation(&self) -> PVec3<N>
Gets the inverse translation associated with this object.
fn append_translation(&mut self, t: &PVec3<N>)
Appends a translation to this object.
fn append_translation_cpy(transform: &PVec3<N>, t: &PVec3<N>) -> PVec3<N>
Appends the translation amount
to a copy of t
.
fn prepend_translation(&mut self, t: &PVec3<N>)
Prepends a translation to this object.
fn prepend_translation_cpy(transform: &PVec3<N>, t: &PVec3<N>) -> PVec3<N>
Prepends the translation amount
to a copy of t
.
fn set_translation(&mut self, t: PVec3<N>)
Sets the translation.
impl<N: Clone + Num + Real> Norm<N> for PVec3<N>
fn sqnorm(v: &PVec3<N>) -> N
Computes the squared norm of self
.
This is usually faster than computing the norm itself.
fn norm(v: &PVec3<N>) -> N
Computes the norm of self
.
fn normalize_cpy(v: &PVec3<N>) -> PVec3<N>
Gets the normalized version of a copy of v
.
fn normalize(&mut self) -> N
Normalizes self
.
impl<N: ApproxEq<N>> ApproxEq<N> for PVec3<N>
fn approx_epsilon(_: Option<PVec3<N>>) -> N
Default epsilon for approximation.
fn approx_eq(a: &PVec3<N>, b: &PVec3<N>) -> bool
Tests approximate equality.
fn approx_eq_eps(a: &PVec3<N>, b: &PVec3<N>, eps: &N) -> bool
Tests approximate equality using a custom epsilon.
impl<N: Clone + Round> Round for PVec3<N>
fn floor(&self) -> PVec3<N>
fn ceil(&self) -> PVec3<N>
fn round(&self) -> PVec3<N>
fn trunc(&self) -> PVec3<N>
fn fract(&self) -> PVec3<N>
impl<N: Clone + One> One for PVec3<N>
fn one() -> PVec3<N>
impl<N: Clone> FromIterator<N> for PVec3<N>
impl<N: Bounded + Clone> Bounded for PVec3<N>
impl<N> Iterable<N> for PVec3<N>
fn iter<'l>(&'l self) -> Items<'l, N>
Gets a vector-like read-only iterator.
impl<N> IterableMut<N> for PVec3<N>
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N>
Gets a vector-like read-write iterator.
impl<N: Clone + One + Zero> ToHomogeneous<Vec4<N>> for PVec3<N>
impl<N: Clone + Div<N, N> + One + Zero> FromHomogeneous<Vec4<N>> for PVec3<N>
fn from(v: &Vec4<N>) -> PVec3<N>
Builds an object from its homogeneous coordinate form.
Note that this this is not required that from
is the inverse of to_homogeneous
.
Typically, from
will remove some informations unrecoverable by to_homogeneous
.
impl<N: Clone + Add<N, N> + Sub<N, N>> Translate<PVec3<N>> for PVec3<N>
fn translate(&self, other: &PVec3<N>) -> PVec3<N>
Apply a translation to an object.
fn inv_translate(&self, other: &PVec3<N>) -> PVec3<N>
Apply an inverse translation to an object.
impl<N, O: Clone> Rotate<O> for PVec3<N>
fn rotate(&self, other: &O) -> O
Applies a rotation to v
.
fn inv_rotate(&self, other: &O) -> O
Applies an inverse rotation to v
.