#[repr(C)]
pub struct Vector2<S> {
pub x: S,
pub y: S,
}
Expand description
A 2-dimensional vector.
This type is marked as #[repr(C)]
.
The x component of the vector.
The y component of the vector.
Construct a new vector, using the provided values.
Perform the given operation on each field in the vector, returning a new point
constructed from the operations.
Construct a new vector where each component is the result of
applying the given operation to each pair of components of the
given vectors.
Component-wise casting to another type.
A unit vector in the x
direction.
A unit vector in the y
direction.
The perpendicular dot product of the vector and other
.
Create a Vector3
, using the x
and y
values from this vector, and the
provided z
.
Used for specifying relative comparisons.
The default tolerance to use when testing values that are close together. Read more
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers. Read more
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
Get the number of elements in the array type Read more
Construct a vector from a single value, replicating it. Read more
The sum of the elements of the array.
The product of the elements of the array.
Whether all elements of the array are finite
Get the pointer to the first element of the array.
Get a mutable pointer to the first element of the array.
Swap the elements at indices i
and j
in-place.
returns the smallest finite number this type can represent
returns the largest finite number this type can represent
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
Performs the mutable indexing (container[index]
) operation. Read more
Performs the mutable indexing (container[index]
) operation. Read more
Performs the mutable indexing (container[index]
) operation. Read more
Performs the mutable indexing (container[index]
) operation. Read more
Performs the mutable indexing (container[index]
) operation. Read more
Vector dot (or inner) product.
Returns the angle between two vectors in radians.
Returns true
if the vector is perpendicular (at right angles) to the
other vector. Read more
The distance from the tail to the tip of the vector.
Returns a vector with the same direction, but with a magnitude of 1
.
Returns a vector with the same direction and a given magnitude.
The metric to be returned by the distance
function.
The distance between two values.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the -
operator.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
The default relative tolerance for testing values that are far-apart. Read more
A test for equality that uses a relative comparison if the values are far apart.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
The default ULPs to tolerate when testing values that are far-apart. Read more
A test for equality that uses units in the last place (ULP) if the values are far apart.
Returns the result of linearly interpolating the vector
towards other
by the specified amount. Read more
Returns the additive identity element of Self
, 0
. Read more
Returns true
if self
is equal to the additive identity.
Sets self
to the additive identity element of Self
, 0
.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
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.
The type returned in the event of a conversion error.
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Rem<Rhs, Output = Output> + Add<Rhs, Output = Output> + Sub<Rhs, Output = Output>,