[−][src]Trait gridly::prelude::VectorLike
Required methods
Loading content...Provided methods
fn manhattan_length(&self) -> isize
Return the manhattan length of the vector. The manhattan length of a vector is the sum of the absolute values of its components.
fn checked_manhattan_length(&self) -> Option<isize>
Return the manhatten length of the vector, or None
if there are
any overflows.
fn clockwise(&self) -> Vector
Return a new vector, rotated 90 degrees clockwise.
fn anticlockwise(&self) -> Vector
Return a new vector, rotated 90 degrees counterclockwise.
fn reverse(&self) -> Vector
fn get_component<T: Component>(&self) -> T
Generically get either the Rows
or Columns
of a vector
fn transpose(&self) -> Vector
Swap the rows and columns of this Vector
fn direction(&self) -> Option<Direction>
If the vector is pointing in an orthogonal direction, return that direction
Implementations on Foreign Types
impl VectorLike for (Rows, Columns)
[src]
impl VectorLike for (Columns, Rows)
[src]
impl VectorLike for (isize, isize)
[src]
impl<'_, T: VectorLike> VectorLike for &'_ T
[src]
Loading content...
Implementors
impl VectorLike for Direction
[src]
A Direction
acts like a unit vector in the given direction. This allows
it to be used in things like Vector arithmetic.
Example:
use gridly::prelude::*; assert_eq!(Vector::new(1, 1) + Up, Vector::new(0, 1)); assert_eq!(Location::new(3, 4) - Left, Location::new(3, 5));