Package net.paulhertz.pixelaudio

# Class MooreGen

java.lang.Object
net.paulhertz.pixelaudio.PixelMapGen
net.paulhertz.pixelaudio.MooreGen

public class MooreGen extends PixelMapGen
Generates a Moore curve over a square bitmap starting at (width/2 - 1, 0) and ending at (width/2, 0). Width and height must be equal powers of 2. You can also call MooreGen(int depth) and width and height will equal Math.pow(2, depth). The Moore curve is generated by rotating and reflecting 4 copies of a Hilbert curve with a depth of recursion one level lower.

See Also:
  - `PixelMapGen`
  - `HilbertGen`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `int`
  `depth`
  recursion depth
  `static final String`
  `description`

  ### Fields inherited from class net.paulhertz.pixelaudio.PixelMapGen

  `coords, flipx, flipy, fx270, fx90, h, nada, pixelMap, r180, r270, r90, sampleMap, size, transArray, transformType, w`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MooreGen(int depth)`
  `MooreGen(int width, int height)`
  `MooreGen(int width, int height, AffineTransformType type)`
  `MooreGen(int depth, AffineTransformType type)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `describe()`
  `int[]`
  `generate()`
  Initialization method that sets `this.coords`, and then `this.pixelMap` and `this.sampleMap`: `this.coords` is a list of coordinate pairs representing the signal path, the (x,y) pixel locations along a path that visits every pixel in a bitmap exactly once.
  `private ArrayList<int[]>`
  `generateCoordinates()`
  `private ArrayList<int[]>`
  `generateMooreCoordinates(int n)`
  `boolean`
  `validate(int width, int height)`

  ### Methods inherited from class net.paulhertz.pixelaudio.PixelMapGen

  `findNearestPowerOfTwoLessThan, findPowerOfTwo, getCoordinates, getCoordinatesCopy, getHeight, getInversMapFromPixelArray, getPixelMap, getPixelMapCopy, getPixelMapFromCoordinates, getSampleMap, getSampleMapCopy, getSize, getTransformType, getWidth, isPowerOfTwo, loadIndexMaps, randomTransform, setMapsFromCoords, setTransformType, transformCoords`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### depth

    public int depth
    recursion depth

  - ### description

    public static final String description
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### MooreGen

    public MooreGen(int width, int height, AffineTransformType type)

  - ### MooreGen

    public MooreGen(int width, int height)

  - ### MooreGen

    public MooreGen(int depth)

  - ### MooreGen

    public MooreGen(int depth, AffineTransformType type)

- ## Method Details

  - ### describe

    public String describe()
    Specified by:
      `describe` in class `PixelMapGen`
    Returns:
      A String describing the mapping generated by your class and any initialization requirements.

  - ### validate

    public boolean validate(int width, int height)
    Specified by:
      `validate` in class `PixelMapGen`
    Returns:
      true if the width and height parameters are valid for creating a mapping with this generator, otherwise, false.

  - ### generate

    public int[] generate()
    Description copied from class: `PixelMapGen`

    Initialization method that sets `this.coords`, and then `this.pixelMap` and `this.sampleMap`: `this.coords` is a list of coordinate pairs representing the signal path, the (x,y) pixel locations along a path that visits every pixel in a bitmap exactly once. Once you have created it, you can call `setMapsFromCoords()` to set `this.pixelMap` and `this.sampleMap` automatically.

    `generate()` must be called from your class, so that you can initialize any local variables before generating coordinates and LUTs. The best place to call it is typically on the last line of the constructor for your class, after calling super() on the first line and after initializing any local variables needed to generate your coordinates and LUTs. You must initialize `this.coords`, `this.pixelMap`, and `this.sampleMap` within generate(). See `DiagonalZigzagGen` or `HilbertGen` for sample code.

    Specified by:
      `generate` in class `PixelMapGen`
    Returns:
      this.pixelMap, the value for PixelAudioMapper.signalToImageLUT.

  - ### generateCoordinates

    private ArrayList<int[]> generateCoordinates()
    Returns:
      an ArrayList<int[]> of x, y coordinate pairs that are the points traversed by a generalized space-filling curve over a bitmap of dimensions w * h.

  - ### generateMooreCoordinates

    private ArrayList<int[]> generateMooreCoordinates(int n)
    Parameters:
      `n` - the number of coordinate pairs to generate.
    Returns:
      an ArrayList<int[]> of x, y coordinate pairs that are the points traversed by a generalized space-filling curve over a bitmap of dimensions w * h.