public class Matrix3D extends Object implements XYZindices, UVWindices, Cloneable, org.freehep.xml.io.XMLIO
X, Y, Z
U, V, W
Constructor and Description |
---|
Matrix3D()
Creates an identity matrix.
|
Matrix3D(double m00,
double m10,
double m20,
double m01,
double m11,
double m21,
double m02,
double m12,
double m22,
double m03,
double m13,
double m23)
Creates a matrix with given parameters.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
void |
concatenate(Matrix3D m)
Concatenates this matrix with m, such that M' = M * m.
|
Matrix3D |
createInverse()
Creates and returns the inverse of this matrix.
|
Matrix3D |
createNormalized()
Create and returnes a normalized matrix of this matrix.
|
Matrix3D |
createOrthonormalized()
Create and return the orthonormalized rotation matrix by using the
Gram-Schmidt algorithm.
|
boolean |
equals(Object obj) |
double |
getDeterminant()
Returns the determinant.
|
static Matrix3D |
getRotateInstance(double phi,
double theta,
double omega)
Returns a rotate matrix to rotate omega over the Z-axis, theta over the
X-axis, followed phi over the Y-axis.
|
static Matrix3D |
getRotateInstance(double theta,
double nx,
double ny,
double nz)
Returns a rotate matrix to rotate theta radians over unit vector (nx, ny,
nz).
|
double |
getRotation(double[] n)
Returns the angle and unit vector of the rotation matrix of this matrix.
|
double |
getScaleX()
Returns the sx value (m00).
|
double |
getScaleY()
Returns the sy value (m11).
|
double |
getScaleZ()
Returns the sz value (m22).
|
double |
getTranslateX()
Returns the tx value (m03).
|
double |
getTranslateY()
Returns the ty value (m13).
|
double |
getTranslateZ()
Returns the tz value (m23).
|
int |
hashCode() |
void |
modelTranslate(double tx,
double ty,
double tz)
Model-Translates by tx, ty and tz.
|
void |
preConcatenate(Matrix3D m)
Pre-concatenates this matrix with m, such that M' = m * M.
|
void |
restore(org.freehep.xml.io.XMLIOManager xmlioManager,
org.jdom.Element nodeEl) |
void |
rotate(double theta,
double nx,
double ny,
double nz)
Rotates theta radians over unit vector (nx, ny, nz).
|
void |
rotateX(double phi)
Rotate phi radians over x-axis, where y to z is a positive rotation.
|
void |
rotateY(double theta)
Rotate theta radians over y-axis, where z to x is a positive rotation.
|
void |
rotateZ(double omega)
Rotate omega radians over z-axis, where x to y is a positive rotation.
|
void |
save(org.freehep.xml.io.XMLIOManager xmlioManager,
org.jdom.Element nodeEl) |
void |
scale(double sx,
double sy,
double sz)
Scales by sx, sy and sz.
|
void |
shear(double shx,
double shy)
Shears by shx and shy.
|
String |
toString() |
double[][] |
transform(double[][] xyz,
int n,
boolean delta)
Transforms xyz by this matrix for n points, using translation if delta is
false.
|
double[] |
transform(double[] xyz,
boolean delta)
Transforms xyz by this matrix, using translation if delta is false.
|
void |
translate(double tx,
double ty,
double tz)
Translates by tx, ty and tz.
|
public Matrix3D()
public Matrix3D(double m00, double m10, double m20, double m01, double m11, double m21, double m02, double m12, double m22, double m03, double m13, double m23)
public double getScaleX()
public double getScaleY()
public double getScaleZ()
public double getTranslateX()
public double getTranslateY()
public double getTranslateZ()
public static Matrix3D getRotateInstance(double theta, double nx, double ny, double nz)
[cos(theta)+nx*nx*(1-cos(theta)) nx*ny*(1-cos(theta))-nz*sin(theta) nx*nz*(1-cos(theta))+ny*sin(theta) 0 ] [ny*nx*(1-cos(theta)+nz*sin(theta) cos(theta)+ny*ny*(1-cos(theta)) ny*nz*(1-cos(theta))-nz*sin(theta) 0 ] [nz*nx*(1-cos(theta)-ny*sin(theta) nz*ny*(1-cos(theta))+nx*sin(theta) cos(theta)+nz*nz*(1-cos(theta)) 0 ] [0 0 0 1 ]see "M.Pique, Matrix Techniques, Graphics Gems I [GLASSNER, 1990], pp. 465-469"
public static Matrix3D getRotateInstance(double phi, double theta, double omega)
public void rotateX(double phi)
[1 0 0 0] [0 cos(phi) -sin(phi) 0] [0 sin(phi) cos(phi) 0] [0 0 0 1]See "Foley, van Dam, Computer Graphics, 1990, pp.213-222"
public void rotateY(double theta)
[cos(theta) 0 sin(theta) 0] [0 1 0 0] [-sin(theta) 0 cos(theta) 0] [0 0 0 1]See "Foley, van Dam, Computer Graphics, 1990, pp.213-222"
public void rotateZ(double omega)
[cos(omega) -sin(omega) 0 0] [sin(omega) cos(omega) 0 0] [0 0 1 0] [0 0 0 1]See "Foley, van Dam, Computer Graphics, 1990, pp.213-222"
public void rotate(double theta, double nx, double ny, double nz)
[cos(theta)+nx*nx*(1-cos(theta)) nx*ny*(1-cos(theta))-nz*sin(theta) nx*nz*(1-cos(theta))+ny*sin(theta) 0 ] [ny*nx*(1-cos(theta)+nz*sin(theta) cos(theta)+ny*ny*(1-cos(theta)) ny*nz*(1-cos(theta))-nz*sin(theta) 0 ] [nz*nx*(1-cos(theta)-ny*sin(theta) nz*ny*(1-cos(theta))+nx*sin(theta) cos(theta)+nz*nz*(1-cos(theta)) 0 ] [0 0 0 1 ]see "M.Pique, Matrix Techniques, Graphics Gems I [GLASSNER, 1990], pp. 465-469"
public void scale(double sx, double sy, double sz)
[ sx 0 0 0 ] [ 0 sy 0 0 ] [ 0 0 sz 0 ] [ 0 0 0 1 ]
public void shear(double shx, double shy)
[ 1 shx 0 0 ] [ shy 1 0 0 ] [ 0 0 1 0 ] [ 0 0 0 1 ]
public void translate(double tx, double ty, double tz)
[ 1 0 0 tx ] [ 0 1 0 ty ] [ 0 0 1 tz ] [ 0 0 0 1 ]
public void modelTranslate(double tx, double ty, double tz)
[ 1 0 0 tx ] [ 0 1 0 ty ] [ 0 0 1 tz ] [ 0 0 0 1 ]
public double getRotation(double[] n)
public double getDeterminant()
public Matrix3D createOrthonormalized()
public Matrix3D createNormalized()
public Matrix3D createInverse() throws NoninvertibleTransformException
NoninvertibleTransformException
public void concatenate(Matrix3D m)
public void preConcatenate(Matrix3D m)
public double[] transform(double[] xyz, boolean delta)
public double[][] transform(double[][] xyz, int n, boolean delta)
public void save(org.freehep.xml.io.XMLIOManager xmlioManager, org.jdom.Element nodeEl)
save
in interface org.freehep.xml.io.XMLIO
public void restore(org.freehep.xml.io.XMLIOManager xmlioManager, org.jdom.Element nodeEl)
restore
in interface org.freehep.xml.io.XMLIO
Copyright © 1996-2014 FreeHEP. All Rights Reserved.