Transformation Class

4x4 transformation matrix.
Public Class Transformation 
Implements ISerializable, _ 
ICloneable
This language is not supported or no code example is available.
public class Transformation : ISerializable
ICloneable
This language is not supported or no code example is available.
Name Description
Public constructor Transformation(double) Diagonal matrix constructor.
Protected constructor Transformation(Transformation)
Public constructor Transformation() Zero matrix constructor.
Public constructor Transformation(Point3D, Vector3D, Vector3D, Vector3D) As frame constructor.
Public constructor Transformation(SerializationInfo, StreamingContext) Constructor for deserializing objects.
Public constructor Transformation(double[,]) 4x4 square array of doubles constructor.
Public constructor Transformation(double[], bool) 16x array of doubles constructor.
Top
Name Description
Public property IsScaled Checks if the transformation contains scaling.
Public property IsTranslation Checks if the transformation is translation only.
Public property Item(int, int) Direct access on matrix values.
Public property Matrix Gets or sets the 4x4 matrix.
Public property MatrixAsVectorByColumn Gets the 4x4 matrix as an array of doubles ordered by column.
Public property MatrixAsVectorByRow Gets the 4x4 matrix as an array of doubles ordered by row.
Public property MatrixAsVectorFloatByColumn
Public property ScaleFactorX Gets the scale factor along X.
Public property ScaleFactorY Gets the scale factor along Y.
Public property ScaleFactorZ Gets the scale factor along Z.
Top
Methods
 
Name Description
Public method ActOnLeft(double, double, double, double)
Public method ActOnLeftOne(double, double, double)
Public method Static ActOnLeftOne(float, float, float, float[,])
Public method ActOnLeftZero(double, double, double)
Public method Static ActOnLeftZero(float, float, float, float[,])
Public method Static AutocadOCS(Vector3D, out Vector3D, out Vector3D)
Public method ChangeBasis(Plane, Plane) Computes a change of basis transformation.
Public method ChangeBasis(Point3D, Vector3D, Vector3D, Vector3D, Point3D, Vector3D, Vector3D, Vector3D) Computes a change of basis transformation.
Public method ChangeBasis(Vector3D, Vector3D, Vector3D, Vector3D, Vector3D, Vector3D) Computes a change of basis transformation.
Public method Clone() Creates a deep copy of this transformation.
Public method ConvertToSurrogate()
Public method Diagonal(double) Diagonal 3x3 with bottom row = 0,0,0,1.
Public method Dump() Dumps the matrix on Console window.
Public method EqualScaleFactors()
Protected method Equals(Transformation)
Public method Equals(object) Determines whether the specified object is equal to the current object.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (inherited from Object).
Public method GetFloatMatrix()
Public method GetHashCode() Serves as the default hash function.
Public method GetObjectData(SerializationInfo, StreamingContext) Populates a SerializationInfo instance with the data needed to serialize the target object.
Public method GetTransformationForNormals() Gets the transformation to transform the normals (inverse transpose of the upper 3x3 matrix).
Public method GetType Gets the Type of the current instance. (inherited from Object).
Public method GetXElement()
Public method Identity() Diagonal is (1,1,1,1).
Public method Invert() Inverts the 4x4 matrix.
Public method IsIdentity() Check if the transformation is the 'Identity' one. 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
Public method IsIdentity(double) Check if the transformation is the 'Identity' one. 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
Public method IsReversed() Returns true if the transformation is orientation-reversing, i.e. if the determinant of the 3x3 submatrix is smaller than zero.
Public method IsScaleFactorUniform() Returns true if the scale factor of the transformation is the same in the X, Y and Z directions.
Public method IsScaleFactorUniformForPlanar(Plane, ref double) Returns true if the scale factor of the transformation is the same in the two directions of the plane.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (inherited from Object).
Public method Mirror(Plane) Mirror transformation.
Public method Mirror(Point3D, Vector3D) Mirror transformation.
Public method PlanarProjection(Plane) Get transformation that projects to a plane. This transformation maps a 3D point P to the point plane.ClosestPointTo(Q).
Public method Rotation(Vector3D, Vector3D, Vector3D, Vector3D, Vector3D, Vector3D)

Creates a new transformation of rotation.

The frames should be right hand orthonormal frames (unit vectors with Z = X X Y). The resulting rotation fixes the origin (0,0,0), maps initial X to final X, initial Y to final Y, and initial Z to final Z.

Public method Rotation(Point3D, Vector3D, Vector3D, Vector3D, Point3D, Vector3D, Vector3D, Vector3D)

Creates a new transformation of rotation.

The frames should be right hand orthonormal frames (unit vectors with Z = X X Y). The resulting rotation fixes the origin (0,0,0), maps initial X to final X, initial Y to final Y, and initial Z to final Z.

If the initial and final center are equal, then that center point is the fixed point of the rotation. If the initial and final point differ, then the resulting transform is the composition of a rotation fixing P0 and translation from P0 to P1. The resulting transformation maps P0 to P1, P0+X0 to P1+X1, ...

Public method Rotation(Plane, Plane)

Creates a new transformation of rotation.

The frames should be right hand orthonormal frames (unit vectors with Z = X X Y). The resulting rotation fixes the origin (0,0,0), maps initial X to final X, initial Y to final Y, and initial Z to final Z.

If the initial and final center are equal, then that center point is the fixed point of the rotation. If the initial and final point differ, then the resulting transform is the composition of a rotation fixing P0 and translation from P0 to P1. The resulting transformation maps P0 to P1, P0+X0 to P1+X1, ...

Public method Rotation(Vector3D, Vector3D, Point3D) Creates a new transformation of rotation.
Public method Rotation(double, Point3D, Point3D) Creates a new transformation of rotation.
Public method Rotation(double, Vector3D) Creates a new transformation of rotation.
Public method Rotation(double, Vector3D, Point3D) Creates a new transformation of rotation.
Public method Scaling(Point3D, double) Create uniform scale transformation with a specified fixed point.
Public method Scaling(Point3D, double, double, double) Create a non-uniform scale transformation with a specified fixed point.
Public method Scaling(Vector3D) Creates non-uniform scale transformation with the origin as a fixed point.
Public method Scaling(double, double, double) Creates non-uniform scale transformation with the origin as a fixed point.
Public method ToString Returns a string that represents the current object. (inherited from Object).
Public method Translation(Vector3D) Creates a new transformation of translation. Right column is (v.X, v.Y, v.Z, 1).
Public method Translation(double, double, double) Creates a new transformation of translation. Right column is (dx, dy, dz, 1).
Public method Transpose() Transposes the 4x4 matrix.
Public method Zero() All zeros.
Top
Name Description
Operator Static Addition Adds two transformations.
Operator Static Equality
Operator Static Inequality
Operator Static Multiply Applies transformation to a 2D point.
Operator Static Multiply Applies transformation to a 3D point.
Operator Static Multiply Applies transformation to a 4D point.
Operator Static Multiply Applies transformation to a RGB point.
Operator Static Multiply
Operator Static Multiply Applies transformation to a 2D vector.
Operator Static Multiply Applies transformation to a 3D vector.
Operator Static Subtraction Subtract two transformations.
Top
Example
 
Usage example.
 Transformation t = new Translation(10, 0, 0);
 Transformation r = new Rotation(Math.PI/6, Vector3D.AxisY); // angle in radians
 
 Transformation c = t * r; // combines the two transformations (order matters)
 
 Point3D pt = new (10, 20, 30);
 
 Point3D newPt = c * p; // transforms the point pt
 					
This language is not supported or no code example is available.
 Dim t As Transformation = New Translation(10, 0, 0)
 Dim r As Transformation = New Rotation(Math.PI/6, Vector3D.AxisY) ' angle in radians
 
 Dim c As Transformation = t * r ' combines the two transformations (order matters)
 
 Dim pt As Point3D = New (10, 20, 30)
 
 Dim ptNew As Point3D = c * p ' transforms the point pt
 					
This language is not supported or no code example is available.

.NET Framework

Supported in: 4.8

In this article

Definition