MutableAffineTransform
-
Cmn
class MutableAffineTransform : AffineTransform
A mutable affine transformation in the plane. Individual operations can be populated with methods like populateFromTranslation and populateFromRotationDegrees.
See AffineTransform for more general documentation about how these transforms are represented. See ImmutableAffineTransform for an immutable alternative to this class.
Summary
Public constructors |
|
|---|---|
|
Constructs an identity |
Cmn
|
|
Constructs this transform with 6 float values, starting with the top left corner of the matrix and proceeding in row-major order. |
Cmn
|
Public functions |
||
|---|---|---|
open operator Boolean |
Component-wise equality operator for |
Cmn
|
open Int |
hashCode() |
Cmn
|
MutableAffineTransform |
populateFrom(input: AffineTransform)Fills this |
Cmn
|
MutableAffineTransform |
Fills this |
Cmn
|
MutableAffineTransform |
populateFromRotationDegrees(degrees: @AngleDegreesFloat Float)Fills this |
Cmn
|
MutableAffineTransform |
populateFromScale(scaleFactor: Float)Fills this |
Cmn
|
MutableAffineTransform |
populateFromScale(xScaleFactor: Float, yScaleFactor: Float)Fills this |
Cmn
|
MutableAffineTransform |
populateFromScaleX(scaleFactor: Float)Fills this |
Cmn
|
MutableAffineTransform |
populateFromScaleY(scaleFactor: Float)Fills this |
Cmn
|
MutableAffineTransform |
populateFromSkewX(sx: Float)Fills this |
Cmn
|
MutableAffineTransform |
populateFromSkewY(sy: Float)Fills this |
Cmn
|
MutableAffineTransform |
populateFromTranslation(offset: Vec)Fills this |
Cmn
|
Unit |
setValues(values: @Size(min = 6) FloatArray)Like |
Cmn
|
Unit |
Populates this transform with the given values, starting with the top left corner of the matrix and proceeding in row-major order. |
Cmn
|
open ImmutableAffineTransform |
Returns an immutable equivalent of this object. |
Cmn
|
open String |
toString() |
Cmn
|
Public properties |
||
|---|---|---|
open Float |
Value in the first row, first column of the transform matrix. |
Cmn
|
open Float |
Value in the second row, first column of the transform matrix. |
Cmn
|
open Float |
Value in the first row, second column of the transform matrix. |
Cmn
|
open Float |
Value in the second row, second column of the transform matrix. |
Cmn
|
open Float |
Value in the first row, third column of the transform matrix. |
Cmn
|
open Float |
Value in the second row, third column of the transform matrix. |
Cmn
|
Extension functions |
||
|---|---|---|
MutableAffineTransform |
MutableAffineTransform.populateFrom(matrix: Matrix)Fills this |
android
|
MutableAffineTransform |
MutableAffineTransform.populateFrom(matrix: Matrix)Fills this |
android
|
Inherited functions |
||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
MutableAffineTransform
MutableAffineTransform()
Constructs an identity MutableAffineTransform:
⎡1 0 0⎤
⎢0 1 0⎥
⎣0 0 1⎦
This is useful when pre-allocating a scratch instance to be filled later.
MutableAffineTransform
MutableAffineTransform(
m00: Float,
m10: Float,
m20: Float,
m01: Float,
m11: Float,
m21: Float
)
Constructs this transform with 6 float values, starting with the top left corner of the matrix and proceeding in row-major order. Prefer to create this object with functions that apply specific transform operations, such as populateFromScale or populateFromRotationDegrees, rather than directly passing in the actual numeric values of this transform. This constructor is useful for when the values are needed to be provided all at once, for example for serialization. To access these values in the same order as they are passed in here, use AffineTransform.getValues. To construct this object using an array as input, there is another public constructor for that.
Public functions
equals
open operator fun equals(other: Any?): Boolean
Component-wise equality operator for MutableAffineTransform.
Due to the propagation floating point precision errors, operations that may be equivalent over the real numbers are not always equivalent for floats, and might return false for equals in some cases.
populateFrom
fun populateFrom(input: AffineTransform): MutableAffineTransform
Fills this MutableAffineTransform with the same values contained in input.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
populateFromIdentity
fun populateFromIdentity(): MutableAffineTransform
Fills this MutableAffineTransform with an identity transformation, which maps a point to itself, i.e. it leaves it unchanged.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
populateFromRotationDegrees
fun populateFromRotationDegrees(degrees: @AngleDegreesFloat Float): MutableAffineTransform
Fills this MutableAffineTransform with a transformation that rotates degrees in the direction from the positive x-axis towards the positive y-axis.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
populateFromScale
fun populateFromScale(scaleFactor: Float): MutableAffineTransform
Fills this MutableAffineTransform with a transformation that scales in both the x and y direction by the given scaleFactor, centered about the origin.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
populateFromScale
fun populateFromScale(xScaleFactor: Float, yScaleFactor: Float): MutableAffineTransform
Fills this MutableAffineTransform with a transformation that scales in both the x- and y-direction by the given pair of factors; xScaleFactor and yScaleFactor respectively, centered about the origin.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
populateFromScaleX
fun populateFromScaleX(scaleFactor: Float): MutableAffineTransform
Fills this MutableAffineTransform with a transformation that scales in the x-direction by the given factor, centered about the origin.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
populateFromScaleY
fun populateFromScaleY(scaleFactor: Float): MutableAffineTransform
Fills this MutableAffineTransform with a transformation that scales in the y-direction by the given factor, centered about the origin.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
populateFromSkewX
fun populateFromSkewX(sx: Float): MutableAffineTransform
Fills this MutableAffineTransform with a transformation that skews in the x-direction by the given factor.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
populateFromSkewY
fun populateFromSkewY(sy: Float): MutableAffineTransform
Fills this MutableAffineTransform with a transformation that skews in the y-direction by the given factor.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
populateFromTranslation
fun populateFromTranslation(offset: Vec): MutableAffineTransform
Fills this MutableAffineTransform with a transformation that translates by the given offset vector.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
setValues
fun setValues(values: @Size(min = 6) FloatArray): Unit
Like setValues, but accepts a FloatArray instead of individual float values.
setValues
fun setValues(m00: Float, m10: Float, m20: Float, m01: Float, m11: Float, m21: Float): Unit
Populates this transform with the given values, starting with the top left corner of the matrix and proceeding in row-major order.
Prefer to modify this object with functions that apply specific transform operations, such as populateFromScale or populateFromRotationDegrees, rather than directly setting the actual numeric values of this transform. This function is useful for when the values are needed to be provided in bulk, for example for serialization.
To access these values in the same order as they are set here, use AffineTransform.getValues.
toImmutable
open fun toImmutable(): ImmutableAffineTransform
Returns an immutable equivalent of this object. This will return itself if called on an immutable instance.
Public properties
Extension functions
MutableAffineTransform.populateFrom
fun MutableAffineTransform.populateFrom(matrix: Matrix): MutableAffineTransform
Fills this MutableAffineTransform with the values from matrix.
If matrix is not an affine transform, throws IllegalArgumentException instead.
Leaves matrix unchanged. Returns this modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
| Throws | |
|---|---|
IllegalArgumentException |
if |
MutableAffineTransform.populateFrom
fun MutableAffineTransform.populateFrom(matrix: Matrix): MutableAffineTransform
Fills this MutableAffineTransform with the values from matrix.
If matrix is not an affine transform, throws IllegalArgumentException instead.
Leaves the input matrix unchanged. Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableAffineTransform |
|
| Throws | |
|---|---|
IllegalArgumentException |
if |