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]

[src]

Creates a new instances.

[src]

Returns the length of the vector

[src]

Returns the dot-product of the vectors.

[src]

Returns the direction of the vector in radians.

[src]

Returns the direction of the vector in degrees.

[src]

Returns the direction of the vector as an angle instance.

[src]

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

[src]

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

[src]

Creates a unit-vector from given angle.

[src]

Normalizes the vector.

[src]

The left pointing normal of the vector.

[src]

The right pointing normal of the vector.

[src]

Extends the vector by given length.

[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.

[src]

Returns true if the vecor is a zero-vector.

[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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

Returns the given value as a Vec3

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

The resulting type after applying the - operator.

[src]

Performs the unary - operation.

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

The resulting type after applying the + operator.

[src]

Performs the + operation.

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

[src]

Performs the += operation.

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

The resulting type after applying the - operator.

[src]

Performs the - operation.

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

[src]

Performs the -= operation.

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

The resulting type after applying the * operator.

[src]

Multiplies individual vector components with those of the given vector.

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

[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.

[src]

Multiplies the vector with given scalar operand.

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

[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.

[src]

Divides individual vector components with those of the given vector.

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

[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.

[src]

Divides the vector by given scalar operand.

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

[src]

Mutates the vector by dividing it by given scalar.

impl AsUniform for Vec2<f32>
[src]

[src]

impl AsUniform for Vec2<f64>
[src]

[src]

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

[src]

Formats the value using the given formatter.