Struct spectra::linear::Vector2
[−]
[src]
#[repr(C)]pub struct Vector2<S> { pub x: S, pub y: S, }
A 2-dimensional vector.
This type is marked as #[repr(C)]
.
Fields
x: S
The x component of the vector.
y: S
The y component of the vector.
Methods
impl<S> Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
fn unit_x() -> Vector2<S>
A unit vector in the x
direction.
fn unit_y() -> Vector2<S>
A unit vector in the y
direction.
fn perp_dot(self, other: Vector2<S>) -> S
The perpendicular dot product of the vector and other
.
fn extend(self, z: S) -> Vector3<S>
Create a Vector3
, using the x
and y
values from this vector, and the
provided z
.
impl<S> Vector2<S>
[src]
impl<S> Vector2<S> where
S: Copy + NumCast,
[src]
S: Copy + NumCast,
Trait Implementations
impl<S> Index<RangeTo<usize>> for Vector2<S>
[src]
impl<S> Index<RangeFull> for Vector2<S>
[src]
impl<S> Index<usize> for Vector2<S>
[src]
impl<S> Index<Range<usize>> for Vector2<S>
[src]
impl<S> Index<RangeFrom<usize>> for Vector2<S>
[src]
impl<S> Clone for Vector2<S> where
S: Clone,
[src]
S: Clone,
fn clone(&self) -> Vector2<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> Zero for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
fn zero() -> Vector2<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> MetricSpace for Vector2<S> where
S: BaseFloat,
[src]
S: BaseFloat,
impl<S> Into<[S; 2]> for Vector2<S>
[src]
impl<S> Into<(S, S)> for Vector2<S>
[src]
impl<S> AsRef<[S; 2]> for Vector2<S>
[src]
impl<S> AsRef<(S, S)> for Vector2<S>
[src]
impl<S> Copy for Vector2<S> where
S: Copy,
[src]
S: Copy,
impl<S> Array for Vector2<S> where
S: Copy,
[src]
S: Copy,
type Element = S
fn from_value(scalar: S) -> Vector2<S>
fn sum(self) -> S where
S: Add<S, Output = S>,
S: Add<S, Output = S>,
fn product(self) -> S where
S: Mul<S, Output = S>,
S: Mul<S, Output = S>,
fn min(self) -> S where
S: PartialOrd,
S: PartialOrd,
fn max(self) -> S where
S: PartialOrd,
S: PartialOrd,
impl<'a, S> Add<Vector2<S>> for &'a Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the +
operator
fn add(self, other: Vector2<S>) -> Vector2<S>
The method for the +
operator
impl<S> Add<Vector2<S>> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the +
operator
fn add(self, other: Vector2<S>) -> Vector2<S>
The method for the +
operator
impl<'a, S> Add<&'a Vector2<S>> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the +
operator
fn add(self, other: &'a Vector2<S>) -> Vector2<S>
The method for the +
operator
impl<'a, 'b, S> Add<&'a Vector2<S>> for &'b Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the +
operator
fn add(self, other: &'a Vector2<S>) -> Vector2<S>
The method for the +
operator
impl<S> Div<S> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the /
operator
fn div(self, other: S) -> Vector2<S>
The method for the /
operator
impl<'a, S> Div<S> for &'a Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the /
operator
fn div(self, other: S) -> Vector2<S>
The method for the /
operator
impl<'a, S> Rem<S> for &'a Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<S> Rem<S> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<S> ApproxEq for Vector2<S> where
S: BaseFloat,
[src]
S: BaseFloat,
type Epsilon = <S as ApproxEq>::Epsilon
fn default_epsilon() -> <S as ApproxEq>::Epsilon
fn default_max_relative() -> <S as ApproxEq>::Epsilon
fn default_max_ulps() -> u32
fn relative_eq(
&self,
other: &Vector2<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_relative: <S as ApproxEq>::Epsilon
) -> bool
&self,
other: &Vector2<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_relative: <S as ApproxEq>::Epsilon
) -> bool
fn ulps_eq(
&self,
other: &Vector2<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
&self,
other: &Vector2<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
impl<'a, S> Mul<S> for &'a Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the *
operator
fn mul(self, other: S) -> Vector2<S>
The method for the *
operator
impl<S> Mul<S> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the *
operator
fn mul(self, other: S) -> Vector2<S>
The method for the *
operator
impl<S> InnerSpace for Vector2<S> where
S: BaseFloat,
[src]
S: BaseFloat,
fn dot(self, other: Vector2<S>) -> S
Vector dot (or inner) product.
fn angle(self, other: Vector2<S>) -> Rad<S>
Returns the angle between two vectors in radians.
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 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
impl<S> IndexMut<Range<usize>> for Vector2<S>
[src]
fn index_mut(&'a mut self, i: Range<usize>) -> &'a mut [S]
impl<S> IndexMut<RangeFull> for Vector2<S>
[src]
fn index_mut(&'a mut self, i: RangeFull) -> &'a mut [S]
impl<S> IndexMut<usize> for Vector2<S>
[src]
impl<S> IndexMut<RangeTo<usize>> for Vector2<S>
[src]
fn index_mut(&'a mut self, i: RangeTo<usize>) -> &'a mut [S]
impl<S> IndexMut<RangeFrom<usize>> for Vector2<S>
[src]
fn index_mut(&'a mut self, i: RangeFrom<usize>) -> &'a mut [S]
impl<S> VectorSpace for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Scalar = S
impl<S> Sum<Vector2<S>> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<'a, S> Sum<&'a Vector2<S>> for Vector2<S> where
S: 'a + BaseNum,
[src]
S: 'a + BaseNum,
impl<S> DivAssign<S> for Vector2<S> where
S: BaseNum + DivAssign<S>,
[src]
S: BaseNum + DivAssign<S>,
fn div_assign(&mut self, scalar: S)
impl<S> PartialEq<Vector2<S>> for Vector2<S> where
S: PartialEq<S>,
[src]
S: PartialEq<S>,
fn eq(&self, __arg_0: &Vector2<S>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Vector2<S>) -> bool
This method tests for !=
.
impl<S> MulAssign<S> for Vector2<S> where
S: BaseNum + MulAssign<S>,
[src]
S: BaseNum + MulAssign<S>,
fn mul_assign(&mut self, scalar: S)
impl<S> AddAssign<Vector2<S>> for Vector2<S> where
S: BaseNum + AddAssign<S>,
[src]
S: BaseNum + AddAssign<S>,
fn add_assign(&mut self, other: Vector2<S>)
impl<'a, S> Sub<&'a Vector2<S>> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the -
operator
fn sub(self, other: &'a Vector2<S>) -> Vector2<S>
The method for the -
operator
impl<'a, S> Sub<Vector2<S>> for &'a Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the -
operator
fn sub(self, other: Vector2<S>) -> Vector2<S>
The method for the -
operator
impl<S> Sub<Vector2<S>> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the -
operator
fn sub(self, other: Vector2<S>) -> Vector2<S>
The method for the -
operator
impl<'a, 'b, S> Sub<&'a Vector2<S>> for &'b Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Output = Vector2<S>
The resulting type after applying the -
operator
fn sub(self, other: &'a Vector2<S>) -> Vector2<S>
The method for the -
operator
impl<'a, S> From<&'a [S; 2]> for &'a Vector2<S>
[src]
impl<S> From<(S, S)> for Vector2<S>
[src]
impl<S> From<[S; 2]> for Vector2<S> where
S: Clone,
[src]
S: Clone,
impl<'a, S> From<&'a (S, S)> for &'a Vector2<S>
[src]
impl<'a, S> From<&'a mut (S, S)> for &'a mut Vector2<S>
[src]
impl<'a, S> From<&'a mut [S; 2]> for &'a mut Vector2<S>
[src]
impl<S> Rand for Vector2<S> where
S: BaseFloat + Rand,
[src]
S: BaseFloat + Rand,
impl<S> AsMut<(S, S)> for Vector2<S>
[src]
impl<S> AsMut<[S; 2]> for Vector2<S>
[src]
impl<S> ElementWise<Vector2<S>> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
fn add_element_wise(self, rhs: Vector2<S>) -> Vector2<S>
fn sub_element_wise(self, rhs: Vector2<S>) -> Vector2<S>
fn mul_element_wise(self, rhs: Vector2<S>) -> Vector2<S>
fn div_element_wise(self, rhs: Vector2<S>) -> Vector2<S>
fn rem_element_wise(self, rhs: Vector2<S>) -> Vector2<S>
fn add_assign_element_wise(&mut self, rhs: Vector2<S>)
fn sub_assign_element_wise(&mut self, rhs: Vector2<S>)
fn mul_assign_element_wise(&mut self, rhs: Vector2<S>)
fn div_assign_element_wise(&mut self, rhs: Vector2<S>)
fn rem_assign_element_wise(&mut self, rhs: Vector2<S>)
impl<S> ElementWise<S> for Vector2<S> where
S: BaseNum,
[src]
S: BaseNum,
fn add_element_wise(self, rhs: S) -> Vector2<S>
fn sub_element_wise(self, rhs: S) -> Vector2<S>
fn mul_element_wise(self, rhs: S) -> Vector2<S>
fn div_element_wise(self, rhs: S) -> Vector2<S>
fn rem_element_wise(self, rhs: S) -> Vector2<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> Eq for Vector2<S> where
S: Eq,
[src]
S: Eq,
impl<S> RemAssign<S> for Vector2<S> where
S: BaseNum + RemAssign<S>,
[src]
S: BaseNum + RemAssign<S>,
fn rem_assign(&mut self, scalar: S)
impl<S> SubAssign<Vector2<S>> for Vector2<S> where
S: BaseNum + SubAssign<S>,
[src]
S: BaseNum + SubAssign<S>,
fn sub_assign(&mut self, other: Vector2<S>)
impl<S> Hash for Vector2<S> where
S: Hash,
[src]
S: Hash,
fn hash<__HS>(&self, __arg_0: &mut __HS) where
__HS: Hasher,
__HS: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<S> Neg for Vector2<S> where
S: Neg<Output = S>,
[src]
S: Neg<Output = S>,
impl<S> Debug for Vector2<S> where
S: Debug,
[src]
S: Debug,