Struct lowdim::Vec2d [−][src]
Expand description
A two-dimensional discrete vector.
Implementations
Returns true if the vector points towards positive x.
That is, among the vectors pointing in both directions along the coordinate axes, the one pointing towards positive x is closest to this vector. Or to put it more concretely, the x coordinate of the vector is positive, and its absolute value is greater than that of the other coordinates.
Examples
let v = v2d(3, 2);
assert!(v.is_towards_pos_x());
let v = v2d(3, -2);
assert!(v.is_towards_pos_x());
let v = v2d(-3, -2);
assert!(!v.is_towards_pos_x());
let v = v2d(3, 3);
assert!(!v.is_towards_pos_x());Returns true if the vector points towards negative x.
That is, among the vectors pointing in both directions along the coordinate axes, the one pointing towards negative x is closest to this vector. Or to put it more concretely, the x coordinate of the vector is negative, and its absolute value is greater than that of the other coordinates.
Examples
let v = v2d(-3, 2);
assert!(v.is_towards_neg_x());Returns true if the vector points towards positive y.
See Vec2d::is_towards_pos_x for more details.
Examples
let v = v2d(2, 3);
assert!(v.is_towards_pos_y());Returns true if the vector points towards negative y.
See Vec2d::is_towards_neg_x for more details.
Examples
let v = v2d(2, -3);
assert!(v.is_towards_neg_y());Returns a vector obtained by rotating this vector left by a right angle.
Examples
let v = v2d(2, 3);
assert_eq!(v2d(-3, 2), v.rotate_left());Returns a vector obtained by rotating this vector right by a right angle.
Examples
let v = v2d(2, 3);
assert_eq!(v2d(3, -2), v.rotate_right());Trait Implementations
Performs the += operation. Read more
Performs the += operation. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Performs the -= operation. Read more
Performs the -= operation. Read more
The maximum, Chebychev or L∞ norm.
Creates a vector of the 8 vectors with L∞ norm equal to 1.
Create a vector from a function which computes the coordinates. Read more
Returns the lexicographic total ordering for this and another vector. Read more
Creates a vector of the vectors to orthogonal neighbours. Read more
Auto Trait Implementations
impl<S> RefUnwindSafe for Vec2d<S> where
S: RefUnwindSafe,
impl<S> UnwindSafe for Vec2d<S> where
S: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more