Struct cgmath::Vector4
[−]
[src]
pub struct Vector4<S> {
pub x: S,
pub y: S,
pub z: S,
pub w: S,
}A 4-dimensional vector.
This type is marked as #[repr(C, packed)].
Fields
x: S
The x component of the vector.
y: S
The y component of the vector.
z: S
The z component of the vector.
w: S
The w component of the vector.
Methods
impl<S> Vector4<S>[src]
impl<S: NumCast + Copy> Vector4<S>[src]
impl<S: BaseNum> Vector4<S>[src]
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: Hash> Hash for Vector4<S>[src]
fn hash<__HS: Hasher>(&self, __arg_0: &mut __HS)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher1.3.0
Feeds a slice of this type into the state provided.
impl<S: Clone> Clone for Vector4<S>[src]
fn clone(&self) -> Vector4<S>
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<S: Copy> Copy for Vector4<S>[src]
impl<S: Eq> Eq for Vector4<S>[src]
impl<S: PartialEq> PartialEq for Vector4<S>[src]
fn eq(&self, __arg_0: &Vector4<S>) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Vector4<S>) -> bool
This method tests for !=.
impl<S: Decodable> Decodable for Vector4<S>[src]
impl<S: Encodable> Encodable for Vector4<S>[src]
impl<S: BaseFloat> MetricSpace for Vector4<S>[src]
type Metric = S
The metric to be returned by the distance function.
fn distance2(self, other: Self) -> S
Returns the squared distance. Read more
fn distance(self, other: Self) -> Self::Metric
The distance between two values.
impl<S: Copy> Array for Vector4<S>[src]
type Element = S
fn from_value(scalar: S) -> Vector4<S>
Construct a vector from a single value, replicating it. Read more
fn sum(self) -> S where S: Add<Output=S>
The sum of the elements of the array.
fn product(self) -> S where S: Mul<Output=S>
The product of the elements of the array.
fn min(self) -> S where S: PartialOrd
The minimum element of the array.
fn max(self) -> S where S: PartialOrd
The maximum element of the array.
fn as_ptr(&self) -> *const Self::Element
Get the pointer to the first element of the array.
fn as_mut_ptr(&mut self) -> *mut Self::Element
Get a mutable pointer to the first element of the array.
fn swap_elements(&mut self, i: usize, j: usize)
Swap the elements at indices i and j in-place.
impl<S: BaseNum> Zero for Vector4<S>[src]
fn zero() -> Vector4<S>
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<S: BaseNum> VectorSpace for Vector4<S>[src]
type Scalar = S
The associated scalar.
impl<S: Neg<Output=S>> Neg for Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the - operator
fn neg(self) -> Vector4<S>
The method for the unary - operator
impl<S: BaseFloat> ApproxEq for Vector4<S>[src]
type Epsilon = S
fn approx_eq_eps(&self, other: &Vector4<S>, epsilon: &S) -> bool
fn approx_epsilon() -> Self::Epsilon
fn approx_eq(&self, other: &Self) -> bool
impl<S: BaseFloat + Rand> Rand for Vector4<S>[src]
fn rand<R: Rng>(rng: &mut R) -> Vector4<S>
Generates a random instance of this type using the specified source of randomness. Read more
impl<S: BaseNum> Add<Vector4<S>> for Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the + operator
fn add(self, other: Vector4<S>) -> Vector4<S>
The method for the + operator
impl<'a, S: BaseNum> Add<&'a Vector4<S>> for Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the + operator
fn add(self, other: &'a Vector4<S>) -> Vector4<S>
The method for the + operator
impl<'a, S: BaseNum> Add<Vector4<S>> for &'a Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the + operator
fn add(self, other: Vector4<S>) -> Vector4<S>
The method for the + operator
impl<'a, 'b, S: BaseNum> Add<&'a Vector4<S>> for &'b Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the + operator
fn add(self, other: &'a Vector4<S>) -> Vector4<S>
The method for the + operator
impl<S: BaseNum + AddAssign<S>> AddAssign<Vector4<S>> for Vector4<S>[src]
fn add_assign(&mut self, other: Vector4<S>)
The method for the += operator
impl<S: BaseNum> Sub<Vector4<S>> for Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the - operator
fn sub(self, other: Vector4<S>) -> Vector4<S>
The method for the - operator
impl<'a, S: BaseNum> Sub<&'a Vector4<S>> for Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the - operator
fn sub(self, other: &'a Vector4<S>) -> Vector4<S>
The method for the - operator
impl<'a, S: BaseNum> Sub<Vector4<S>> for &'a Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the - operator
fn sub(self, other: Vector4<S>) -> Vector4<S>
The method for the - operator
impl<'a, 'b, S: BaseNum> Sub<&'a Vector4<S>> for &'b Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the - operator
fn sub(self, other: &'a Vector4<S>) -> Vector4<S>
The method for the - operator
impl<S: BaseNum + SubAssign<S>> SubAssign<Vector4<S>> for Vector4<S>[src]
fn sub_assign(&mut self, other: Vector4<S>)
The method for the -= operator
impl<S: BaseNum> Mul<S> for Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the * operator
fn mul(self, other: S) -> Vector4<S>
The method for the * operator
impl<'a, S: BaseNum> Mul<S> for &'a Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the * operator
fn mul(self, other: S) -> Vector4<S>
The method for the * operator
impl<S: BaseNum + MulAssign<S>> MulAssign<S> for Vector4<S>[src]
fn mul_assign(&mut self, scalar: S)
The method for the *= operator
impl<S: BaseNum> Div<S> for Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the / operator
fn div(self, other: S) -> Vector4<S>
The method for the / operator
impl<'a, S: BaseNum> Div<S> for &'a Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the / operator
fn div(self, other: S) -> Vector4<S>
The method for the / operator
impl<S: BaseNum + DivAssign<S>> DivAssign<S> for Vector4<S>[src]
fn div_assign(&mut self, scalar: S)
The method for the /= operator
impl<S: BaseNum> Rem<S> for Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the % operator
fn rem(self, other: S) -> Vector4<S>
The method for the % operator
impl<'a, S: BaseNum> Rem<S> for &'a Vector4<S>[src]
type Output = Vector4<S>
The resulting type after applying the % operator
fn rem(self, other: S) -> Vector4<S>
The method for the % operator
impl<S: BaseNum + RemAssign<S>> RemAssign<S> for Vector4<S>[src]
fn rem_assign(&mut self, scalar: S)
The method for the %= operator
impl<S: BaseNum> ElementWise for Vector4<S>[src]
fn add_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn sub_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn mul_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn div_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn rem_element_wise(self, rhs: Vector4<S>) -> Vector4<S>
fn add_assign_element_wise(&mut self, rhs: Vector4<S>)
fn sub_assign_element_wise(&mut self, rhs: Vector4<S>)
fn mul_assign_element_wise(&mut self, rhs: Vector4<S>)
fn div_assign_element_wise(&mut self, rhs: Vector4<S>)
fn rem_assign_element_wise(&mut self, rhs: Vector4<S>)
impl<S: BaseNum> ElementWise<S> for Vector4<S>[src]
fn add_element_wise(self, rhs: S) -> Vector4<S>
fn sub_element_wise(self, rhs: S) -> Vector4<S>
fn mul_element_wise(self, rhs: S) -> Vector4<S>
fn div_element_wise(self, rhs: S) -> Vector4<S>
fn rem_element_wise(self, rhs: S) -> Vector4<S>
fn add_assign_element_wise(&mut self, rhs: S)
fn sub_assign_element_wise(&mut self, rhs: S)
fn mul_assign_element_wise(&mut self, rhs: S)
fn div_assign_element_wise(&mut self, rhs: S)
fn rem_assign_element_wise(&mut self, rhs: S)
impl<S> Index<usize> for Vector4<S>[src]
type Output = S
The returned type after indexing
fn index<'a>(&'a self, i: usize) -> &'a S
The method for the indexing (Foo[Bar]) operation
impl<S> IndexMut<usize> for Vector4<S>[src]
fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut S
The method for the indexing (Foo[Bar]) operation
impl<S> Index<Range<usize>> for Vector4<S>[src]
type Output = [S]
The returned type after indexing
fn index<'a>(&'a self, i: Range<usize>) -> &'a [S]
The method for the indexing (Foo[Bar]) operation
impl<S> IndexMut<Range<usize>> for Vector4<S>[src]
fn index_mut<'a>(&'a mut self, i: Range<usize>) -> &'a mut [S]
The method for the indexing (Foo[Bar]) operation
impl<S> Index<RangeTo<usize>> for Vector4<S>[src]
type Output = [S]
The returned type after indexing
fn index<'a>(&'a self, i: RangeTo<usize>) -> &'a [S]
The method for the indexing (Foo[Bar]) operation
impl<S> IndexMut<RangeTo<usize>> for Vector4<S>[src]
fn index_mut<'a>(&'a mut self, i: RangeTo<usize>) -> &'a mut [S]
The method for the indexing (Foo[Bar]) operation
impl<S> Index<RangeFrom<usize>> for Vector4<S>[src]
type Output = [S]
The returned type after indexing
fn index<'a>(&'a self, i: RangeFrom<usize>) -> &'a [S]
The method for the indexing (Foo[Bar]) operation
impl<S> IndexMut<RangeFrom<usize>> for Vector4<S>[src]
fn index_mut<'a>(&'a mut self, i: RangeFrom<usize>) -> &'a mut [S]
The method for the indexing (Foo[Bar]) operation
impl<S> Index<RangeFull> for Vector4<S>[src]
type Output = [S]
The returned type after indexing
fn index<'a>(&'a self, i: RangeFull) -> &'a [S]
The method for the indexing (Foo[Bar]) operation
impl<S> IndexMut<RangeFull> for Vector4<S>[src]
fn index_mut<'a>(&'a mut self, i: RangeFull) -> &'a mut [S]
The method for the indexing (Foo[Bar]) operation
impl<S> Into<[S; 4]> for Vector4<S>[src]
impl<S> AsRef<[S; 4]> for Vector4<S>[src]
impl<S> AsMut<[S; 4]> for Vector4<S>[src]
impl<S: Clone> From<[S; 4]> for Vector4<S>[src]
impl<'a, S> From<&'a [S; 4]> for &'a Vector4<S>[src]
impl<'a, S> From<&'a mut [S; 4]> for &'a mut Vector4<S>[src]
impl<S> Into<(S, S, S, S)> for Vector4<S>[src]
impl<S> AsRef<(S, S, S, S)> for Vector4<S>[src]
impl<S> AsMut<(S, S, S, S)> for Vector4<S>[src]
impl<S> From<(S, S, S, S)> for Vector4<S>[src]
impl<'a, S> From<&'a (S, S, S, S)> for &'a Vector4<S>[src]
impl<'a, S> From<&'a mut (S, S, S, S)> for &'a mut Vector4<S>[src]
impl<S: BaseFloat> InnerSpace for Vector4<S>[src]
fn dot(self, other: Vector4<S>) -> S
Vector dot (or inner) product.
fn is_perpendicular(self, other: Self) -> bool
Returns true if the vector is perpendicular (at right angles) to the other vector. Read more
fn magnitude2(self) -> Self::Scalar
Returns the squared magnitude. Read more
fn magnitude(self) -> Self::Scalar
The distance from the tail to the tip of the vector.
fn angle(self, other: Self) -> Rad<Self::Scalar>
Returns the angle between two vectors in radians.
fn normalize(self) -> Self
Returns a vector with the same direction, but with a magnitude of 1.
fn normalize_to(self, magnitude: Self::Scalar) -> Self
Returns a vector with the same direction and a given magnitude.
fn lerp(self, other: Self, amount: Self::Scalar) -> Self
Returns the result of linearly interpolating the magnitude of the vector towards the magnitude of other by the specified amount. Read more