Struct cgmath::Vector4 [] [src]

#[repr(C)]
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)].

Fields

The x component of the vector.

The y component of the vector.

The z component of the vector.

The w component of the vector.

Methods

impl<S> Vector4<S>
[src]

Construct a new vector, using the provided values.

impl<S: NumCast + Copy> Vector4<S>
[src]

Component-wise casting to another type.

impl<S: BaseNum> Vector4<S>
[src]

A unit vector in the x direction.

A unit vector in the y direction.

A unit vector in the z direction.

A unit vector in the w direction.

Create a Vector3, dropping the w value.

Create a Vector3, dropping the nth element.

Trait Implementations

impl<S: PartialEq> PartialEq for Vector4<S>
[src]

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

This method tests for !=.

impl<S: Eq> Eq for Vector4<S>
[src]

impl<S: Copy> Copy for Vector4<S>
[src]

impl<S: Clone> Clone for Vector4<S>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<S: Hash> Hash for Vector4<S>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<S: BaseFloat> MetricSpace for Vector4<S>
[src]

The metric to be returned by the distance function.

Returns the squared distance. Read more

The distance between two values.

impl<S: Copy> Array for Vector4<S>
[src]

Construct a vector from a single value, replicating it. Read more

The sum of the elements of the array.

The product of the elements of the array.

Get the pointer to the first element of the array.

Get a mutable pointer to the first element of the array.

Swap the elements at indices i and j in-place.

impl<S: BaseNum> Zero for Vector4<S>
[src]

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

Returns true if self is equal to the additive identity.

impl<S: BaseNum> Sum<Vector4<S>> for Vector4<S>
[src]

Method which takes an iterator and generates Self from the elements by "summing up" the items. Read more

impl<'a, S: 'a + BaseNum> Sum<&'a Vector4<S>> for Vector4<S>
[src]

Method which takes an iterator and generates Self from the elements by "summing up" the items. Read more

impl<S: BaseNum> VectorSpace for Vector4<S>
[src]

The associated scalar.

impl<S: Neg<Output = S>> Neg for Vector4<S>
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<S: BaseFloat> ApproxEq for Vector4<S>
[src]

Used for specifying relative comparisons.

The default tolerance to use when testing values that are close together. Read more

The default relative tolerance for testing values that are far-apart. Read more

The default ULPs to tolerate when testing values that are far-apart. Read more

A test for equality that uses a relative comparison if the values are far apart.

A test for equality that uses units in the last place (ULP) if the values are far apart.

The inverse of ApproxEq::relative_eq.

The inverse of ApproxEq::ulps_eq.

impl<S: BaseFloat + Rand> Rand for Vector4<S>
[src]

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]

The resulting type after applying the + operator

The method for the + operator

impl<'a, S: BaseNum> Add<&'a Vector4<S>> for Vector4<S>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, S: BaseNum> Add<Vector4<S>> for &'a Vector4<S>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, S: BaseNum> Add<&'a Vector4<S>> for &'b Vector4<S>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<S: BaseNum + AddAssign<S>> AddAssign<Vector4<S>> for Vector4<S>
[src]

The method for the += operator

impl<S: BaseNum> Sub<Vector4<S>> for Vector4<S>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, S: BaseNum> Sub<&'a Vector4<S>> for Vector4<S>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, S: BaseNum> Sub<Vector4<S>> for &'a Vector4<S>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, S: BaseNum> Sub<&'a Vector4<S>> for &'b Vector4<S>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<S: BaseNum + SubAssign<S>> SubAssign<Vector4<S>> for Vector4<S>
[src]

The method for the -= operator

impl<S: BaseNum> Mul<S> for Vector4<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, S: BaseNum> Mul<S> for &'a Vector4<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<S: BaseNum + MulAssign<S>> MulAssign<S> for Vector4<S>
[src]

The method for the *= operator

impl<S: BaseNum> Div<S> for Vector4<S>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, S: BaseNum> Div<S> for &'a Vector4<S>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<S: BaseNum + DivAssign<S>> DivAssign<S> for Vector4<S>
[src]

The method for the /= operator

impl<S: BaseNum> Rem<S> for Vector4<S>
[src]

The resulting type after applying the % operator

The method for the % operator

impl<'a, S: BaseNum> Rem<S> for &'a Vector4<S>
[src]

The resulting type after applying the % operator

The method for the % operator

impl<S: BaseNum + RemAssign<S>> RemAssign<S> for Vector4<S>
[src]

The method for the %= operator

impl<S: BaseNum> ElementWise for Vector4<S>
[src]

impl<S: BaseNum> ElementWise<S> for Vector4<S>
[src]

impl<S> Index<usize> for Vector4<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S> IndexMut<usize> for Vector4<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S> Index<Range<usize>> for Vector4<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S> IndexMut<Range<usize>> for Vector4<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S> Index<RangeTo<usize>> for Vector4<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S> IndexMut<RangeTo<usize>> for Vector4<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S> Index<RangeFrom<usize>> for Vector4<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S> IndexMut<RangeFrom<usize>> for Vector4<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S> Index<RangeFull> for Vector4<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S> IndexMut<RangeFull> for Vector4<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S> Into<[S; 4]> for Vector4<S>
[src]

Performs the conversion.

impl<S> AsRef<[S; 4]> for Vector4<S>
[src]

Performs the conversion.

impl<S> AsMut<[S; 4]> for Vector4<S>
[src]

Performs the conversion.

impl<S: Clone> From<[S; 4]> for Vector4<S>
[src]

Performs the conversion.

impl<'a, S> From<&'a [S; 4]> for &'a Vector4<S>
[src]

Performs the conversion.

impl<'a, S> From<&'a mut [S; 4]> for &'a mut Vector4<S>
[src]

Performs the conversion.

impl<S> Into<(S, S, S, S)> for Vector4<S>
[src]

Performs the conversion.

impl<S> AsRef<(S, S, S, S)> for Vector4<S>
[src]

Performs the conversion.

impl<S> AsMut<(S, S, S, S)> for Vector4<S>
[src]

Performs the conversion.

impl<S> From<(S, S, S, S)> for Vector4<S>
[src]

Performs the conversion.

impl<'a, S> From<&'a (S, S, S, S)> for &'a Vector4<S>
[src]

Performs the conversion.

impl<'a, S> From<&'a mut (S, S, S, S)> for &'a mut Vector4<S>
[src]

Performs the conversion.

impl<S: BaseFloat> InnerSpace for Vector4<S>
[src]

Vector dot (or inner) product.

Returns true if the vector is perpendicular (at right angles) to the other vector. Read more

Returns the squared magnitude. Read more

The distance from the tail to the tip of the vector.

Returns the angle between two vectors in radians.

Returns a vector with the same direction, but with a magnitude of 1.

Returns a vector with the same direction and a given magnitude.

Returns the result of linearly interpolating the magnitude of the vector towards the magnitude of other by the specified amount. Read more

impl<S: Debug> Debug for Vector4<S>
[src]

Formats the value using the given formatter.