Struct lowdim::Vec4d[][src]

pub struct Vec4d<S = i64>(_)
where
    S: Integer
;
Expand description

A 4d discrete vector.

Implementations

Creates a new 4d vector from its coordinates.

Returns the x coordinate of the vector.

Examples
let v = v4d(2, 3, -1, 4);
assert_eq!(2, v.x());

Returns the y coordinate of the vector.

Examples
let v = v4d(2, 3, -1, 4);
assert_eq!(3, v.y());

Returns the z coordinate of the vector.

Examples
let v = v4d(2, 3, -1, 4);
assert_eq!(-1, v.z());

Returns the w coordinate of the vector.

Examples
let v = v4d(2, 3, -1, 4);
assert_eq!(4, v.w());

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
use lowdim::v4d;

let v = v4d(6, 2, -1, 4);
assert!(v.is_towards_pos_x());
let v = v4d(6, -2, -1, 4);
assert!(v.is_towards_pos_x());
let v = v4d(-6, -2, -1, 4);
assert!(!v.is_towards_pos_x());
let v = v4d(6, 2, -1, 6);
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 = v4d(-6, 2, -1, 4);
assert!(v.is_towards_neg_x());

Returns true if the vector points towards positive y.

See Vec4d::is_towards_pos_x for more details.

Examples
let v = v4d(2, 6, -1, 4);
assert!(v.is_towards_pos_y());

Returns true if the vector points towards negative y.

See Vec4d::is_towards_neg_x for more details.

Examples
let v = v4d(2, -6, -1, 4);
assert!(v.is_towards_neg_y());

Returns true if the vector points towards positive z.

See Vec4d::is_towards_pos_x for more details.

Examples
let v = v4d(2, -3, 4, -1);
assert!(v.is_towards_pos_z());

Returns true if the vector points towards negative z.

See Vec4d::is_towards_neg_x for more details.

Examples
let v = v4d(2, -3, -4, -1);
assert!(v.is_towards_neg_z());

Returns true if the vector points towards positive w.

See Vec4d::is_towards_pos_x for more details.

Examples
let v = v4d(2, -3, 4, 5);
assert!(v.is_towards_pos_w());

Returns true if the vector points towards negative w.

See Vec4d::is_towards_neg_x for more details.

Examples
let v = v4d(2, -3, -4, -5);
assert!(v.is_towards_neg_w());

Trait Implementations

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 + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

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

Returns the “default value” for a type. 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 / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Creates a value from an iterator. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. 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 * operation. 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 * operation. 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 * operation. 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 * operation. 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 * operation. 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 * operation. 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

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

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 - operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

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

Returns a slice containing the coordinates of the vector.

Returns a mutable slice containing the coordinates of the vector.

Returns the L1 norm of the vector.

This is also called the taxicab, Manhatten or city block norm.

Returns the L∞ norm of the vector.

This is also called the maximum or Chebychev norm.

Returns the square of the L2-norm of the vector.

The L2-norm is also called the Euclidean norm and is the standard notion of the length of a vector.

The dimension of the vectors in this type.

The default layout to use with this vector.

Create a vector from a function which computes the coordinates. Read more

Returns the partial ordering by component of two vectors.

Returns the lexicographic total ordering for this and another vector. Read more

Creates the zero vector.

Creates a vector of ones.

Returns true if a vector is the zero vector.

Apply min by component

Apply max by component

Signum by component. Read more

Returns an iterator that yields the unit vectors.

Returns an iterator that yields the vectors to orthogonal neighbours. Read more

Creates a vector of the vectors with L∞ norm equal to 1. 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

Performs the conversion.

Performs the conversion.

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.