|
CubeTwister 2.0alpha142 2012-02-11 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.randelshofer.geom3d.Transform3D
public class Transform3D
This class represents a 3D transform which performs a mapping from 3D coordinates to other 3D coordinates.
Such a coordinate transformation can be represented by a 4 row by
4 column matrix with an implied last row of [ 0 0 0 1 ] which
transforms source coordinates (x, y)
into
destination coordinates (x', y')
by considering
them to be a column vector and multiplying the coordinate vector
by the matrix according to the following process.
[ x'] = [ m00 m10 m20 m30 ] [ x ] = [ m00x + m10y + m20z + m30 ] [ y'] = [ m01 m11 m21 m31 ] [ y ] = [ m01x + m11y + m21z + m31 ] [ z'] = [ m02 m12 m22 m32 ] [ z ] = [ m02x + m12y + m22z + m32 ] [ 1 ] = [ 0 0 0 1 ] [ 1 ] = [ 1 ]
Field Summary | |
---|---|
double |
m00
|
double |
m01
|
double |
m02
|
double |
m10
|
double |
m11
|
double |
m12
|
double |
m20
|
double |
m21
|
double |
m22
|
double |
m30
|
double |
m31
|
double |
m32
|
Constructor Summary | |
---|---|
Transform3D()
Constructs a new Transform3D representing the Identity transformation. |
|
Transform3D(double[][] matrix)
Constructs a new transform from 12 double precision values representing the 12 specifiable entries of the 4x4 transformation matrix. |
|
Transform3D(double rx,
double ry,
double rz)
Constructs a Transform3D representing the specified rotation transformation. |
|
Transform3D(double m00,
double m10,
double m20,
double m30,
double m01,
double m11,
double m21,
double m31,
double m02,
double m12,
double m22,
double m32)
Constructs a new transform from 12 double precision values representing the 12 specifiable entries of the 4x4 transformation matrix. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates a clone of the object. |
void |
concatenate(Transform3D t)
Concatenates a transform Tx to this transform Cx. |
boolean |
equals(java.lang.Object obj)
Compares two Objects for equality. |
static Transform3D |
fromToRotation(Point3D from,
Point3D to)
|
Transform3D |
getInverse()
|
double[][] |
getMatrix()
Returns the complete 4x4 matrix representing this transform. |
int |
hashCode()
|
boolean |
isNaN()
Returns true, when at least one of the elements of the transform is NaN. |
void |
rotate(double rx,
double ry,
double rz)
Concatenates this transform with a rotation transformation. |
void |
rotateX(double rx)
Concatenates this transform with a rotation transformation. |
void |
rotateY(double ry)
Concatenates this transform with a rotation transformation. |
void |
rotateZ(double rz)
Concatenates this transform with a rotation transformation. |
void |
scale(double sx,
double sy,
double sz)
Concatenates this transform with a scaling transformation. |
void |
setToIdentity()
Resets this transform to the Identity transform. |
void |
setTransform(Transform3D Tx)
Sets this transform to a copy of the transform in the specified Transform3D object. |
java.lang.String |
toString()
|
void |
transform(float[] src,
int srcOffset,
float[] dest,
int destOffset,
int count)
Transforms the vertices of source array and stores the result in the dest array. |
void |
transform(Point3D pt)
Transforms the specified point. |
Point3D |
transform(Point3D ptSrc,
Point3D ptDst)
Transforms the specified ptSrc and stores the result in ptDst. |
Polygon3D |
transform(Polygon3D polySrc,
Polygon3D polyDst)
Transforms the specified polySrc and stores the result in polyDst. |
void |
translate(double tx,
double ty,
double tz)
Concatenates this transform with a translation transformation. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public double m00
public double m10
public double m20
public double m30
public double m01
public double m11
public double m21
public double m31
public double m02
public double m12
public double m22
public double m32
Constructor Detail |
---|
public Transform3D()
public Transform3D(double rx, double ry, double rz)
rx
- Rotation along the x axis in radians.ry
- Rotation along the y axis in radians.rz
- Rotation along the z axis in radians.public Transform3D(double m00, double m10, double m20, double m30, double m01, double m11, double m21, double m31, double m02, double m12, double m22, double m32)
public Transform3D(double[][] matrix)
Method Detail |
---|
public void setToIdentity()
public void rotate(double rx, double ry, double rz)
[ cos(rz)*cos(ry) cos(rz)*sin(ry)*sin(rx) cos(rz)*-sin(ry)*cos(rx) 0 ] +sin(rz)*cos(rx) +sin(rz)*-sin(ry)*cos(rx) [ -sin(rz)*cos(ry) -sin(rz)*sin(ry)*sin(rx) -sin(rz)*-sin(ry)*cos(rx) 0 ] +cos(rz)*cos(rx) +cos(rz)*sin(rx) [ sin(ry) cos(ry)*-sin(rx) cos(ry)*cos(rx) 0 ] [ 0 0 0 1 ]Positive values rotate counterclockwise.
rx
- Rotation along the x axis in radians.ry
- Rotation along the y axis in radians.rz
- Rotation along the z axis in radians.public void rotateX(double rx)
[ 1 0 0 0 ] [ 0 cos(rx) sin(rx) 0 ] [ 0 -sin(rx) cos(rx) 0 ] [ 0 0 0 1 ]Positive values rotate counterclockwise.
rx
- Rotation along the x axis in radians.public void rotateY(double ry)
[ cos(ry) 0 -sin(ry) 0 ] [ 0 1 0 0 ] [ sin(ry) 0 cos(ry) 0 ] [ 0 0 0 1 ]Positive values rotate counterclockwise.
ry
- Rotation along the y axis in radians.public void rotateZ(double rz)
[ cos(rz) sin(rz) 0 0 ] [ -sin(rz) cos(rz) 0 0 ] [ 0 0 1 0 ] [ 0 0 0 1 ]Positive values rotate counterclockwise.
rz
- Rotation along the z axis in radians.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 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 concatenate(Transform3D t)
[this] = [this] x [Tx]
t
- The transform object to be concatenated with
this transform object.public double[][] getMatrix()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the Object to compare with
Hashtable
public void transform(Point3D pt)
public Point3D transform(Point3D ptSrc, Point3D ptDst)
public Polygon3D transform(Polygon3D polySrc, Polygon3D polyDst)
public void transform(float[] src, int srcOffset, float[] dest, int destOffset, int count)
src
- Each group of three entries in this array describe a vector x, y, z.srcOffset
- Index of the first vector.dest
- Each group of three entries in this array describe a vector x, y, z.destOffset
- Index of the first vector.count
- Number of vectors to be transformed.public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isNaN()
public void setTransform(Transform3D Tx)
Transform3D
object.
Tx
- the Transform3D
object from which to
copy the transformpublic int hashCode()
hashCode
in class java.lang.Object
public static Transform3D fromToRotation(Point3D from, Point3D to)
public Transform3D getInverse()
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |