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.
-
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.
-
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.
-
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
-
untranslate(double[], int)
- transform this Voxel to a position that is relative to a given
location.
-
untranslate(Voxel)
- transform this Voxel to a position that is relative to the given
Voxel.
pos
protected double pos[]
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
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
getNaxes
public int getNaxes()
- return the number of dimensions in the space containing this
Voxel
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.)
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.
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.
- 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
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.
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
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