Struct radiant_rs::Vec2
[−]
[src]
pub struct Vec2<T: Copy + Display + Float>(pub T, pub T);
A 2-dimensional vector.
Methods
impl<T: Copy + Display + Float> Vec2<T>
[src]
fn new() -> Vec2<T>
Creates a new instances.
fn len(self: &Self) -> T
Returns the length of the vector
fn to_rad(self: &Self) -> T
Returns the direction of the vector in radians.
fn to_deg(self: &Self) -> T
Returns the direction of the vector in degrees.
fn from_rad(radians: T) -> Vec2<T>
Creates a unit-vector from the angle given in radians.
fn from_deg(degrees: T) -> Vec2<T>
Creates a unit-vector from the angle given in degrees.
Trait Implementations
impl<T: Copy + Copy + Display + Float> Copy for Vec2<T>
[src]
impl<T: Clone + Copy + Display + Float> Clone for 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
Performs copy-assignment from source
. Read more
impl<T: Debug + Copy + Display + Float> Debug for Vec2<T>
[src]
impl<T: Copy + Display + Float> VecType<T> for Vec2<T>
[src]
impl<T: Copy + Display + Float> Neg for Vec2<T>
[src]
type Output = Vec2<T>
The resulting type after applying the -
operator
fn neg(self) -> Vec2<T>
The method for the unary -
operator
impl<T: Copy + Display + Float> Add for Vec2<T>
[src]
type Output = Vec2<T>
The resulting type after applying the +
operator
fn add(self, other: Vec2<T>) -> Vec2<T>
The method for the +
operator
impl<T: Copy + Display + Float> Mul<T> for Vec2<T>
[src]
type Output = Vec2<T>
The resulting type after applying the *
operator
fn mul(self, other: T) -> Vec2<T>
The method for the *
operator