Class ncsa.horizon.util.Voxel
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 begins with zero. See also Volume, Slice, and Segment.


Variable Index

 o pos

Constructor Index

 o Voxel(int)
create a Voxel in a space of nax dimensions and initialize it to the origin (i.e.
 o Voxel(int, double[])
create a Voxel in a space of nax dimensions and initialize it with a position.

Method Index

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

Variables

 o pos
  protected double pos[]

Constructors

 o 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, ...]).
Parameters:
nax - number of axes or dimensions in the space
Throws: ArrayIndexOutOfBoundsException
thrown if nax < 0
 o 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

Methods

 o getNaxes
  public int getNaxes()
return the number of dimensions in the space containing this Voxel
 o axisPos
  public double axisPos(int i) throws ArrayIndexOutOfBoundsException
get the projection of the Voxel's position along the i-th axis. (Axes are numbered such that the first axis is zero.)
 o 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.
 o 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
 o getValues
  public double[] getValues()
return an array of doubles representing the position along each axis.
 o 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
 o 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.
Parameters:
newpos - array of doubles containing position values
 o toString
  public String toString()
converts position to (x, y, ...) formatted string
Overrides:
toString in class Object
 o clone
  public Object clone()
create a deep copy of this Voxel
Overrides:
clone in class Object
 o 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.
 o 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
 o untranslate
  public void untranslate(Voxel vox)
transform this Voxel to a position that is relative to the given Voxel. Just as translate(Voxel) adds another Voxel to its own location, this method subtracts another Voxel from its own location.
Parameters:
vox - the position to subtract from this voxel's position; only dimensions that overlap this space will be subtracted.
 o untranslate
  public void untranslate(double thatpos[],
                          int firstaxis)
transform this Voxel to a position that is relative to a given location. Just as translate(Voxel) adds another Voxel to its own location, this method subtracts another position from its own location.
Parameters:
thatpos - the position to subtract to this voxel's position; only dimensions that overlap this space will be added.
firstaxis - index at which first value appears in newpos
 o 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.
 o 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