Class Gridder
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.Gridder
-
public class Gridder extends java.lang.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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
getHeight()
Returns grid height.int
getIndex(int ix, int iy)
Returns the 1-d index corresponding to a given x,y position.int
getLength()
Returns the number of points in the grid and array.int
getWidth()
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
hashCode()
static Gridder
transpose(Gridder base)
Returns a Gridder instance that is the transpose of the supplied one.
-
-
-
Method Detail
-
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 positioniy
- 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 classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
-