|
ImageScience 3.0.0 | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectimagescience.transform.Transform
public class Transform
Represents a 3D affine transformation matrix. The matrix has the following form:
[ axx axy axz axt ] [ ayx ayy ayz ayt ] [ azx azy azz azt ] [ 0 0 0 1 ]Methods are provided for easy manipulation of the matrix.
Field Summary | |
---|---|
double |
axt
The matrix element axt. |
double |
axx
The matrix element axx. |
double |
axy
The matrix element axy. |
double |
axz
The matrix element axz. |
double |
ayt
The matrix element ayt. |
double |
ayx
The matrix element ayx. |
double |
ayy
The matrix element ayy. |
double |
ayz
The matrix element ayz. |
double |
azt
The matrix element azt. |
double |
azx
The matrix element azx. |
double |
azy
The matrix element azy. |
double |
azz
The matrix element azz. |
Constructor Summary | |
---|---|
Transform()
Default constructor. |
|
Transform(double[][] array)
Array constructor. |
|
Transform(double axx,
double axy,
double axz,
double axt,
double ayx,
double ayy,
double ayz,
double ayt,
double azx,
double azy,
double azz,
double azt)
Element constructor. |
|
Transform(Transform transform)
Copy constructor. |
Method Summary | |
---|---|
double |
determinant()
Returns the determinant of the transformation matrix. |
Transform |
duplicate()
Duplicates the transform. |
boolean |
equals(Transform transform)
Indicates whether the transform is equal to the given transform. |
double[][] |
get()
Returns the transformation matrix as a 4 x 4 double array. |
double |
get(int row,
int column)
Returns the element at the given row and column of the transformation matrix. |
boolean |
identity()
Indicates whether the transformation matrix is equal to the identity matrix. |
void |
invert()
Inverts the transformation matrix. |
void |
reset()
Resets the transformation matrix to the identity matrix. |
void |
rotate(double angle,
int axis)
Rotates the transformation matrix. |
void |
scale(double factor,
int axis)
Scales the transformation matrix. |
void |
set(double[][] array)
Sets the elements of the transformation matrix to those of the given array. |
void |
set(double axx,
double axy,
double axz,
double axt,
double ayx,
double ayy,
double ayz,
double ayt,
double azx,
double azy,
double azz,
double azt)
Sets the elements of the transformation matrix to the given values. |
void |
set(int row,
int column,
double value)
Sets the element at the given row and column of the transformation matrix to the given value. |
void |
set(Transform transform)
Sets the elements of the transformation matrix to those of the given transform. |
void |
shear(double factor,
int axis,
int drive)
Shears the transformation matrix. |
java.lang.String |
string()
Returns a string representation of the transformation matrix. |
java.lang.String |
string(java.lang.String prefix,
java.lang.String delimit,
java.lang.String postfix)
Returns a formatted string representation of the transformation matrix. |
void |
transform(Point point)
Transforms the given point. |
void |
transform(Transform transform)
Transforms the transformation matrix. |
void |
translate(double distance,
int axis)
Translates the transformation matrix. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public double axx
public double axy
public double axz
public double axt
public double ayx
public double ayy
public double ayz
public double ayt
public double azx
public double azy
public double azz
public double azt
Constructor Detail |
---|
public Transform()
public Transform(Transform transform)
java.lang.NullPointerException
- If transform
is null
.public Transform(double[][] array)
array
- The array containing the transformation matrix. Must be a 4 x 4 array with the first index corresponding to the rows and second index corresponding to the columns of the matrix.
java.lang.IllegalArgumentException
- If array
is not a 4 x 4 array.
java.lang.NullPointerException
- If array
is null
.public Transform(double axx, double axy, double axz, double axt, double ayx, double ayy, double ayz, double ayt, double azx, double azy, double azz, double azt)
Method Detail |
---|
public Transform duplicate()
Transform
object that is an exact copy of this object. All information is copied and no memory is shared between this and the returned object.public boolean equals(Transform transform)
transform
- The transform to compare this transform with.
true
if transform
is not null
and its matrix is equal to the matrix of this object, or false
if this is not the case.public boolean identity()
true
if the transformation matrix is equal to the identity matrix, or false
if this is not the case.public void reset()
public double determinant()
public void invert()
java.lang.IllegalStateException
- If the transformation matrix is non-invertible.public void transform(Transform transform)
transform
- The transform to be applied.
java.lang.NullPointerException
- If transform
is null
.public void transform(Point point)
point
- The point to be transformed. The point is treated as a 3D point. That is, only its x
, y
, z
coordinates are used, which are replaced by their transformed coordinates.
java.lang.NullPointerException
- If point
is null
.public void rotate(double angle, int axis)
angle
- The rotation angle in degrees.axis
- The rotation axis. Must be one of Axes.X
, Axes.Y
, Axes.Z
.
java.lang.IllegalArgumentException
- If axis
is invalid.public void scale(double factor, int axis)
factor
- The scaling factor.axis
- The scaling axis. Must be one of Axes.X
, Axes.Y
, Axes.Z
.
java.lang.IllegalArgumentException
- If axis
is invalid.public void shear(double factor, int axis, int drive)
factor
- The shearing factor.axis
- The shearing axis. Must be one of Axes.X
, Axes.Y
, Axes.Z
.drive
- The driving axis. Must be one of Axes.X
, Axes.Y
, Axes.Z
.
java.lang.IllegalArgumentException
- If any of axis
or drive
is invalid.public void translate(double distance, int axis)
distance
- The translation distance.axis
- The translation axis. Must be one of Axes.X
, Axes.Y
, Axes.Z
.
java.lang.IllegalArgumentException
- If axis
is invalid.public void set(Transform transform)
java.lang.NullPointerException
- If transform
is null
.public void set(double axx, double axy, double axz, double axt, double ayx, double ayy, double ayz, double ayt, double azx, double azy, double azz, double azt)
public void set(double[][] array)
array
- The array containing the transformation matrix. Must be a 4 x 4 array with the first index corresponding to the rows and second index corresponding to the columns of the matrix.
java.lang.IllegalArgumentException
- If array
is not a 4 x 4 array.
java.lang.NullPointerException
- If array
is null
.public void set(int row, int column, double value)
row
- The row index. Must be 0
, 1
, or 2
(row 3
is fixed).column
- The column index. Must be 0
, 1
, 2
, or 3
.value
- The value.
java.lang.IllegalArgumentException
- If row
or column
is out of bounds.public double[][] get()
double
array.
public double get(int row, int column)
row
- The row index. Must be 0
, 1
, 2
, or 3
.column
- The column index. Must be 0
, 1
, 2
, or 3
.
java.lang.IllegalArgumentException
- If row
or column
is out of bounds.public java.lang.String string()
String
object containing a string representation of the transformation matrix.public java.lang.String string(java.lang.String prefix, java.lang.String delimit, java.lang.String postfix)
prefix
- The string put at the beginning of each matrix row.delimit
- The string put as delimiter between the matrix row elements.postfix
- The string put at the end of each matrix row.
String
object containing a formatted string representation of the transformation matrix.
|
ImageScience 3.0.0 | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (C) Erik Meijering. Permission to use this software and corresponding documentation for educational, research, and not-for-profit purposes, without a fee and without a signed licensing agreement, is granted, subject to the following terms and conditions.
IT IS NOT ALLOWED TO REDISTRIBUTE, SELL, OR LEASE THIS SOFTWARE, OR DERIVATIVE WORKS THEREOF, WITHOUT PERMISSION IN WRITING FROM THE COPYRIGHT HOLDER. THE COPYRIGHT HOLDER IS FREE TO MAKE VERSIONS OF THE SOFTWARE AVAILABLE FOR A FEE OR COMMERCIALLY ONLY.
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OF ANY KIND WHATSOEVER, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND CORRESPONDING DOCUMENTATION IS PROVIDED "AS IS". THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.