uk.ac.ed.ph.signal
Class Grid2d

java.lang.Object
  extended by javax.vecmath.Tuple2d
      extended by javax.vecmath.Point2d
          extended by uk.ac.ed.ph.signal.Grid2d
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
Image

public class Grid2d
extends javax.vecmath.Point2d

Class to implement a two dimensional regular grid used access Images using continuous variables.

See Also:
Serialized Form

Field Summary
protected  int height
           
protected  int width
           
 
Fields inherited from class javax.vecmath.Tuple2d
x, y
 
Constructor Summary
Grid2d()
          Default constructor, of width and height 0, and sample interval 1.0
Grid2d(Grid2d g)
          Conststructor to setup a grid being the copy of the specified grid
Grid2d(int width, int height)
          Constructor to setup Grid2d with sample interval of 1.0 and centre at 0,0
Grid2d(int width, int height, double delta)
          Constructor to setup Grid2d with specfied grid
Grid2d(int width, int height, double dx, double dy)
          Constructor to setup Grid2d with specified sample interval
 
Method Summary
 Grid2d clone()
          Method to return a clone of the current grid
 javax.vecmath.Point2d getCentre()
          Method to get the centre (actually the super class)
 double getDeltaX()
          Get the x sample internal
 double getDeltaY()
          Get the y sample internal
 int getHeight()
          Method to get the height
 javax.vecmath.Point2d getPoint(int i, int j)
          Method to get the real (double), location of a pixel located at i,j taking into account the centre and sampling intervals
 javax.vecmath.Point2d getPoint(javax.vecmath.Point2i p)
          Method to get the real (double), location of a pixel located at i,j taking into account the centre and sampling intervals
 javax.vecmath.Point2i getSample(javax.vecmath.Point2d p)
          Method to get the pixel location closest to the point specifed by x,y talking into account the centre and sampling internal.
 javax.vecmath.Point2d getSamplePoint(javax.vecmath.Point2d p)
          Method to get the scaled sample location at as Point2d
 int getWidth()
          Method to get the width
 double getXCentre()
          Method to get the x location of the centre
 double getXRange()
          get the horizontal range
 double getYCentre()
          Method to get the y location of the centre
 double getYRange()
          get the vertical range
 void setCentre(double x, double y)
          Method to set the centre
 void setCentre(javax.vecmath.Point2d c)
          Method to set the centre
 void setHeight(int h)
          Method to set the height
 void setRange(double range)
          Method to set the sample interval by specifing the the range of the grid
 void setRange(double xRange, double yRange)
          Method to set the sample interval by specifing the the range of the grid
 void setSampleGrid(double delta)
          Method to set the sample grid with one parameter
 void setSampleGrid(double dx, double dy)
          Method to set the sample grid
 void setWidth(int w)
          Method to set the width
 
Methods inherited from class javax.vecmath.Point2d
distance, distanceL1, distanceLinf, distanceSquared
 
Methods inherited from class javax.vecmath.Tuple2d
absolute, absolute, add, add, clamp, clamp, clampMax, clampMax, clampMin, clampMin, epsilonEquals, equals, equals, get, getX, getY, hashCode, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, set, set, set, set, setX, setY, sub, sub, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

width

protected int width

height

protected int height
Constructor Detail

Grid2d

public Grid2d()
Default constructor, of width and height 0, and sample interval 1.0


Grid2d

public Grid2d(int width,
              int height)
Constructor to setup Grid2d with sample interval of 1.0 and centre at 0,0

Parameters:
width - the width in pixels
height - the height in pixels

Grid2d

public Grid2d(int width,
              int height,
              double delta)
Constructor to setup Grid2d with specfied grid

Parameters:
width - the width in pixels
height - the height in pixels
delta - the sample grid in both x and y directions

Grid2d

public Grid2d(int width,
              int height,
              double dx,
              double dy)
Constructor to setup Grid2d with specified sample interval

Parameters:
width - the width of the grid
height - the height of the grid
dx - x sample interval
dy - y sample internal

Grid2d

public Grid2d(Grid2d g)
Conststructor to setup a grid being the copy of the specified grid

Parameters:
g - the specifing Grid2d
Method Detail

clone

public Grid2d clone()
Method to return a clone of the current grid

Overrides:
clone in class javax.vecmath.Tuple2d
Returns:
Grid2d clone of current Grid2d.

setWidth

public void setWidth(int w)
Method to set the width

Parameters:
w - the width in pixels

setHeight

public void setHeight(int h)
Method to set the height

Parameters:
h - the height in pixels

setSampleGrid

public void setSampleGrid(double dx,
                          double dy)
Method to set the sample grid

Parameters:
dx - x sample interval
dy - y sample interval

setSampleGrid

public void setSampleGrid(double delta)
Method to set the sample grid with one parameter

Parameters:
delta - x and y sample interval

setCentre

public void setCentre(double x,
                      double y)
Method to set the centre

Parameters:
x - the x location
y - the y location.

getCentre

public javax.vecmath.Point2d getCentre()
Method to get the centre (actually the super class)

Returns:
Point2d the centre

setCentre

public void setCentre(javax.vecmath.Point2d c)
Method to set the centre

Parameters:
c - the centre

getXCentre

public double getXCentre()
Method to get the x location of the centre

Returns:
double x location of the centre

getYCentre

public double getYCentre()
Method to get the y location of the centre

Returns:
double y location of the centre

getWidth

public int getWidth()
Method to get the width

Returns:
int the width of the sample grid

getHeight

public int getHeight()
Method to get the height

Returns:
int the height of the sample grid

getDeltaX

public double getDeltaX()
Get the x sample internal


getDeltaY

public double getDeltaY()
Get the y sample internal


setRange

public void setRange(double xRange,
                     double yRange)
Method to set the sample interval by specifing the the range of the grid

Parameters:
xRange - the x range
yRange - the y range

setRange

public void setRange(double range)
Method to set the sample interval by specifing the the range of the grid

Parameters:
range - the range in both x and y directions

getXRange

public double getXRange()
get the horizontal range

Returns:
double the horizontal range

getYRange

public double getYRange()
get the vertical range

Returns:
double the vertical range

getPoint

public javax.vecmath.Point2d getPoint(int i,
                                      int j)
Method to get the real (double), location of a pixel located at i,j taking into account the centre and sampling intervals

Parameters:
i - hozizontal pixel location
j - versical pixel location
Returns:
Point2d the location

getPoint

public javax.vecmath.Point2d getPoint(javax.vecmath.Point2i p)
Method to get the real (double), location of a pixel located at i,j taking into account the centre and sampling intervals

Parameters:
p - the pixel location
Returns:
Point2d the location

getSample

public javax.vecmath.Point2i getSample(javax.vecmath.Point2d p)
Method to get the pixel location closest to the point specifed by x,y talking into account the centre and sampling internal. If outside grid, will be set to invalid

Parameters:
p - the point
y - the y location
Returns:
Point2i the pixel location

getSamplePoint

public javax.vecmath.Point2d getSamplePoint(javax.vecmath.Point2d p)
Method to get the scaled sample location at as Point2d