Struct cgmath::Vector4 [] [src]

pub struct Vector4<S> {
    pub x: S,
    pub y: S,
    pub z: S,
    pub w: S,
}

Fields

x
y
z
w

Methods

impl<S> Vector4<S>

fn new(x: S, y: S, z: S, w: S) -> Vector4<S>

Construct a new vector, using the provided values.

impl<S: Copy + Neg<Output=S>> Vector4<S>

fn neg_self(&mut self)

Negate this vector in-place (multiply by -1).

impl<S: NumCast + Copy> Vector4<S>

fn cast<T: NumCast>(&self) -> Vector4<T>

Component-wise casting to another type

impl<S: BaseNum> Vector4<S>

Operations specific to numeric four-dimensional vectors.

fn unit_x() -> Vector4<S>

A unit vector in the x direction.

fn unit_y() -> Vector4<S>

A unit vector in the y direction.

fn unit_z() -> Vector4<S>

A unit vector in the z direction.

fn unit_w() -> Vector4<S>

A unit vector in the w direction.

fn truncate(&self) -> Vector3<S>

Create a Vector3, dropping the w value.

fn truncate_n(&self, n: isize) -> Vector3<S>

Create a Vector3, dropping the nth element

Trait Implementations

impl<S: Zero + BaseNum> Zero for Vector4<S>

fn zero() -> Vector4<S>

fn is_zero(&self) -> bool

impl<S: One + BaseNum> One for Vector4<S>

fn one() -> Vector4<S>

impl<S> FixedArray<[S; 4]> for Vector4<S>

fn into_fixed(self) -> [S; 4]

fn as_fixed<'a>(&'a self) -> &'a [S; 4]

fn as_mut_fixed<'a>(&'a mut self) -> &'a mut [S; 4]

fn from_fixed(_v: [S; 4]) -> Vector4<S>

fn from_fixed_ref<'a>(v: &'a [S; 4]) -> &'a Vector4<S>

fn from_fixed_mut<'a>(v: &'a mut [S; 4]) -> &'a mut Vector4<S>

impl<S: Copy> Index<usize> for Vector4<S>

type Output = S

fn index<'a>(&'a self, i: usize) -> &'a S

impl<S: Copy> IndexMut<usize> for Vector4<S>

fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut S

impl<S: Copy> Array1<S> for Vector4<S>

fn map<F>(&mut self, op: F) -> Vector4<S> where F: FnMut(S) -> S

fn ptr<'a>(&'a self) -> &'a Element

fn mut_ptr<'a>(&'a mut self) -> &'a mut Element

fn swap_elems(&mut self, i: usize, j: usize)

fn replace_elem(&mut self, i: usize, src: Element) -> Element

impl<S: BaseNum> Vector<S> for Vector4<S>

fn from_value(s: S) -> Vector4<S>

fn add_s(&self, s: S) -> Vector4<S>

fn sub_s(&self, s: S) -> Vector4<S>

fn mul_s(&self, s: S) -> Vector4<S>

fn div_s(&self, s: S) -> Vector4<S>

fn rem_s(&self, s: S) -> Vector4<S>

fn add_v(&self, v: &Vector4<S>) -> Vector4<S>

fn sub_v(&self, v: &Vector4<S>) -> Vector4<S>

fn mul_v(&self, v: &Vector4<S>) -> Vector4<S>

fn div_v(&self, v: &Vector4<S>) -> Vector4<S>

fn rem_v(&self, v: &Vector4<S>) -> Vector4<S>

fn add_self_s(&mut self, s: S)

fn sub_self_s(&mut self, s: S)

fn mul_self_s(&mut self, s: S)

fn div_self_s(&mut self, s: S)

fn rem_self_s(&mut self, s: S)

fn add_self_v(&mut self, v: &Vector4<S>)

fn sub_self_v(&mut self, v: &Vector4<S>)

fn mul_self_v(&mut self, v: &Vector4<S>)

fn div_self_v(&mut self, v: &Vector4<S>)

fn rem_self_v(&mut self, v: &Vector4<S>)

fn comp_add(&self) -> S

fn comp_mul(&self) -> S

fn comp_min(&self) -> S

fn comp_max(&self) -> S

fn dot(&self, v: &Self) -> S

impl<S: BaseNum> Add for Vector4<S>

type Output = Vector4<S>

fn add(self, v: Vector4<S>) -> Vector4<S>

impl<S: BaseNum> Sub for Vector4<S>

type Output = Vector4<S>

fn sub(self, v: Vector4<S>) -> Vector4<S>

impl<S: Neg<Output=S>> Neg for Vector4<S>

type Output = Vector4<S>

fn neg(self) -> Vector4<S>

impl<S: BaseNum> Mul for Vector4<S>

type Output = Vector4<S>

fn mul(self, v: Vector4<S>) -> Vector4<S>

impl<S: BaseNum> Div for Vector4<S>

type Output = Vector4<S>

fn div(self, v: Vector4<S>) -> Vector4<S>

impl<S: BaseNum> Rem for Vector4<S>

type Output = Vector4<S>

fn rem(self, v: Vector4<S>) -> Vector4<S>

impl<S: BaseFloat> ApproxEq<S> for Vector4<S>

fn approx_eq_eps(&self, other: &Vector4<S>, epsilon: &S) -> bool

fn approx_epsilon(_hack: Option<Self>) -> T

fn approx_eq(&self, other: &Self) -> bool

impl<S: BaseFloat + Rand> Rand for Vector4<S>

fn rand<R: Rng>(rng: &mut R) -> Vector4<S>

impl<S: BaseFloat> EuclideanVector<S> for Vector4<S>

fn angle(&self, other: &Vector4<S>) -> Rad<S>

fn is_perpendicular(&self, other: &Self) -> bool

fn length2(&self) -> S

fn length(&self) -> S

fn normalize(&self) -> Self

fn normalize_to(&self, length: S) -> Self

fn lerp(&self, other: &Self, amount: S) -> Self

fn normalize_self(&mut self)

fn normalize_self_to(&mut self, length: S)

fn lerp_self(&mut self, other: &Self, amount: S)

impl<S: BaseNum> Debug for Vector4<S>

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

Derived Implementations

impl<S: Decodable> Decodable for Vector4<S>

fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Vector4<S>, __D::Error>

impl<S: Encodable> Encodable for Vector4<S>

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

impl<S: Hash> Hash for Vector4<S>

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

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

impl<S: Clone> Clone for Vector4<S>

fn clone(&self) -> Vector4<S>

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

impl<S: Copy> Copy for Vector4<S>

impl<S: Eq> Eq for Vector4<S>

impl<S: PartialEq> PartialEq for Vector4<S>

fn eq(&self, __arg_0: &Vector4<S>) -> bool

fn ne(&self, __arg_0: &Vector4<S>) -> bool