Crate lowdim[][src]

Expand description

Affine geometry for discrete 2d, 3d and 4d worlds.

Provides vectors, matrices, points and more to simplify programming for 2d to 4d worlds. Features include:

  • Bounding boxes and iterators over the points inside them
  • Arrays indexed by points
  • Rotations and reflections
  • Taxicab (L1) and maximum (L∞) metrics
  • Orthogonal and king’s move neighbourhoods

This was originally motivated by Advent of Code (yes, Santa’s elves use the 4th dimension, for example for time travel).

Crate Status

Experimental

Limitations

  • Bounding box iterators and arrays are only implemented for the 2d case.
  • Rotations and reflections are only implemented for the 2d case.

Crate Feature Flags

  • random
    • Off by default.
    • Adds a dependency to the rand crate.
    • Adds the method BBox2d::random_point to generate random points in a bounding box.

Modules

Affine transformations for n-dimensional discrete spaces.

n-dimensional arrays indexed by points in a bounding box.

n-dimensional bounding boxes.

Contains traits defining required properties of the underlying integer types.

Traits for matrices.

2-dimensional matrices.

3-dimensional matrices.

4-dimensional matrices.

Points in the affine space.

Symmetries of 2d vectors.

2-dimensional vectors.

3-dimensional vectors.

4-dimensional vectors.

Traits for vectors.

Structs

An affine transformation.

A two-dimensional array indexed by points in a bounding box.

A bounding box.

A two-dimensional discrete matrix.

A two-dimensional discrete matrix.

A two-dimensional discrete matrix.

A point in a discrete space.

A two-dimensional discrete vector.

A three-dimensional discrete vector.

A four-dimensional discrete vector.

Enums

The symmetries of discrete 2d vectors.

Traits

Required traits and operations for integers.

Required traits and operations for matrices.

Required arithmetic operations for matrices.

Required traits and operations for vectors.

Required arithmetic operations for vectors.

Functions

Creates a 2d bounding box from ranges of x and y coordinates.

Creates a 2d point.

Creates a 3d point.

Creates a 4d point.

Creates a 2d-vector.

Creates a 3d-vector.

Creates a 4d-vector.

Type Definitions

A 2-dimensional affine transformation.

A 3-dimensional affine transformation.

A 4-dimensional affine transformation.

A 2d bounding box.

A 3d bounding box.

A 4d bounding box.

A 2d point.

A 3d point.

A 4d point.