Struct radiant_utils::Vec2[][src]

pub struct Vec2<T = f32>(pub T, pub T);

A 2-dimensional vector.

Methods

impl<T> Vec2<T> where
    T: Float
[src]

Creates a new instances.

Returns the length of the vector

Returns the dot-product of the vectors.

Deprecated since 0.2.2

: use Angle::from().to_radians() instead

Returns the direction of the vector in radians.

Deprecated since 0.2.2

: use Angle::from().to_degrees() instead

Returns the direction of the vector in degrees.

Deprecated since 0.2.2

: use Angle::from() instead

Returns the direction of the vector as an angle instance.

Deprecated since 0.2.2

: use Vec2::from(Angle::from_radians()) instead

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

Deprecated since 0.2.2

: use Vec2::from(Angle::from_degrees()) instead

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

Deprecated since 0.2.2

: use Vec2::from() instead

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.

Rotates the vector by given angle.

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> From<Vec2<T>> for Angle<T> where
    T: Float
[src]

Performs the conversion.

impl<T: Copy> Copy for Vec2<T>
[src]

impl<T: Clone> Clone for Vec2<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T> Vector<T> for Vec2<T> where
    T: Copy
[src]

Returns the given value as a Vec3

impl<T> From<Angle<T>> for Vec2<T> where
    T: Float
[src]

Performs the conversion.

impl<T> From<[T; 2]> for Vec2<T> where
    T: Copy
[src]

Performs the conversion.

impl From<Vec2<f32>> for [f32; 2]
[src]

Performs the conversion.

impl From<Vec2<f64>> for [f64; 2]
[src]

Performs the conversion.

impl<T> From<(T, T)> for Vec2<T>
[src]

Performs the conversion.

impl From<Vec2<f32>> for (f32, f32)
[src]

Performs the conversion.

impl From<Vec2<f64>> for (f64, f64)
[src]

Performs the conversion.

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

Returns the "default value" for a type. Read more

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

The resulting type after applying the - operator.

Performs the unary - operation.

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

The resulting type after applying the + operator.

Performs the + operation.

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

Performs the += operation.

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

The resulting type after applying the - operator.

Performs the - operation.

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

Performs the -= operation.

impl<T> Mul<Vec2<T>> for Vec2<T> where
    T: 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: Float
[src]

Mutates the vector by multiplying its components with those of the given vector.

impl<T> Mul<T> for Vec2<T> where
    T: 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: Float
[src]

Mutates the vector by multiplying it with the scalar operand.

impl<T> Div<Vec2<T>> for Vec2<T> where
    T: 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: Float
[src]

Mutates the vector by dividing its components with those of the given vector.

impl<T> Div<T> for Vec2<T> where
    T: 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: Float
[src]

Mutates the vector by dividing it by given scalar.

impl Mul<Vec2<f32>> for f32
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl Mul<Vec2<f64>> for f64
[src]

The resulting type after applying the * operator.

Performs the * operation.

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

Formats the value using the given formatter. Read more

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

The resulting type after applying the * operator.

Multiplies the matrix with given vector operand, using 0 as z-component and 1 as w-component of the vector.

Auto Trait Implementations

impl<T> Send for Vec2<T> where
    T: Send

impl<T> Sync for Vec2<T> where
    T: Sync