edu.jhu.ece.iacl.jist.structures.geom
Class GridPt

java.lang.Object
  extended by Point3i
      extended by edu.jhu.ece.iacl.jist.structures.geom.GridPt
All Implemented Interfaces:
java.lang.Comparable

public class GridPt
extends Point3i
implements java.lang.Comparable

The Class GridPt.


Nested Class Summary
static class GridPt.Connectivity
          The Enum Connectivity.
 
Field Summary
protected  GridPt.Connectivity conn
          The conn.
protected  double data
          The data.
 
Constructor Summary
GridPt(int x, int y, int z)
          Instantiates a new grid pt.
GridPt(int x, int y, int z, double d)
          Instantiates a new grid pt.
GridPt(Point3f pt)
          Instantiates a new grid pt.
GridPt(Point3f pt, double d)
          Instantiates a new grid pt.
 
Method Summary
 int compareTo(java.lang.Object o)
           
 double distance(double x, double y, double z)
          Distance.
static double distance(double x1, double y1, double z1, double x2, double y2, double z2)
          Distance.
 double distance(GridPt otherpt)
          Distance.
 double distance(GridPt otherpt, float resX, float resY, float resZ)
          Distance.
 double distance(XYZ otherpt)
          Distance.
 boolean equals(GridPt pt)
          Equals.
 double getData()
          Gets the data.
 double magnitude()
          Magnitude.
 GridPt[] neighborhood()
          Neighborhood.
 GridPt[] neighborhood18C()
          Neighborhood18 c.
static GridPt[] neighborhood18C(GridPt pt)
          Neighborhood18 c.
static GridPt[] neighborhood18C(int i, int j, int k)
          Neighborhood18 c.
 GridPt[] neighborhood26C()
          Neighborhood26 c.
static GridPt[] neighborhood26C(GridPt pt)
          Neighborhood26 c.
static GridPt[] neighborhood26C(int i, int j, int k)
          Neighborhood26 c.
 GridPt[] neighborhood6C()
          Neighborhood6 c.
static GridPt[] neighborhood6C(GridPt pt)
          Neighborhood6 c.
static GridPt[] neighborhood6C(int i, int j, int k)
          Neighborhood6 c.
static GridPt[] onlyInBounds(GridPt[] list, int xlen, int ylen, int zlen)
          If a Grid Point is out of bounds, a null element will be put in its place.
 GridPt roundInBounds(int xmax, int ymax, int zmax)
          Round in bounds.
 void setConnectivity(GridPt.Connectivity c)
          Sets the connectivity.
 void setData(float d)
          Sets the data.
static double sqrdistance(double x1, double y1, double z1, double x2, double y2, double z2)
          Sqrdistance.
 double sqrdistance(XYZ otherpt)
          Sqrdistance.
 double[] toPolarCoord()
          To polar coord.
static double[] toPolarCoord(GridPt pt)
          To polar coord.
static double[] toPolarCoord(Point3f pt)
          To polar coord.
 java.lang.String toString()
           
 GridPt vectorFrom(GridPt otherpt)
          Vector from.
 GridPt vectorTo(GridPt otherpt)
          Vector to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected double data
The data.


conn

protected GridPt.Connectivity conn
The conn.

Constructor Detail

GridPt

public GridPt(int x,
              int y,
              int z)
Instantiates a new grid pt.

Parameters:
x - the x
y - the y
z - the z

GridPt

public GridPt(int x,
              int y,
              int z,
              double d)
Instantiates a new grid pt.

Parameters:
x - the x
y - the y
z - the z
d - the d

GridPt

public GridPt(Point3f pt)
Instantiates a new grid pt.

Parameters:
pt - the pt

GridPt

public GridPt(Point3f pt,
              double d)
Instantiates a new grid pt.

Parameters:
pt - the pt
d - the d
Method Detail

magnitude

public double magnitude()
Magnitude.

Returns:
the double

distance

public double distance(double x,
                       double y,
                       double z)
Distance.

Parameters:
x - the x
y - the y
z - the z
Returns:
the double

distance

public double distance(GridPt otherpt)
Distance.

Parameters:
otherpt - the otherpt
Returns:
the double

distance

public double distance(GridPt otherpt,
                       float resX,
                       float resY,
                       float resZ)
Distance.

Parameters:
otherpt - the otherpt
resX - the res x
resY - the res y
resZ - the res z
Returns:
the double

distance

public double distance(XYZ otherpt)
Distance.

Parameters:
otherpt - the otherpt
Returns:
the double

vectorTo

public GridPt vectorTo(GridPt otherpt)
Vector to.

Parameters:
otherpt - the otherpt
Returns:
the grid pt

vectorFrom

public GridPt vectorFrom(GridPt otherpt)
Vector from.

Parameters:
otherpt - the otherpt
Returns:
the grid pt

getData

public double getData()
Gets the data.

Returns:
the data

setData

public void setData(float d)
Sets the data.

Parameters:
d - the new data

setConnectivity

public void setConnectivity(GridPt.Connectivity c)
Sets the connectivity.

Parameters:
c - the new connectivity

toPolarCoord

public double[] toPolarCoord()
To polar coord.

Returns:
the double[]

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

toPolarCoord

public static double[] toPolarCoord(GridPt pt)
To polar coord.

Parameters:
pt - the pt
Returns:
the double[]

toPolarCoord

public static double[] toPolarCoord(Point3f pt)
To polar coord.

Parameters:
pt - the pt
Returns:
the double[]

sqrdistance

public double sqrdistance(XYZ otherpt)
Sqrdistance.

Parameters:
otherpt - the otherpt
Returns:
the double

distance

public static double distance(double x1,
                              double y1,
                              double z1,
                              double x2,
                              double y2,
                              double z2)
Distance.

Parameters:
x1 - the x1
y1 - the y1
z1 - the z1
x2 - the x2
y2 - the y2
z2 - the z2
Returns:
the double

sqrdistance

public static double sqrdistance(double x1,
                                 double y1,
                                 double z1,
                                 double x2,
                                 double y2,
                                 double z2)
Sqrdistance.

Parameters:
x1 - the x1
y1 - the y1
z1 - the z1
x2 - the x2
y2 - the y2
z2 - the z2
Returns:
the double

equals

public boolean equals(GridPt pt)
Equals.

Parameters:
pt - the pt
Returns:
true, if successful

neighborhood6C

public GridPt[] neighborhood6C()
Neighborhood6 c.

Returns:
the grid pt[]

neighborhood18C

public GridPt[] neighborhood18C()
Neighborhood18 c.

Returns:
the grid pt[]

neighborhood26C

public GridPt[] neighborhood26C()
Neighborhood26 c.

Returns:
the grid pt[]

neighborhood

public GridPt[] neighborhood()
Neighborhood.

Returns:
the grid pt[]

neighborhood6C

public static GridPt[] neighborhood6C(GridPt pt)
Neighborhood6 c.

Parameters:
pt - the pt
Returns:
the grid pt[]

neighborhood6C

public static GridPt[] neighborhood6C(int i,
                                      int j,
                                      int k)
Neighborhood6 c.

Parameters:
i - the i
j - the j
k - the k
Returns:
the grid pt[]

neighborhood18C

public static GridPt[] neighborhood18C(GridPt pt)
Neighborhood18 c.

Parameters:
pt - the pt
Returns:
the grid pt[]

neighborhood18C

public static GridPt[] neighborhood18C(int i,
                                       int j,
                                       int k)
Neighborhood18 c.

Parameters:
i - the i
j - the j
k - the k
Returns:
the grid pt[]

neighborhood26C

public static GridPt[] neighborhood26C(GridPt pt)
Neighborhood26 c.

Parameters:
pt - the pt
Returns:
the grid pt[]

neighborhood26C

public static GridPt[] neighborhood26C(int i,
                                       int j,
                                       int k)
Neighborhood26 c.

Parameters:
i - the i
j - the j
k - the k
Returns:
the grid pt[]

toString

public java.lang.String toString()

roundInBounds

public GridPt roundInBounds(int xmax,
                            int ymax,
                            int zmax)
Round in bounds.

Parameters:
xmax - the xmax
ymax - the ymax
zmax - the zmax
Returns:
the grid pt

onlyInBounds

public static GridPt[] onlyInBounds(GridPt[] list,
                                    int xlen,
                                    int ylen,
                                    int zlen)
If a Grid Point is out of bounds, a null element will be put in its place.

Parameters:
list - Array of Grid Points to keep in bounds
xlen - Max x
ylen - Max y
zlen - Max z
Returns:
the grid pt[]