Struct radiant_rs::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]

Creates a new instances.

Returns the length of the vector

Returns the dot-product of the vectors.

Returns the direction of the vector in radians.

Returns the direction of the vector in degrees.

Returns the direction of the vector as an angle instance.

Creates a unit-vector from the angle given in radians.

Creates a unit-vector from the angle given in degrees.

Creates a unit-vector from given angle.

Normalizes the vector.

The left pointing normal of the vector.

The right pointing normal of the vector.

Extends the vector by given length.

Returns outbound vector for this point and given bounding box. Subtracting it from this point will result in a point on the bounding box.

Returns true if the vecor is a zero-vector.

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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T> VecType<T> for Vec2<T> where T: Debug + Float
[src]

Returns the given value as a Vec3

impl<T> From<(T, T)> for Vec2<T> where T: Debug + Float
[src]

Performs the conversion.

impl<T> From<[T; 2]> for Vec2<T> where T: Debug + Float
[src]

Performs the conversion.

impl<T> Neg for Vec2<T> where T: Debug + Float
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<T> Add for Vec2<T> where T: Debug + Float
[src]

The resulting type after applying the + operator

The method for the + operator

impl<T> AddAssign for Vec2<T> where T: Debug + Float
[src]

The method for the += operator

impl<T> Sub for Vec2<T> where T: Debug + Float
[src]

The resulting type after applying the - operator

The method for the - operator

impl<T> SubAssign for Vec2<T> where T: Debug + Float
[src]

The method for the -= operator

impl<T> Mul<Vec2<T>> for Vec2<T> where T: Debug + Float
[src]

The resulting type after applying the * operator

Multiplies individual vector components with those of the given vector.

impl<T> MulAssign<Vec2<T>> for Vec2<T> where T: Debug + Float
[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]

The resulting type after applying the * operator

Multiplies the vector with given scalar operand.

impl<T> MulAssign<T> for Vec2<T> where T: Debug + Float
[src]

Mutates the vector by multiplying it with the scalar operand.

impl<T> Div<Vec2<T>> for Vec2<T> where T: Debug + Float
[src]

The resulting type after applying the / operator

Divides individual vector components with those of the given vector.

impl<T> DivAssign<Vec2<T>> for Vec2<T> where T: Debug + Float
[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]

The resulting type after applying the / operator

Divides the vector by given scalar operand.

impl<T> DivAssign<T> for Vec2<T> where T: Debug + Float
[src]

Mutates the vector by dividing it by given scalar.

impl AsUniform for Vec2<f32>
[src]

impl AsUniform for Vec2<f64>
[src]

impl<T> Debug for Vec2<T> where T: Debug + Float
[src]

Formats the value using the given formatter.