Class: | Transform |
Parent: | Object |
The class Transform represents a three-dimensional transform matrix.
Returns a diagonal transform (the translational componets are all 0). In the first form, array[0], array[1], array[2] are for the x, y, z components, respectively. In the second form, f1, f2, f3 are the x, y, z components. If f3 is not given, the f2 is used for the z components. If f2 is not given, the f1 is used for the y and z components.
Returns a new Transform built from four column vectors. The arguments c1..c4 are vectors of (at least) three-dimension. This is equivalent to Transform.new([c1, c2, c3, c4]).
Returns a new Transform built from three row vectors. The arguments r1, r2, r3 are vectors of (at least) four-dimension.
Returns a transform corresponding to the inversion along the given center.
Returns a new Transform.
In the first form, an identity transform is returned.
In the second form, the array must be either of the following two forms: (1) [[a11 a21 a31] [a12 a22 a32] [a13 a23 a33] [a14 a24 a34]] (2) [a11 a21 a31 a12 a22 a32 a13 a23 a33 a14 a24 a34] where [a11..a33] denotes the rotation/reflexion part and [a14 a24 a34] denotes the translation part. All vectors in (1) are column vectors.
In the third form, a new transform is built from a 3x4 matrix. The argument matrix must respond to a method call matrix[col, row] where row is in 0..2 and col in 0..3, and must have methods column_size and row_size (although the size arguments are not evaluated but only their existence is checked).
Returns a transform corresponding to the reflection along the plane that is orthogonal to the axis and includes center.
Returns a transform corresponding to the rotation of angle (in degree) along the axis that is parallel to the given vec and includes center.
Give the Transform that translates cx to origin and rotates ax->x and ay->y. Ax and ay will be normalized, and if ax and ay are not perpendicular, (ax.cross(ay)).cross(ax).normalize is used instead of ay.
Perform the matrix multiplication. In the first form, a new matrix with scaled elements is returned. In the second, the transformed vector is returned. In the third form, the multiple of the two matrices is returned.
Returns a new transform corresponding to the sum of the two transform matrix.
Returns a new transform corresponding to the difference of the two transform matrix.
Returns self * val.invert. If val is not a regular transform, an exception is raised.
Returns true if and only if all the corresponding elements are equal. Usual caution about the comparison of floating-point numbers should be paid.
Get the element (i,j) of the transform matrix, i.e. column i, row j. Be careful about the order of the arguments. It follows convention of multi-dimensional arrays rather than mathematical notation.
Set the element (i,j) of the transform matrix, i.e. column i, row j. Be careful about the order of the arguments. It follows convention of multi-dimensional arrays rather than mathematical notation.
Calculate the eigenvalues and eigenvectors. The matrix must be symmetric.
Convert a transform to a string like "Transform[[a11,a21,a31],[a12,a22,a32],[a13,a23,a33],[a14,a24,a34]]".
Returns the inverse transform. If the matrix is not regular, an exception is raised.