FreeMat

- Main Page
- Related Pages

vtkTransform

Section: Visualization Toolkit Common Classes

# Usage

A vtkTransform can be used to describe the full range of linear (also known as affine) coordinate transformations in three dimensions, which are internally represented as a 4x4 homogeneous transformation matrix. When you create a new vtkTransform, it is always initialized to the identity transformation.

The SetInput() method allows you to set another transform, instead of the identity transform, to be the base transformation. There is a pipeline mechanism to ensure that when the input is modified, the current transformation will be updated accordingly. This pipeline mechanism is also supported by the Concatenate() method.

Most of the methods for manipulating this transformation, e.g. Translate, Rotate, and Concatenate, can operate in either PreMultiply (the default) or PostMultiply mode. In PreMultiply mode, the translation, concatenation, etc. will occur before any transformations which are represented by the current matrix. In PostMultiply mode, the additional transformation will occur after any transformations represented by the current matrix.

This class performs all of its operations in a right handed coordinate system with right handed rotations. Some other graphics libraries use left handed coordinate systems and rotations.

To create an instance of class vtkTransform, simply invoke its constructor as follows

      obj = vtkTransform

# Methods

The class vtkTransform has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkTransform class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkTransform = obj.NewInstance ()`
- `vtkTransform = obj.SafeDownCast (vtkObject o)`
- `obj.Identity ()` - Set the transformation to the identity transformation. If the transform has an Input, then the transformation will be reset so that it is the same as the Input.
- `obj.Inverse ()` - Invert the transformation. This will also set a flag so that the transformation will use the inverse of its Input, if an Input has been set.
- `obj.Translate (double x, double y, double z)` - Create a translation matrix and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics.
- `obj.Translate (double x[3])` - Create a translation matrix and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics.
- `obj.Translate (float x[3])` - Create a translation matrix and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics.
- `obj.RotateWXYZ (double angle, double x, double y, double z)` - Create a rotation matrix and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics. The angle is in degrees, and (x,y,z) specifies the axis that the rotation will be performed around.
- `obj.RotateWXYZ (double angle, double axis[3])` - Create a rotation matrix and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics. The angle is in degrees, and (x,y,z) specifies the axis that the rotation will be performed around.
- `obj.RotateWXYZ (double angle, float axis[3])` - Create a rotation matrix and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics. The angle is in degrees, and (x,y,z) specifies the axis that the rotation will be performed around.
- `obj.RotateX (double angle)` - Create a rotation matrix about the X, Y, or Z axis and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics. The angle is expressed in degrees.
- `obj.RotateY (double angle)` - Create a rotation matrix about the X, Y, or Z axis and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics. The angle is expressed in degrees.
- `obj.RotateZ (double angle)` - Create a rotation matrix about the X, Y, or Z axis and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics. The angle is expressed in degrees.
- `obj.Scale (double x, double y, double z)` - Create a scale matrix (i.e. set the diagonal elements to x, y, z) and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics.
- `obj.Scale (double s[3])` - Create a scale matrix (i.e. set the diagonal elements to x, y, z) and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics.
- `obj.Scale (float s[3])` - Create a scale matrix (i.e. set the diagonal elements to x, y, z) and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics.
- `obj.SetMatrix (vtkMatrix4x4 matrix)` - Set the current matrix directly. This actually calls Identity(), followed by Concatenate(matrix).
- `obj.SetMatrix (double elements[16])` - Set the current matrix directly. This actually calls Identity(), followed by Concatenate(matrix).
- `obj.Concatenate (vtkMatrix4x4 matrix)` - Concatenates the matrix with the current transformation according to PreMultiply or PostMultiply semantics.
- `obj.Concatenate (double elements[16])` - Concatenates the matrix with the current transformation according to PreMultiply or PostMultiply semantics.
- `obj.Concatenate (vtkLinearTransform transform)` - Concatenate the specified transform with the current transformation according to PreMultiply or PostMultiply semantics. The concatenation is pipelined, meaning that if any of the transformations are changed, even after Concatenate() is called, those changes will be reflected when you call TransformPoint().
- `obj.PreMultiply ()` - Sets the internal state of the transform to PreMultiply. All subsequent operations will occur before those already represented in the current transformation. In homogeneous matrix notation, M = M*A where M is the current transformation matrix and A is the applied matrix. The default is PreMultiply.
- `obj.PostMultiply ()` - Sets the internal state of the transform to PostMultiply. All subsequent operations will occur after those already represented in the current transformation. In homogeneous matrix notation, M = A*M where M is the current transformation matrix and A is the applied matrix. The default is PreMultiply.
- `int = obj.GetNumberOfConcatenatedTransforms ()` - Get the total number of transformations that are linked into this one via Concatenate() operations or via SetInput().
- `vtkLinearTransform = obj.GetConcatenatedTransform (int i)` - Get the x, y, z orientation angles from the transformation matrix as an array of three floating point values.
- `obj.GetOrientation (double orient[3])` - Get the x, y, z orientation angles from the transformation matrix as an array of three floating point values.
- `obj.GetOrientation (float orient[3])` - Get the x, y, z orientation angles from the transformation matrix as an array of three floating point values.
- `double = obj.GetOrientation ()` - Get the x, y, z orientation angles from the transformation matrix as an array of three floating point values.
- `obj.GetOrientationWXYZ (double wxyz[4])` - Return the wxyz angle+axis representing the current orientation. The angle is in degrees and the axis is a unit vector.
- `obj.GetOrientationWXYZ (float wxyz[4])` - Return the wxyz angle+axis representing the current orientation. The angle is in degrees and the axis is a unit vector.
- `double = obj.GetOrientationWXYZ ()` - Return the wxyz angle+axis representing the current orientation. The angle is in degrees and the axis is a unit vector.
- `obj.GetPosition (double pos[3])` - Return the position from the current transformation matrix as an array of three floating point numbers. This is simply returning the translation component of the 4x4 matrix.
- `obj.GetPosition (float pos[3])` - Return the position from the current transformation matrix as an array of three floating point numbers. This is simply returning the translation component of the 4x4 matrix.
- `double = obj.GetPosition ()` - Return the position from the current transformation matrix as an array of three floating point numbers. This is simply returning the translation component of the 4x4 matrix.
- `obj.GetScale (double scale[3])` - Return the scale factors of the current transformation matrix as an array of three float numbers. These scale factors are not necessarily about the x, y, and z axes unless unless the scale transformation was applied before any rotations.
- `obj.GetScale (float scale[3])` - Return the scale factors of the current transformation matrix as an array of three float numbers. These scale factors are not necessarily about the x, y, and z axes unless unless the scale transformation was applied before any rotations.
- `double = obj.GetScale ()` - Return the scale factors of the current transformation matrix as an array of three float numbers. These scale factors are not necessarily about the x, y, and z axes unless unless the scale transformation was applied before any rotations.
- `obj.GetInverse (vtkMatrix4x4 inverse)` - Return a matrix which is the inverse of the current transformation matrix.
- `obj.GetTranspose (vtkMatrix4x4 transpose)` - Return a matrix which is the transpose of the current transformation matrix. This is equivalent to the inverse if and only if the transformation is a pure rotation with no translation or scale.
- `obj.SetInput (vtkLinearTransform input)` - Set the input for this transformation. This will be used as the base transformation if it is set. This method allows you to build a transform pipeline: if the input is modified, then this transformation will automatically update accordingly. Note that the InverseFlag, controlled via Inverse(), determines whether this transformation will use the Input or the inverse of the Input.
- `vtkLinearTransform = obj.GetInput ()` - Set the input for this transformation. This will be used as the base transformation if it is set. This method allows you to build a transform pipeline: if the input is modified, then this transformation will automatically update accordingly. Note that the InverseFlag, controlled via Inverse(), determines whether this transformation will use the Input or the inverse of the Input.
- `int = obj.GetInverseFlag ()` - Get the inverse flag of the transformation. This controls whether it is the Input or the inverse of the Input that is used as the base transformation. The InverseFlag is flipped every time Inverse() is called. The InverseFlag is off when a transform is first created.
- `obj.Push ()` - Pushes the current transformation onto the transformation stack.
- `obj.Pop ()` - Deletes the transformation on the top of the stack and sets the top to the next transformation on the stack.
- `int = obj.CircuitCheck (vtkAbstractTransform transform)` - Check for self-reference. Will return true if concatenating with the specified transform, setting it to be our inverse, or setting it to be our input will create a circular reference. CircuitCheck is automatically called by SetInput(), SetInverse(), and Concatenate(vtkXTransform *). Avoid using this function, it is experimental.
- `vtkAbstractTransform = obj.GetInverse ()` - Make a new transform of the same type.
- `vtkAbstractTransform = obj.MakeTransform ()` - Make a new transform of the same type.
- `long = obj.GetMTime ()` - Override GetMTime to account for input and concatenation.
- `obj.MultiplyPoint (float in[4], float out[4])` - Use this method only if you wish to compute the transformation in homogeneous (x,y,z,w) coordinates, otherwise use TransformPoint(). This method calls this->GetMatrix()->MultiplyPoint().
- `obj.MultiplyPoint (double in[4], double out[4])` - Use this method only if you wish to compute the transformation in homogeneous (x,y,z,w) coordinates, otherwise use TransformPoint(). This method calls this->GetMatrix()->MultiplyPoint().