Package org.gvsig.dwg.lib.util
Class Matrix4D
java.lang.Object
org.gvsig.dwg.lib.util.Matrix4D
4x4dim double matrix used for perspective transformations.
The class is now declared final to allow a more aggresive optimization.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoididentity()Reset to identityvoidmoveBy(double x, double y, double z) Move the stuff.voidTranslate the originMatrix multiplication.Matrix multiplication of point.Matrix multiplication of vector.voidMatrix multiplication.voidMatrix multiplication from left.voidscale(double f) Scale.voidscale(double fx, double fy, double fz) Scale different in x,y,z.toString()OutputvoidTransformation of 1 point.voidTransform some points.voidTransformation of 1 vector.voidTransformacion de un punto considerando solo el plano horizontalvoidtranslate(double x, double y, double z) Translate the origin.voidTranslate the originvoidtranslateLeft(double x, double y, double z) Translate.voidTranslate the originvoidTransponize.voidxrot(double theta) Rotate theta degrees about the x axis.voidyrot(double theta) Rotate theta degrees about the y axis.voidzrot(double theta) Rotate theta degrees about the z axis.
-
Field Details
-
xx
public double xx -
xy
public double xy -
xz
public double xz -
xw
public double xw -
yx
public double yx -
yy
public double yy -
yz
public double yz -
yw
public double yw -
zx
public double zx -
zy
public double zy -
zz
public double zz -
zw
public double zw -
wx
public double wx -
wy
public double wy -
wz
public double wz -
ww
public double ww
-
-
Constructor Details
-
Matrix4D
public Matrix4D()Create identity matrix. -
Matrix4D
Copy constructor.- Parameters:
m- matrix to copy
-
Matrix4D
public Matrix4D(double mxx, double mxy, double mxz, double mxw, double myx, double myy, double myz, double myw, double mzx, double mzy, double mzz, double mzw, double mwx, double mwy, double mwz, double mww) - Parameters:
mxx- 1st elem in 1st rowmxy- 2nd elem in 1st rowmxz- 3rd elem in 1st rowmxw- 4th elem in 1st rowmyx- 1st elem in 2nd rowmyy- 2nd elem in 2nd rowmyz- 3rd elem in 2nd rowmyw- 4th elem in 2nd rowmzx- 1st elem in 3rd rowmzy- 2nd elem in 3rd rowmzz- 3rd elem in 3rd rowmzw- 4th elem in 3rd rowmwx- 1st elem in 4th rowmwy- 2nd elem in 4th rowmwz- 3rd elem in 4th rowmww- 4th elem in 4th row
-
-
Method Details
-
identity
public void identity()Reset to identity -
transponize
public void transponize()Transponize. -
mult
Matrix multiplication of vector.- Parameters:
v- vector to transform- Returns:
- transformed vector
-
transform
Transformation of 1 vector.- Parameters:
v- vector to transform
-
mult
Matrix multiplication of point.- Parameters:
p- point to transform- Returns:
- transformed point
-
transform
Transformation of 1 point.- Parameters:
p- point to transform
-
transformXY
Transformacion de un punto considerando solo el plano horizontal -
mult
Matrix multiplication.- Parameters:
m- matrix to multiply with- Returns:
- this * m
-
multBy
Matrix multiplication.- Parameters:
m- matrix to multply with
-
multLeftBy
Matrix multiplication from left.- Parameters:
m- matrix to multiply with.
-
translate
public void translate(double x, double y, double z) Translate the origin.- Parameters:
x- translation in xy- translation in yz- translation in z
-
translate
Translate the origin- Parameters:
v- translation vector
-
translateLeft
public void translateLeft(double x, double y, double z) Translate.- Parameters:
x- translation in xy- translation in yz- translation in z
-
translateLeft
Translate the origin- Parameters:
v- tranbslation vector
-
moveBy
public void moveBy(double x, double y, double z) Move the stuff.- Parameters:
x- translation in xy- translation in yz- translation in z
-
moveBy
Translate the origin- Parameters:
v- translation vector
-
yrot
public void yrot(double theta) Rotate theta degrees about the y axis.- Parameters:
theta- rotation angle in rad
-
xrot
public void xrot(double theta) Rotate theta degrees about the x axis.- Parameters:
theta- rotation angle in rad
-
zrot
public void zrot(double theta) Rotate theta degrees about the z axis.- Parameters:
theta- rotation angle in rad
-
scale
public void scale(double f) Scale.- Parameters:
f- factor to scale with.
-
scale
public void scale(double fx, double fy, double fz) Scale different in x,y,z.- Parameters:
fx- scaling factor in xfy- scaling factor in yfz- scaling factor in z
-
transform
Transform some points.- Parameters:
v- points to transformtx- transformed points x coordty- transformed points y coordtz- transformed points z coordnpoints- nr of points to transform
-
toString
Output
-