BIJ API

VolumeJ
Class VJMatrix

java.lang.Object
  |
  +--VolumeJ.VJMatrix

public class VJMatrix
extends java.lang.Object

This class implements a transformation matrix and 3D transformation methods on it. It also implements the tranformations necessary for the shear-warp rendering algorithm as defined in Lacroute's thesis. Interface leans heavily on Foley, van Dam. Computer Graphics. Second ed. Copyright (c) 1999-2002, Michael Abramoff. All rights reserved.


Constructor Summary
VJMatrix()
          Create a new transformation matrix initialized to the unit matrix.
VJMatrix(float[][] m)
          Create a new transformation matrix from a float[][] matrix.
VJMatrix(VJMatrix vjm)
          Create a new transformation matrix initialized to another matrix.
 
Method Summary
 float[] getColumn(int n)
          Return the n-th column of the 3D transform matrix as a vector.
static float[] getMax(float[][] vertex, int dimension)
          Find the homogenuous coordinate with the highest value in an array of coordinates.
static float[] getMin(float[][] vertex, int dimension)
          Find the homogenuous coordinate with the lowest value on a dimension in an array of coordinates.
 float getOversamplingRatio()
          Return the oversampling ratio for this (usually inverse) transformation matrix.
 double[] getShearCoefficients()
          Return the shear coefficients as defined in Lacroute's thesis.
 boolean getSliceOrder(double sci, double scj)
          Return the slice order as defined in Lacroutes thesis.
 float[] getStepperColumn()
          Return the third column of the 3D transform matrix as a vector.
 double[] getViewingVector()
          Return the viewing vector as defined in Lacroute's thesis.
 VJMatrix inverse()
          Invert this matrix.
 float[] mul(float[] v)
          Multiply a vector v with this transformation matrix and return the result as a vector.
 void mul(VJMatrix m0)
          Multiply this transformation matrix with another transformation matrix in place.
static float[] newVector(float x, float y, float z)
          Create a new 3-D homogenuous vector from 3 coordinates.
 void permutation(int axis)
          Make a permutation for one of the major axes (x,y,z) Used for shear-warp rendering.
 void rotatex(double theta)
          Rotate the coordinate system around the x axis.
 void rotatey(double theta)
          Rotate the coordinate system around the y axis.
 void rotatez(double theta)
          Rotate the coordinate system around the z axis.
 void scale(double sx, double sy, double sz)
          Scale the coordinate system by sx, sy, sz.
 void shear(double sx, double sy)
          Shear the coordinate system by sx, sy.
 java.lang.String toString()
           
 void translate(double tx, double ty, double tz)
          Translate the coordinate system to tx, ty, tz.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VJMatrix

public VJMatrix()
Create a new transformation matrix initialized to the unit matrix.

VJMatrix

public VJMatrix(float[][] m)
Create a new transformation matrix from a float[][] matrix.

VJMatrix

public VJMatrix(VJMatrix vjm)
Create a new transformation matrix initialized to another matrix.
Parameters:
m1 - the matrix that is copied to this matrix.
Method Detail

newVector

public static float[] newVector(float x,
                                float y,
                                float z)
Create a new 3-D homogenuous vector from 3 coordinates.

translate

public void translate(double tx,
                      double ty,
                      double tz)
Translate the coordinate system to tx, ty, tz.
Parameters:
tx,ty,tz - the amounts to translate on each of the three axes.

scale

public void scale(double sx,
                  double sy,
                  double sz)
Scale the coordinate system by sx, sy, sz.
Parameters:
sx,sy,sz - the amounts to scale by on each of the three axes.

rotatex

public void rotatex(double theta)
Rotate the coordinate system around the x axis.
Parameters:
theta - the amount to rotate (in degrees)

rotatey

public void rotatey(double theta)
Rotate the coordinate system around the y axis.
Parameters:
theta - the amount to rotate (in degrees)

rotatez

public void rotatez(double theta)
Rotate the coordinate system around the z axis.
Parameters:
theta - the amount to rotate (in degrees)

mul

public float[] mul(float[] v)
Multiply a vector v with this transformation matrix and return the result as a vector.
Parameters:
v - a 4-D homogeneous vector (x,y,z,w).
Returns:
a 4-D vector

getMin

public static float[] getMin(float[][] vertex,
                             int dimension)
Find the homogenuous coordinate with the lowest value on a dimension in an array of coordinates.
Parameters:
vertex - an array of double[4] coordinates.
dimension - the axis on which you want the maximum value.
Returns:
the coordinate with the lowest value on the chose dimension.

getMax

public static float[] getMax(float[][] vertex,
                             int dimension)
Find the homogenuous coordinate with the highest value in an array of coordinates.
Parameters:
vertex - an array of double[4] coordinates.
dimension - the axis on which you want the maximum value.
Returns:
the coordinate with the highest value on the chosen dimension.

mul

public void mul(VJMatrix m0)
Multiply this transformation matrix with another transformation matrix in place. this = m1 this
Parameters:
ml - a VJMatrix.

getStepperColumn

public float[] getStepperColumn()
Return the third column of the 3D transform matrix as a vector. This can be used to step through the coordinate system incrementally along the z-axis.
Returns:
a 4-D vector

getColumn

public float[] getColumn(int n)
Return the n-th column of the 3D transform matrix as a vector. This can be used to step through the coordinate system incrementally along an arbitrary axis.
Parameters:
the - axis for which to get the column. 0 = i, 1 = j, 2 = k axis.
Returns:
a 4-D vector

getOversamplingRatio

public float getOversamplingRatio()
Return the oversampling ratio for this (usually inverse) transformation matrix. The oversampling ration N is defined by the inverse of the distance you travel in objectspace for a unitary step in k-space.
Returns:
the ratio as a double.

shear

public void shear(double sx,
                  double sy)
Shear the coordinate system by sx, sy.
Parameters:
sx,sy - the amounts of shear by on each of the two axes.

permutation

public void permutation(int axis)
Make a permutation for one of the major axes (x,y,z) Used for shear-warp rendering.
Parameters:
axis - the axis around which to permute.

getViewingVector

public double[] getViewingVector()
Return the viewing vector as defined in Lacroute's thesis.

getSliceOrder

public boolean getSliceOrder(double sci,
                             double scj)
Return the slice order as defined in Lacroutes thesis. Returns true in inverse slice order, false if straight slice order.

getShearCoefficients

public double[] getShearCoefficients()
Return the shear coefficients as defined in Lacroute's thesis.

inverse

public VJMatrix inverse()
Invert this matrix. Slow, since it also checks whether the inverse is correct. Interfaces to BIJMatrix.
Returns:
a VJMatrix with the inverse of this matrix.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

BIJ API

Submit a bug or feature

Copyright (c) 1997-2003 Michael Abramoff
Licensing available. All Rights Reserved.