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