Struct Vector2
Source #[repr(C)]
pub struct Vector2<T: Primitive> {
pub x: T,
pub y: T,
}
Extends self to a Vector3 by appending z.
§Example
use glm::*;
let v2 = vec2(1., 2.);
let v3 = vec3(1., 2., 3.);
assert_eq!(v2.extend(3.), v3);
The resulting type after applying the + operator.
The resulting type after applying the + operator.
Returns
true if the difference between
x and
y is less than
max_diff.
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.
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.
Returns
true if all components of the receiver are
true.
Read more
Returns
true if there is any component of the receiver is
true.
Read more
Returns the component-wise logical complement of the receiver.
Read more
Computes and returns a * b + c.
Type of row vectors.
Type of transpose matrix.
Type of row vectors.
Type of transpose matrix.
Type of row vectors.
Type of transpose matrix.
Constructs from a scalar number.
Returns the minimal value of all components.
Read more
Returns the maximal value of all components.
Read more
Returns the determinant of a square matrix.
Read more
Returns the inverse matrix of a square matrix, or None if the
matrix is not invertible.
Returns the dimension of the vector.
Read more
The returned type after indexing.
Performs the indexing (
container[index]) operation.
Read more
Performs the mutable indexing (
container[index]) operation.
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.
Returns the multiplicative identity element of
Self,
1.
Read more
Sets self to the multiplicative identity element of Self, 1.
Returns
true if
self is equal to the multiplicative identity.
Read more
Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
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.
Returns the absolute value of the receiver.
Returns the sign number of the receiver.
Read more
The resulting type after applying the - operator.
The resulting type after applying the - operator.
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.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
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
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.