Transform

class rhino3dm.Transform
Transform(diagonalValue)

Initializes a new transform matrix with a specified value along the diagonal.

Parameters:

diagonalValue (float) – Value to assign to all diagonal cells except M33 which is set to 1.0.

Transform()

Transform constructor

IsAffine

bool: Tests for an affine transformation. A transformation is affine if it is valid and its last row is [0, 0, 0, 1]. An affine transformation can be broken into a linear transformation and a translation.

IsIdentity

bool: Return True if this Transform is the identity transform

IsLinear

bool: Tests for a linear transformation. A transformation is affine if it is valid and its last row is [0, 0, 0, 1]. If in addition its last column is ( 0, 0, 0, 1)^T then it is linear. An affine transformation can be broken into a linear transformation and a translation.

IsRotation

bool: Returns True if this is a proper rotation.

IsValid

bool: Gets a value indicating whether or not this Transform is a valid matrix. A valid transform matrix is not allowed to have any invalid numbers.

IsZero

bool: True if matrix is Zero4x4, ZeroTransformation, or some other type of zero. The value xform[3][3] can be anything.

IsZero4x4

bool: True if all values are 0

IsZeroTransformation

bool: True if all values are 0, except for M33 which is 1.

RigidType

TransformRigidType: Gets a value indicating whether or not the Transform is rigid. A rigid transformation can be broken into a proper rotation and a translation, while an isometry transformation could also include a reflection.

SimilarityType

TransformSimilarityType: Gets a value indicating whether or not the Transform maintains similarity. The easiest way to think of Similarity is that any circle, when transformed, remains a circle. Whereas a non-similarity Transform deforms circles into ellipses.

M00

float: Gets or sets this[0,0].

M01

float: Gets or sets this[0,1].

M02

float: Gets or sets this[0,2].

M03

float: Gets or sets this[0,3].

M10

float: Gets or sets this[1,0].

M11

float: Gets or sets this[1,1].

M12

float: Gets or sets this[1,2].

M13

float: Gets or sets this[1,3].

M20

float: Gets or sets this[2,0].

M21

float: Gets or sets this[2,1].

M22

float: Gets or sets this[2,2].

M23

float: Gets or sets this[2,3].

M30

float: Gets or sets this[3,0].

M31

float: Gets or sets this[3,1].

M32

float: Gets or sets this[3,2].

M33

float: Gets or sets this[3,3].

static Identity()

[todo] add documentation

static ZeroTransformation()

[todo] add documentation

static Unset()

[todo] add documentation

static Translation(motion)

Constructs a new translation (move) transformation.

Parameters:

motion (rhino3dm.Vector3d) – Translation (motion) vector.

Returns:

A transform matrix which moves geometry along the motion vector.

Return type:

Transform

static Translation(x, y, z)

Constructs a new translation (move) transformation.

Returns:

A transform matrix which moves geometry along the motion vector.

Return type:

Transform

static Scale(anchor, scaleFactor)

Constructs a new uniform scaling transformation with a specified scaling anchor point.

Parameters:
  • anchor (rhino3dm.Point3d) – Defines the anchor point of the scaling operation.

  • scaleFactor (float) – Scaling factor in all directions.

Returns:

A transform matrix which scales geometry uniformly around the anchor point.

Return type:

Transform

static Scale(plane, xScaleFactor, yScaleFactor, zScaleFactor)

Constructs a new uniform scaling transformation with a specified scaling anchor point.

Returns:

A transform matrix which scales geometry uniformly around the anchor point.

Return type:

Transform

static Rotation(angleRadians, rotationAxis, rotationCenter)

Constructs a new rotation transformation with specified angle, rotation center and rotation axis.

Parameters:
  • sinAngle (float) – Sine of the rotation angle.

  • cosAngle (float) – Cosine of the rotation angle.

  • rotationAxis (rhino3dm.Vector3d) – 3D unit axis of rotation.

  • rotationCenter (rhino3dm.Point3d) – 3D center of rotation.

Returns:

A rotation transformation matrix.

Return type:

Transform

static Rotation(startDirection, endDirection, rotationCenter)

Constructs a new rotation transformation with specified angle, rotation center and rotation axis.

Parameters:
  • sinAngle (float) – Sine of the rotation angle.

  • cosAngle (float) – Cosine of the rotation angle.

  • rotationAxis (rhino3dm.Vector3d) – 3D unit axis of rotation.

  • rotationCenter (rhino3dm.Point3d) – 3D center of rotation.

Returns:

A rotation transformation matrix.

Return type:

Transform

static Mirror(pointOnMirrorPlane, normalToMirrorPlane)

Create mirror transformation matrix The mirror transform maps a point Q to Q - (2*(Q-P)oN)*N, where P = pointOnMirrorPlane and N = normalToMirrorPlane.

Parameters:
Returns:

A transformation matrix which mirrors geometry in a specified plane.

Return type:

Transform

static Mirror(mirrorPlane)

Create mirror transformation matrix The mirror transform maps a point Q to Q - (2*(Q-P)oN)*N, where P = pointOnMirrorPlane and N = normalToMirrorPlane.

Parameters:
Returns:

A transformation matrix which mirrors geometry in a specified plane.

Return type:

Transform

static PlaneToPlane(plane0, plane1)

Create a rotation transformation that orients plane0 to plane1. If you want to orient objects from one plane to another, use this form of transformation.

Parameters:
Returns:

The translation transformation if successful, Transform.Unset on failure.

Return type:

Transform

static Shear(plane, x, y, z)

Constructs a Shear transformation.

Parameters:
Returns:

A transformation matrix which shear geometry.

Return type:

Transform

static Multiply(a, b)

Multiplies (combines) two transformations. This is the same as the * operator between two transformations.

Parameters:
Returns:

A transformation matrix that combines the effect of both input transformations. The resulting Transform gives the same result as though you’d first apply B then A.

Return type:

Transform

Determinant()

[todo] add documentation

TryGetInverse()

Attempts to get the inverse transform of this transform.

Returns:

tuple (bool, Transform)

  • True on success. If False is returned and this Transform is Invalid, inserveTransform will be set to this Transform. If False is returned and this Transform is Valid, inverseTransform will be set to a pseudo inverse.

  • The inverse transform. This out reference will be assigned during this call.

Return type:

(bool, Transform)

TransformBoundingBox(bbox)

Computes a new bounding box that is the smallest axis aligned bounding box that contains the transformed result of its 8 original corner points.

Returns:

A new bounding box.

Return type:

rhino3dm.BoundingBox

Transpose()

Flip row/column values

Return type:

Transform

ToFloatArray()

Return the matrix as a linear array of 16 float values.

Parameters:

rowDominant (bool) – If true, returns { M00, M01, M02…}. If false, returns { M00, M10, M20…}.

Returns:

An array of 16 floats.

Return type:

float[]