Liking cljdoc? Tell your friends :D

helins.htm.grid

Regular cartesian grids.

Glossary

capacity How many elements fit on a dimension, a portion of a grid, or a whole grid.

coordinate, coord Integer expression the unique location of an element in a dimension.

coordinates, coords Vector of coordinates expressing a unique location in a grid.

dimension, dim Always described by its capacity.

element Member of a grid, always has unique coordinates.

flat-index, f-index Any coordinates can be translated into a unique and corresponding 'f-indexbetween 0 (inclusive) andcapacity(exclusive). For instance, in a 2D 32x64 grid, the element with coordinates [4 10] would have af-index` of (+ (* 4 64) 10). It is like unfolding an N dimensional space into a single dimension.

grid Regular Cartesian grid partitioning a finite N dimensional space into a topology of elements with integer coordinates. Described by a vector of dimensions. A 2D 32x64 grid would be [32 64].

hypercube Vector of 2-tuples [coordinate capacity], one for every dimension, expressing a hypercube in a grid. A coordinate can be outside of the capacity of the corresponding grid dimension. Depending on the context, the hypercube would be truncated or wrapped (cf. wrapping).

n-dims Number of dimensions.

normal-coords coordinates normalized to fit between 0 and 1 (inclusive).

random-number-generator, rng No-arg function returning a random value between 0 (inclusive) and 1 (exclusive).

relative-coords coordinates in one grid always have relative coordinates in another grid. For instance, coordinates [1 1] in a [4 4] grid can be translated to coordinates [3 3] in a [10 10] grid which, proportionally, represents the same location.

relative-f-index Just like relative-coords, but for a flat-index.

wrapping Dimensions can behave in a cyclic manner. For instance, a coordinate of -2 on a dimension of capacity 6 would effectively be 4.

Regular cartesian grids.


Glossary

  
  capacity
    How many `element`s fit on a dimension, a portion of a `grid`, or a whole `grid`.

  coordinate, coord
    Integer expression the unique location of an `element` in a dimension.

  coordinates, coords
    Vector of `coordinate`s expressing a unique location in a `grid`.

  dimension, dim
    Always described by its capacity.     

  element
    Member of a grid, always has unique `coordinates`.

  flat-index, f-index
    Any `coordinates` can be translated into a unique and corresponding 'f-index` between 0 (inclusive) and `capacity` (exclusive).
    For instance, in a 2D 32x64 grid, the element with coordinates [4 10] would have a `f-index` of (+ (* 4 64) 10).
    It is like unfolding an N dimensional space into a single dimension.

  grid
    Regular Cartesian grid partitioning a finite N dimensional space into a topology of `element`s with integer `coordinates`.
    Described by a vector of `dimension`s. A 2D 32x64 grid would be [32 64].

  hypercube
    Vector of 2-tuples [`coordinate` `capacity`], one for every dimension, expressing a hypercube in a `grid`. 
    A `coordinate` can be outside of the capacity of the corresponding `grid` dimension. Depending on the context, the hypercube would be truncated
    or wrapped (cf. `wrapping`).

  n-dims
    Number of dimensions.

  normal-coords
    `coordinates` normalized to fit between 0 and 1 (inclusive).

  random-number-generator, rng
    No-arg function returning a random value between 0 (inclusive) and 1 (exclusive).

  relative-coords
    `coordinates` in one `grid` always have relative `coordinates` in another `grid`.
    For instance, `coordinates` [1 1] in a [4 4] `grid` can be translated to `coordinates` [3 3] in a [10 10] `grid` which, proportionally, represents the same location.

  relative-f-index
    Just like `relative-coords`, but for a `flat-index`.

  wrapping
    Dimensions can behave in a cyclic manner. For instance, a `coordinate` of -2 on a dimension of `capacity` 6 would effectively be 4.
raw docstring

coords->f-indexclj

(coords->f-index grid coords)

Translates coordinates to the corresponding flat-index in the given grid.

Translates `coordinates` to the corresponding `flat-index` in the given `grid`.
sourceraw docstring

denormalize-coordsclj

(denormalize-coords grid normal-coords)

Does the opposite of normalize-coords.

Does the opposite of `normalize-coords`.
sourceraw docstring

dim-rangesclj

(dim-ranges grid seq-coords)

Given a sequence of coordinates in a grid, returns a vector of [min-coord max-coord] for every dimension.

Given a sequence of `coordinates` in a `grid`, returns a vector of [min-coord max-coord] for every dimension.
sourceraw docstring

dim-spanclj

(dim-span dim-ranges)

Given dim-ranges, computes the span for every dimension.

Given `dim-ranges`, computes the span for every dimension.
sourceraw docstring

f-index->coordsclj

(f-index->coords grid f-index)

Translates a flat-index to the corresponding coordinates in the given grid.

Translates a `flat-index` to the corresponding `coordinates` in the given `grid`.
sourceraw docstring

f-index->coords-hypercubeclj

(f-index->coords-hypercube hypercube f-index)

Computes the coordinates of a flat-index within a hypercube.

Computes the `coordinates` of a `flat-index` within a `hypercube`.
sourceraw docstring

grid-capacityclj

(grid-capacity grid)

Computes the capacity of a grid (ie. how many elements it represents).

Computes the capacity of a grid (ie. how many elements it represents).
sourceraw docstring

hypercube*clj

(hypercube* grid radius coords-center)

Builds a hypercube in a grid from coordinates expressing its center.

Builds a `hypercube` in a `grid` from `coordinates` expressing its center.
sourceraw docstring

hypercube->gridclj

(hypercube->grid hypercube)

Transforms a hypercube into a grid.

Transforms a `hypercube` into a `grid`.
sourceraw docstring

normalize-coordsclj

(normalize-coords grid coords)

Normalizes coordinates to be between 0 and 1.

Normalizes `coordinates` to be between 0 and 1.
sourceraw docstring

relative-coordsclj

(relative-coords grid-1 grid-2 coords-2)

Maps coordinates in grid-2 to relative coordinates in grid-1.

Maps `coordinates` in `grid-2` to relative `coordinates` in `grid-1`.
sourceraw docstring

relative-f-indexclj

(relative-f-index grid-1 grid-2 f-index-2)

Like relative-coords but works with flat-indexes.

Like `relative-coords` but works with `flat-index`es.
sourceraw docstring

sample-gridclj

(sample-grid grid n-sample)
(sample-grid grid n-sample rng)

Samples n-sample random elements from a grid.

Samples `n-sample` random `element`s from a grid.
sourceraw docstring

sample-hypercubeclj

(sample-hypercube grid hypercube n-sample)
(sample-hypercube grid hypercube n-sample rng)

Sample n-sample input bits from a hypercube within a grid.

Sample `n-sample` input bits from a `hypercube` within a `grid`.
sourceraw docstring

wrap-coordsclj

(wrap-coords grid coords)

Cf. wrapping in glossary.

Cf. `wrapping` in glossary.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close