    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class ncsa.horizon.util.Voxel

    java.lang.Object
       |
       +----ncsa.horizon.util.Voxel

public class Voxel
extends Object
implements Cloneable

a generalized description of a point in n-space whose dimensions n are specified in the constructor call.

The axes of the space are referred to through an index which, by default, begins with zero; however, the index that refers to the first axis can be set when the Voxel object is created using the appropriate constructor.

See also Volume, Slice, and Segment.

##

firstAxisIndex
pos

##

Voxel(int)
  create a Voxel in a space of nax dimensions and initialize it to the origin (i.e.
Voxel(int, double[])
  create a Voxel in a space of nax dimensions and initialize it with a position.
Voxel(int, int)
  create a Voxel in a space of nax dimensions and initialize it to the origin (i.e.
Voxel(Voxel, int)
  Create a Voxel that is a copy of another Voxel but with the specified index for the first axis

##

axisPos(int)
  get the projection of the Voxel's position along the i-th axis.
clone()
  create a deep copy of this Voxel
equals(Voxel)
  return true if another Voxel is (in principle) at the same location as this Voxel.
getFirstAxisIndex()
  return the index of the first axis (as defined during this object's construction).
getNaxes()
  return the number of dimensions in the space containing this Voxel
getValues()
  return an array of doubles representing the position along each axis.
getValues(int)
  return an array of doubles representing the position along each axis
main(String[])
  run this class as an application to test it
setAxisPos(int, double)
  set the projection of the Voxel's position along the i-th axis Axes are numbered beginning with 0.
setValues(double[])
  set the position along all axes with the values given in the input array.
setValues(double[], int)
  set the position along all axes with the values given in the input array.
toString()
  converts position to (x, y, ...) formatted string
translate(double[], int)
  move this Voxel to a relative position
translate(Voxel)
  move this Voxel to a relative position

##

pos

      protected double pos[]

firstAxisIndex

      protected int firstAxisIndex

##

Voxel

      public Voxel(int nax,
                   int firstAxisIndex) throws ArrayIndexOutOfBoundsException

  create a Voxel in a space of nax dimensions and initialize it to the origin (i.e. position = [0, 0, 0, ...]).
  Parameters:
    nax - number of axes or dimensions in the space
    firstAxisIndex - index of the first axis (can be <, =, or > 0)
  Throws: ArrayIndexOutOfBoundsException
    thrown if nax < 0

Voxel

      public Voxel(int nax) throws ArrayIndexOutOfBoundsException

  create a Voxel in a space of nax dimensions and initialize it to the origin (i.e. position = [0, 0, 0, ...]). The index of the first axis will be zero.
  Parameters:
    nax - number of axes or dimensions in the space
  Throws: ArrayIndexOutOfBoundsException
    thrown if nax < 0

Voxel

      public Voxel(int nax,
                   double in[]) throws ArrayIndexOutOfBoundsException

  create a Voxel in a space of nax dimensions and initialize it with a position. The index of the first axis will be zero.
  Parameters:
    nax - number of axes or dimensions in the space
    in - an array containing the position. The first nax elements will be used. If the array size is smaller than nax, the remaining components will be 0.
  Throws: ArrayIndexOutOfBoundsException
    thrown if nax < 0

Voxel

      public Voxel(Voxel vox,
                   int firstAxisIndex)

  Create a Voxel that is a copy of another Voxel but with the specified index for the first axis
  Parameters:
    vox - the input voxel
    firstAxisIndex - the index that should be used for the first axis in the new Voxel

##

getNaxes

      public int getNaxes()

  return the number of dimensions in the space containing this Voxel

getFirstAxisIndex

      public int getFirstAxisIndex()

  return the index of the first axis (as defined during this object's construction).

axisPos

      public double axisPos(int i) throws ArrayIndexOutOfBoundsException

  get the projection of the Voxel's position along the i-th axis. Axes are numbered using the convention defined when the Voxel was constructed.

setAxisPos

      public void setAxisPos(int i,
                             double value) throws ArrayIndexOutOfBoundsException

  set the projection of the Voxel's position along the i-th axis Axes are numbered beginning with 0.

getValues

      public double[] getValues(int firstaxis) throws ArrayIndexOutOfBoundsException

  return an array of doubles representing the position along each axis
  Parameters:
    firstaxis - index at which first value should appear
  Throws: ArrayIndexOutOfBoundsException
    if firstaxis < 0

getValues

      public double[] getValues()

  return an array of doubles representing the position along each axis. The first value will appear at the first axis index used when this object was constructed, unless that index is < 0, in which case the first value will appear at index 0.

setValues

      public void setValues(double newpos[],
                            int firstaxis) throws ArrayIndexOutOfBoundsException

  set the position along all axes with the values given in the input array.
  Parameters:
    newpos - array of doubles containing position values
    firstaxis - index at which first value appears in newpos
  Throws: ArrayIndexOutOfBoundsException
    if firstaxis < 0

setValues

      public void setValues(double newpos[])

  set the position along all axes with the values given in the input array. The first value will be assumed to be at the first index axis defined when this object was constructed, unless that index is < 0, in which case, the first value will be assumed to be at 0.
  Parameters:
    newpos - array of doubles containing position values

toString

      public String toString()

  converts position to (x, y, ...) formatted string
  Overrides:
    toString in class Object

clone

      public Object clone()

  create a deep copy of this Voxel
  Overrides:
    clone in class Object

translate

      public void translate(Voxel vox)

  move this Voxel to a relative position
  Parameters:
    vox - the relative position to add to this voxel's position; only dimensions that overlap this space will be added.

translate

      public void translate(double newpos[],
                            int firstaxis) throws ArrayIndexOutOfBoundsException

  move this Voxel to a relative position
  Parameters:
    newpos - the relative position to add to this voxel's position; only dimensions that overlap this space will be added.
    firstaxis - index at which first value appears in newpos

equals

      public boolean equals(Voxel vox)

  return true if another Voxel is (in principle) at the same location as this Voxel. For equality to be true, locations along extra axes (for either Voxel) must be zero.

main

      public static void main(String args[])

  run this class as an application to test it
  Parameters:
    args - components of a vector

    All Packages  Class Hierarchy  This Package  Previous  Next  Index