pub enum NVec<N: NVecNum> {
    Vec2(N, N),
    Vec3(N, N, N),
    Vec4(N, N, N, N),
}
Expand description

WLambda supports Integer and Float vectors in two, three, and four dimensions. See also VVal::nvec and functions like VVal::ivec2, VVal::fvec2, …

Variants

Vec2(N, N)

Vec3(N, N, N)

Vec4(N, N, N, N)

Implementations

The x component of the number vector as VVal.

The x component of the number vector as faw integer/float type.

The y component of the number vector as VVal.

The y component of the number vector as faw integer/float type.

The z component of the number vector as VVal.

The z component of the number vector as faw integer/float type.

The w component of the number vector as VVal.

The w component of the number vector as faw integer/float type.

Returns the dimensionality of this number vector.

Convert this numeric vector into a tuple of raw integer/float types. All vectors contain x and y components. The z and w components are optional.

A tuple of four elements representing the components of this vector. If a component wasn’t available, a 0 takes its place.

Convert this numeric vector into a tuple of VVal. All vectors contain x and y components. The z and w components are optional.

Convert a tuple of raw integer/float types into an NVec.

Convert a tuple of VVal into an NVec.

Returns a string representation of this numeric vector.

Converts this vector into one with three dimensions, discarding the unnecessary values.

Converts this vector into one with three dimensions, discarding the unnecessary values and filling in the missing values with 0s if necessary.

Converts this vector into one with four dimensions, filling in the missing values with 0s if necessary.

Returns the squared magnitude of this vector like x^2 + y^2. See also NVec::mag.

Returns the magnitude of this vector also known as the mathematical length of the vector: sqrt(x^2 + y^2) for instance for a 2 dimensional vector.

Convert this NVec into a normalized (unit length) vector.

Calculates the dot product of two numerical vectors.

Calculates the cross product of two numerical vectors.

Linear interpolation from this vector to the given vector \a o. The parameter \a t should be between 0.0 and 1.0.

Turns the first two components of this vector into an angle in radians.

Produces a Vec2 based on the radians provided to this function as a float.

The resulting NVec will almost always have a length of 1, except for in cases where o and self are collinear opposites. To work around this, the resulting vector may be normalized.

Panics

Panics if input vectors aren’t unit vectors.

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The resulting type after applying the - operator.

Performs the - operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.