RSTransform constructor

RSTransform(
  1. double scos,
  2. double ssin,
  3. double tx,
  4. double ty,
)

Creates an RSTransform.

An RSTransform expresses the combination of a translation, a rotation around a particular point, and a scale factor.

The first argument, scos, is the cosine of the rotation, multiplied by the scale factor.

The second argument, ssin, is the sine of the rotation, multiplied by that same scale factor.

The third argument is the x coordinate of the translation, minus the scos argument multiplied by the x-coordinate of the rotation point, plus the ssin argument multiplied by the y-coordinate of the rotation point.

The fourth argument is the y coordinate of the translation, minus the ssin argument multiplied by the x-coordinate of the rotation point, minus the scos argument multiplied by the y-coordinate of the rotation point.

The RSTransform.fromComponents method may be a simpler way to construct these values. However, if there is a way to factor out the computations of the sine and cosine of the rotation so that they can be reused over multiple calls to this constructor, it may be more efficient to directly use this constructor instead.

Implementation

RSTransform(double scos, double ssin, double tx, double ty) {
  _value
    ..[0] = scos
    ..[1] = ssin
    ..[2] = tx
    ..[3] = ty;
}