- java.lang.Object
-
- org.arakhne.afc.math.matrix.Matrix4d
-
- org.arakhne.afc.math.geometry.d3.Transform3D
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class Transform3D extends Matrix4d
A 3D transformation. Is represented internally as a 4x4 floating point matrix. The mathematical representation is row major, as in traditional matrix mathematics.The transformation matrix is:
| r11 | r12 | r13 | Tx | | r21 | r22 | r23 | Ty | | r31 | r32 | r33 | Tz | | 0 | 0 | 0 | 1 |
- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Thomas PIOTROWSKI, Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Constructor Summary
Constructors Constructor Description Transform3D()
Constructs a new Transform3D object and sets it to the identity transformation.Transform3D(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23)
Constructs and initializes a Matrix4f from the specified nine values.Transform3D(Transform3D transform)
Constructs a new Transform2D object and initializes it from the specified transform.Transform3D(Matrix4d matrix)
Constructor by copy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Transform3D
clone()
Creates a new object of the same class as this object.double
getTranslationX()
Replies the X translation.double
getTranslationY()
Replies the Y translation.double
getTranslationZ()
Replies the Z translation.void
makeRotationMatrix(double angle)
Sets the value of this matrix to a rotation matrix, and no translation.void
makeRotationMatrix(Quaternion rotation)
Sets the value of this matrix to a rotation matrix, and no translation.void
makeTranslationMatrix(double dx, double dy, double dz)
Sets the value of this matrix to the given translation, without rotation.void
rotate(Quaternion rotation)
Rotate the object.void
set(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23)
Set the components of the transformation.void
setRotation(double angle)
Set this transform's rotation.void
setRotation(Quaternion rotation)
Set the rotation for the object but do not change the translation.void
setTranslation(double x, double y, double z)
Set the position.void
setTranslation(Tuple3D<?> translation)
Set the position.void
transform(Tuple3D<?> t)
Multiply this matrix by the tuple t and place the result back into the tuple (t = this*t).void
transform(Tuple3D<?> t, Tuple3D<?> result)
Multiply this matrix by the tuple t and and place the result into the tuple "result" (result = this*t).void
translate(double dx, double dy, double dz)
Translate the position.void
translate(Vector3D<?,?> translation)
Translate the position.-
Methods inherited from class org.arakhne.afc.math.matrix.Matrix4d
$bang, $div, $minus, $minus, $minus, $plus, $plus, $times, $times, add, add, add, add, determinant, epsilonEquals, equals, equals, getColumn, getElement, getM00, getM01, getM02, getM03, getM10, getM11, getM12, getM13, getM20, getM21, getM22, getM23, getM30, getM31, getM32, getM33, getRow, hashCode, isIdentity, isSymmetric, mul, mul, mul, mul, negate, negate, operator_add, operator_add, operator_divide, operator_minus, operator_minus, operator_minus, operator_moinsMoins, operator_multiply, operator_multiply, operator_not, operator_plus, operator_plus, operator_plusPlus, operator_remove, operator_remove, set, set, set, setColumn, setColumn, setDiagonal, setElement, setIdentity, setM00, setM01, setM02, setM03, setM10, setM11, setM12, setM13, setM20, setM21, setM22, setM23, setM30, setM31, setM32, setM33, setRow, setRow, setZero, sub, sub, toString, transpose, transpose
-
-
-
-
Field Detail
-
IDENTITY
public static final Transform3D IDENTITY
This is the identifity transformation.
-
-
Constructor Detail
-
Transform3D
public Transform3D()
Constructs a new Transform3D object and sets it to the identity transformation.
-
Transform3D
public Transform3D(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23)
Constructs and initializes a Matrix4f from the specified nine values.- Parameters:
m00
- the [0][0] elementm01
- the [0][1] elementm02
- the [0][2] elementm03
- the [0][3] elementm10
- the [1][0] elementm11
- the [1][1] elementm12
- the [1][2] elementm13
- the [1][3] elementm20
- the [2][0] elementm21
- the [2][1] elementm22
- the [2][2] elementm23
- the [2][3] element
-
Transform3D
public Transform3D(Transform3D transform)
Constructs a new Transform2D object and initializes it from the specified transform.- Parameters:
transform
- the transformation to copy.
-
Transform3D
public Transform3D(Matrix4d matrix)
Constructor by copy.- Parameters:
matrix
- the matrix to copy.
-
-
Method Detail
-
clone
@Pure public Transform3D clone()
Description copied from class:Matrix4d
Creates a new object of the same class as this object.
-
setTranslation
public void setTranslation(double x, double y, double z)
Set the position.This function changes only the elements of the matrix related to the translation. The scaling and the shearing are not changed.
After a call to this function, the matrix will contains (? means any value):
[ ? ? x ] [ ? ? y ] [ ? ? z ] [ ? ? ? ]
- Parameters:
x
- x translation.y
- y translation.z
- z translation.- See Also:
makeTranslationMatrix(double, double, double)
-
setTranslation
public void setTranslation(Tuple3D<?> translation)
Set the position.This function changes only the elements of the matrix related to the translation. The scaling and the shearing are not changed.
After a call to this function, the matrix will contains (? means any value):
[ ? ? t.x ] [ ? ? t.y ] [ ? ? t.z ] [ ? ? ? ]
- Parameters:
translation
- the translation- See Also:
makeTranslationMatrix(double, double, double)
-
translate
public void translate(double dx, double dy, double dz)
Translate the position.This function is equivalent to:
this = this * [ 0 0 0 dx ] [ 0 0 0 dy ] [ 0 0 0 dz ] [ 0 0 0 1 ]
- Parameters:
dx
- the x translationdy
- the y translationdz
- the z translation
-
translate
public void translate(Vector3D<?,?> translation)
Translate the position.This function is equivalent to:
this = this * [ 0 0 0 t.x ] [ 0 0 0 t.y ] [ 0 0 0 t.z ] [ 0 0 0 1 ]
- Parameters:
translation
- the translation
-
getTranslationX
@Pure public double getTranslationX()
Replies the X translation.- Returns:
- the amount
-
getTranslationY
@Pure public double getTranslationY()
Replies the Y translation.- Returns:
- the amount
-
getTranslationZ
@Pure public double getTranslationZ()
Replies the Z translation.- Returns:
- the amount
-
setRotation
public void setRotation(Quaternion rotation)
Set the rotation for the object but do not change the translation.This function changes only the elements of the matrix related to the rotation. The translation is not changed.
After a call to this function, the matrix will contains (? means any value, and r is the translation of the quaternion as a 3x3 matrix):
[ r r r ? ] [ r r r ? ] [ r r r ? ] [ ? ? ? ? ]
- Parameters:
rotation
- the rotation- See Also:
makeRotationMatrix(Quaternion)
-
setRotation
public void setRotation(double angle)
Set this transform's rotation.- Parameters:
angle
- the rotation angle.
-
rotate
public void rotate(Quaternion rotation)
Rotate the object.This function is equivalent to (where r is the translation of the quaternion as a 3x3 matrix):
this = this * [ r r r 0 ] [ r r r 0 ] [ r r r 0 ] [ 0 0 0 1 ]
- Parameters:
rotation
- the rotationi
-
makeRotationMatrix
public final void makeRotationMatrix(Quaternion rotation)
Sets the value of this matrix to a rotation matrix, and no translation.This function changes all the elements of the matrix, including the translation.
After a call to this function, the matrix will contains (? means any value, and r a value from the quaternion):
[ r r r 0 ] [ r r r 0 ] [ r r r 0 ] [ 0 0 0 1 ]
- Parameters:
rotation
- the rotation- See Also:
setRotation(Quaternion)
-
makeRotationMatrix
public void makeRotationMatrix(double angle)
Sets the value of this matrix to a rotation matrix, and no translation.- Parameters:
angle
- the angle of the rotation
-
makeTranslationMatrix
public final void makeTranslationMatrix(double dx, double dy, double dz)
Sets the value of this matrix to the given translation, without rotation.This function changes all the elements of the matrix including the scaling and the shearing.
After a call to this function, the matrix will contains (? means any value):
[ 1 0 0 dx ] [ 0 1 0 dy ] [ 0 0 1 dz ] [ 0 0 0 1 ]
- Parameters:
dx
- is the position to put in the matrix.dy
- is the position to put in the matrix.dz
- is the position to put in the matrix.- See Also:
setTranslation(double, double, double)
,setTranslation(Tuple3D)
-
transform
public void transform(Tuple3D<?> t)
Multiply this matrix by the tuple t and place the result back into the tuple (t = this*t).- Parameters:
t
- the tuple to be multiplied by this matrix and then replaced
-
transform
public void transform(Tuple3D<?> t, Tuple3D<?> result)
Multiply this matrix by the tuple t and and place the result into the tuple "result" (result = this*t).- Parameters:
t
- the tuple to be multiplied by this matrixresult
- the tuple into which the product is placed
-
set
public void set(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23)
Set the components of the transformation.- Parameters:
m00
- the [0][0] elementm01
- the [0][1] elementm02
- the [0][2] elementm03
- the [0][3] elementm10
- the [1][0] elementm11
- the [1][1] elementm12
- the [1][2] elementm13
- the [1][3] elementm20
- the [2][0] elementm21
- the [2][1] elementm22
- the [2][2] elementm23
- the [2][3] element
-
-