Struct lowdim::Point[][src]

pub struct Point<S: Integer, V: Vector<S>> { /* fields omitted */ }
Expand description

A point in a discrete space.

Implementations

The dimension of the points in this type.

Create a point from a function.

The function must return a scalar value for each possible coordinate index.

Example
assert_eq!(p4d(0, 1, 2, 3), Point4d::with(|i| i64::try_from(i).unwrap()));

Returns a vector of the point coordinates.

Returns a slice containing the coordinates of the point.

Returns a mutable slice containing the coordinates of the point.

Returns the point constructed by taking the minimum with another point at each coordinate.

Example
let p0 = p4d(1, -2, 7, -4);
let p1 = p4d(2, -3, 7, 4);
assert_eq!(p4d(1, -3, 7, -4), p0.min(p1));

Returns the point constructed by taking the maximum with another point at each coordinate.

Example
let p0 = p4d(1, -2, 7, -4);
let p1 = p4d(2, -3, 7, 4);
assert_eq!(p4d(2, -2, 7, 4), p0.max(p1));

Returns the distance to another point w.r.t. the L1 norm.

This is the number of orthogonal steps needed to move from one point to the other.

Example
let p0 = p4d(1, -2, 7, -4);
let p1 = p4d(2, -3, 7, 4);
assert_eq!(10, p0.distance_l1(p1));

Returns the distance to another point w.r.t. the L∞ norm.

This is the number of orthogonal or diagonal steps needed to move from one point to the other.

Example
let p0 = p4d(1, -2, 7, -4);
let p1 = p4d(2, -3, 7, 4);
assert_eq!(8, p0.distance_l_infty(p1));

Creates a vector containing the orthogonal neighbors of a point.

Creates a vector containing the orthogonal and diagonal neighbors of a point.

Returns the componentwise partial ordering for this and another point.

Returns the lexicographic total ordering for this and another point.

That is, the first different coordinate decides the ordering. This is useful as an arbitrary total ordering for sorting, but is not intended to be otherwise meaningful.

Creates a new point with the given coordinates.

Returns the x coordinate of the point.

Examples
let p = p2d(2, 3);
assert_eq!(2, p.x());

Returns the y coordinate of the point.

Examples
let p = p2d(2, 3);
assert_eq!(3, p.y());

Creates a new point with the given coordinates.

Returns the x coordinate of the point.

Examples
let p = p3d(2, 3, -1);
assert_eq!(2, p.x());

Returns the y coordinate of the point.

Examples
let p = p3d(2, 3, -1);
assert_eq!(3, p.y());

Returns the z coordinate of the point.

Examples
let p = p3d(2, 3, -1);
assert_eq!(-1, p.z());

Creates a new point with the given coordinates.

Returns the x coordinate of the point.

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

Returns the y coordinate of the point.

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

Returns the z coordinate of the point.

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

Returns the w coordinate of the point.

Examples
let p = p4d(2, 3, -1, 4);
assert_eq!(4, p.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

Returns the bounding box which contains a single point.

Performs the conversion.

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 returned type after indexing.

Performs the indexing (container[index]) operation. Read more

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

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

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.

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.