Class Gridder

java.lang.Object
uk.ac.starlink.ttools.plot2.layer.Gridder

public class Gridder extends Object
Maps positions on a 2-d grid to a 1-d index.
Since:
15 Feb 2013
Author:
Mark Taylor
  • Constructor Summary

    Constructors
    Constructor
    Description
    Gridder(int nx, int ny)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Returns grid height.
    int
    getIndex(int ix, int iy)
    Returns the 1-d index corresponding to a given x,y position.
    int
    Returns the number of points in the grid and array.
    int
    Returns grid width.
    int
    getX(int index)
    Returns the X index corresponding to a pixel index.
    int
    getY(int index)
    Returns the Y index corresponding to a pixel index.
    int
     
    static Gridder
    Returns a Gridder instance that is the transpose of the supplied one.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Gridder

      public Gridder(int nx, int ny)
      Constructor.
      Parameters:
      nx - grid width
      ny - grid height
  • Method Details

    • getWidth

      public int getWidth()
      Returns grid width.
      Returns:
      width
    • getHeight

      public int getHeight()
      Returns grid height.
      Returns:
      height
    • getIndex

      public int getIndex(int ix, int iy)
      Returns the 1-d index corresponding to a given x,y position.
      Parameters:
      ix - x position
      iy - y position
      Returns:
      array index
    • getX

      public int getX(int index)
      Returns the X index corresponding to a pixel index.
      Parameters:
      index - 1-d index
      Returns:
      X position
    • getY

      public int getY(int index)
      Returns the Y index corresponding to a pixel index.
      Parameters:
      index - 1-d index
      Returns:
      Y position
    • getLength

      public int getLength()
      Returns the number of points in the grid and array.
      Returns:
      size
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • transpose

      public static Gridder transpose(Gridder base)
      Returns a Gridder instance that is the transpose of the supplied one. If the supplied instance does row-major indexing, the result does column-major instead.
      Parameters:
      base - input gridder
      Returns:
      gridder with X and Y transposed