Transform2D
2D Transformation. 3x2 matrix.
Properties
Transform2D ( from ) | |
Transform2D | ( Vector2 x_axis, y_axis, Vector2 origin ) |
Transform2D ( rotation, Vector2 position ) | |
affine_inverse ( ) | |
basis_xform ( v ) | |
Vector2 | ( Vector2 v ) |
get_origin ( ) | |
get_rotation ( ) | |
get_scale ( ) | |
interpolate_with ( transform, float weight ) | |
inverse ( ) | |
orthonormalized ( ) | |
rotated ( phi ) | |
Transform2D | ( Vector2 scale ) |
translated ( offset ) | |
Variant | ( Variant v ) |
xform_inv ( v ) |
Constants
- IDENTITY = Transform2D( 1, 0, 0, 1, 0, 0 ) — Transform2D with no translation, rotation or scaling applied. When applied to other data structures, performs no transformation.
- FLIP_X = Transform2D( -1, 0, 0, 1, 0, 0 ) — Transform2D with mirroring applied parallel to the X axis.
Represents one or many transformations in 2D space such as translation, rotation, or scaling. It consists of a two x, y and Vector2 “origin”. It is similar to a 3x2 matrix.
Property Descriptions
- origin
The transform’s translation offset.
- Vector2 x
The X axis of 2x2 basis matrix containing 2 s as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object.
- Vector2 y
The Y axis of 2x2 basis matrix containing 2 s as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object.
- Transform2D Transform2D ( from )
Constructs the transform from a 3D Transform.
- Transform2D ( float rotation, position )
Constructs the transform from a given angle (in radians) and position.
- Transform2D affine_inverse ( )
Returns the inverse of the matrix.
- basis_xform ( Vector2 v )
Transforms the given vector by this transform’s basis (no translation).
- basis_xform_inv ( Vector2 v )
Inverse-transforms the given vector by this transform’s basis (no translation).
Returns the transform’s origin (translation).
- get_rotation ( )
Returns the transform’s rotation (in radians).
- Vector2 get_scale ( )
- interpolate_with ( Transform2D transform, weight )
Returns a transform interpolated between this transform and another by a given weight (0-1).
- Transform2D inverse ( )
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use affine_inverse for transforms with scaling).
- orthonormalized ( )
Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
- Transform2D rotated ( phi )
Rotates the transform by the given angle (in radians).
- Transform2D scaled ( scale )
Scales the transform by the given factor.
- Transform2D translated ( offset )
Translates the transform by the given offset.
- Variant xform ( v )
Inverse-transforms the given Vector2 or by this transform.