Struct radiant_utils::maths::Vec2 [−][src]
pub struct Vec2<T = f32>(pub T, pub T);
A 2-dimensional vector.
Methods
impl<T> Vec2<T> where
T: Float, [src]
impl<T> Vec2<T> where
T: Float, pub fn new() -> Self[src]
pub fn new() -> SelfCreates a new instances.
pub fn len(&self) -> T[src]
pub fn len(&self) -> TReturns the length of the vector
pub fn dot(&self, other: &Self) -> T[src]
pub fn dot(&self, other: &Self) -> TReturns the dot-product of the vectors.
pub fn to_radians(&self) -> T[src]
pub fn to_radians(&self) -> T: use Angle::from().to_radians() instead
Returns the direction of the vector in radians.
pub fn to_degrees(&self) -> T[src]
pub fn to_degrees(&self) -> T: use Angle::from().to_degrees() instead
Returns the direction of the vector in degrees.
pub fn to_angle(&self) -> Angle<T>[src]
pub fn to_angle(&self) -> Angle<T>: use Angle::from() instead
Returns the direction of the vector as an angle instance.
pub fn from_radians(radians: T) -> Self[src]
pub fn from_radians(radians: T) -> Self: use Vec2::from(Angle::from_radians()) instead
Creates a unit-vector from the angle given in radians.
pub fn from_degrees(degrees: T) -> Self[src]
pub fn from_degrees(degrees: T) -> Self: use Vec2::from(Angle::from_degrees()) instead
Creates a unit-vector from the angle given in degrees.
pub fn from_angle(angle: Angle<T>) -> Self[src]
pub fn from_angle(angle: Angle<T>) -> Self: use Vec2::from() instead
Creates a unit-vector from given angle.
pub fn normalize(self) -> Self[src]
pub fn normalize(self) -> SelfNormalizes the vector.
pub fn left(self) -> Self[src]
pub fn left(self) -> SelfThe left pointing normal of the vector.
pub fn right(self) -> Self[src]
pub fn right(self) -> SelfThe right pointing normal of the vector.
pub fn extend(self, extension_len: T) -> Self[src]
pub fn extend(self, extension_len: T) -> SelfExtends the vector by given length.
pub fn rotate(self, angle: Angle<T>) -> Self[src]
pub fn rotate(self, angle: Angle<T>) -> SelfRotates the vector by given angle.
pub fn outbound(&self, bounding: ((T, T), (T, T))) -> Option<Self>[src]
pub fn outbound(&self, bounding: ((T, T), (T, T))) -> Option<Self>Returns outbound vector for this point and given bounding box. Subtracting it from this point will result in a point on the bounding box.
pub fn is_zero(&self) -> bool[src]
pub fn is_zero(&self) -> boolReturns true if the vecor is a zero-vector.
pub fn distance(&self, other: &Self) -> T[src]
pub fn distance(&self, other: &Self) -> TReturns distance to other point.
Trait Implementations
impl<T> From<Vec2<T>> for Angle<T> where
T: Float, [src]
impl<T> From<Vec2<T>> for Angle<T> where
T: Float, impl<T: Copy> Copy for Vec2<T>[src]
impl<T: Copy> Copy for Vec2<T>impl<T: Clone> Clone for Vec2<T>[src]
impl<T: Clone> Clone for Vec2<T>fn clone(&self) -> Vec2<T>[src]
fn clone(&self) -> Vec2<T>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<T> Vector<T> for Vec2<T> where
T: Copy, [src]
impl<T> Vector<T> for Vec2<T> where
T: Copy, impl<T> From<Angle<T>> for Vec2<T> where
T: Float, [src]
impl<T> From<Angle<T>> for Vec2<T> where
T: Float, impl<T> From<[T; 2]> for Vec2<T> where
T: Copy, [src]
impl<T> From<[T; 2]> for Vec2<T> where
T: Copy, impl From<Vec2<f32>> for [f32; 2][src]
impl From<Vec2<f32>> for [f32; 2]impl From<Vec2<f64>> for [f64; 2][src]
impl From<Vec2<f64>> for [f64; 2]impl<T> From<(T, T)> for Vec2<T>[src]
impl<T> From<(T, T)> for Vec2<T>impl From<Vec2<f32>> for (f32, f32)[src]
impl From<Vec2<f32>> for (f32, f32)impl From<Vec2<f64>> for (f64, f64)[src]
impl From<Vec2<f64>> for (f64, f64)impl<T> Default for Vec2<T> where
T: Float, [src]
impl<T> Default for Vec2<T> where
T: Float, impl<T> Neg for Vec2<T> where
T: Float, [src]
impl<T> Neg for Vec2<T> where
T: Float, type Output = Vec2<T>
The resulting type after applying the - operator.
fn neg(self) -> Vec2<T>[src]
fn neg(self) -> Vec2<T>Performs the unary - operation.
impl<T> Add for Vec2<T> where
T: Float, [src]
impl<T> Add for Vec2<T> where
T: Float, type Output = Vec2<T>
The resulting type after applying the + operator.
fn add(self, other: Vec2<T>) -> Vec2<T>[src]
fn add(self, other: Vec2<T>) -> Vec2<T>Performs the + operation.
impl<T> AddAssign for Vec2<T> where
T: Float, [src]
impl<T> AddAssign for Vec2<T> where
T: Float, fn add_assign(&mut self, other: Vec2<T>)[src]
fn add_assign(&mut self, other: Vec2<T>)Performs the += operation.
impl<T> Sub for Vec2<T> where
T: Float, [src]
impl<T> Sub for Vec2<T> where
T: Float, type Output = Vec2<T>
The resulting type after applying the - operator.
fn sub(self, other: Vec2<T>) -> Vec2<T>[src]
fn sub(self, other: Vec2<T>) -> Vec2<T>Performs the - operation.
impl<T> SubAssign for Vec2<T> where
T: Float, [src]
impl<T> SubAssign for Vec2<T> where
T: Float, fn sub_assign(&mut self, other: Vec2<T>)[src]
fn sub_assign(&mut self, other: Vec2<T>)Performs the -= operation.
impl<T> Mul<Vec2<T>> for Vec2<T> where
T: Float, [src]
impl<T> Mul<Vec2<T>> for Vec2<T> where
T: Float, type Output = Vec2<T>
The resulting type after applying the * operator.
fn mul(self, other: Vec2<T>) -> Vec2<T>[src]
fn mul(self, other: Vec2<T>) -> Vec2<T>Multiplies individual vector components with those of the given vector.
impl<T> MulAssign<Vec2<T>> for Vec2<T> where
T: Float, [src]
impl<T> MulAssign<Vec2<T>> for Vec2<T> where
T: Float, fn mul_assign(&mut self, other: Vec2<T>)[src]
fn mul_assign(&mut self, other: Vec2<T>)Mutates the vector by multiplying its components with those of the given vector.
impl<T> Mul<T> for Vec2<T> where
T: Float, [src]
impl<T> Mul<T> for Vec2<T> where
T: Float, type Output = Vec2<T>
The resulting type after applying the * operator.
fn mul(self, other: T) -> Vec2<T>[src]
fn mul(self, other: T) -> Vec2<T>Multiplies the vector with given scalar operand.
impl<T> MulAssign<T> for Vec2<T> where
T: Float, [src]
impl<T> MulAssign<T> for Vec2<T> where
T: Float, fn mul_assign(&mut self, other: T)[src]
fn mul_assign(&mut self, other: T)Mutates the vector by multiplying it with the scalar operand.
impl<T> Div<Vec2<T>> for Vec2<T> where
T: Float, [src]
impl<T> Div<Vec2<T>> for Vec2<T> where
T: Float, type Output = Vec2<T>
The resulting type after applying the / operator.
fn div(self, other: Vec2<T>) -> Vec2<T>[src]
fn div(self, other: Vec2<T>) -> Vec2<T>Divides individual vector components with those of the given vector.
impl<T> DivAssign<Vec2<T>> for Vec2<T> where
T: Float, [src]
impl<T> DivAssign<Vec2<T>> for Vec2<T> where
T: Float, fn div_assign(&mut self, other: Vec2<T>)[src]
fn div_assign(&mut self, other: Vec2<T>)Mutates the vector by dividing its components with those of the given vector.
impl<T> Div<T> for Vec2<T> where
T: Float, [src]
impl<T> Div<T> for Vec2<T> where
T: Float, type Output = Vec2<T>
The resulting type after applying the / operator.
fn div(self, other: T) -> Vec2<T>[src]
fn div(self, other: T) -> Vec2<T>Divides the vector by given scalar operand.
impl<T> DivAssign<T> for Vec2<T> where
T: Float, [src]
impl<T> DivAssign<T> for Vec2<T> where
T: Float, fn div_assign(&mut self, other: T)[src]
fn div_assign(&mut self, other: T)Mutates the vector by dividing it by given scalar.
impl Mul<Vec2<f32>> for f32[src]
impl Mul<Vec2<f32>> for f32type Output = Vec2<f32>
The resulting type after applying the * operator.
fn mul(self, other: Vec2<f32>) -> Vec2<f32>[src]
fn mul(self, other: Vec2<f32>) -> Vec2<f32>Performs the * operation.
impl Mul<Vec2<f64>> for f64[src]
impl Mul<Vec2<f64>> for f64type Output = Vec2<f64>
The resulting type after applying the * operator.
fn mul(self, other: Vec2<f64>) -> Vec2<f64>[src]
fn mul(self, other: Vec2<f64>) -> Vec2<f64>Performs the * operation.
impl AsUniform for Vec2<f32>[src]
impl AsUniform for Vec2<f32>fn as_uniform(&self) -> Uniform[src]
fn as_uniform(&self) -> Uniformimpl AsUniform for Vec2<f64>[src]
impl AsUniform for Vec2<f64>fn as_uniform(&self) -> Uniform[src]
fn as_uniform(&self) -> Uniformimpl<T> Debug for Vec2<T> where
T: Debug, [src]
impl<T> Debug for Vec2<T> where
T: Debug, fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<T> Mul<Vec2<T>> for Mat4<T> where
T: Float, [src]
impl<T> Mul<Vec2<T>> for Mat4<T> where
T: Float,