setToRotationSinCosXY method

AffineTransformation setToRotationSinCosXY(
  1. double sinTheta,
  2. double cosTheta,
  3. double x,
  4. double y,
)

Sets this transformation to be a rotation around a given point (x,y) by specifying the sin and cos of the rotation angle directly. The transformation matrix for the rotation has the value:

  
|  cosTheta  -sinTheta   x-x*cos+y*sin |
|  sinTheta   cosTheta   y-x*sin-y*cos |
|         0          0         1       |

@param sinTheta the sine of the rotation angle @param cosTheta the cosine of the rotation angle @param x the x-ordinate of the rotation point @param y the y-ordinate of the rotation point @return this transformation, with an updated matrix

Implementation

AffineTransformation setToRotationSinCosXY(
    double sinTheta, double cosTheta, double x, double y) {
  m00 = cosTheta;
  m01 = -sinTheta;
  m02 = x - x * cosTheta + y * sinTheta;
  m10 = sinTheta;
  m11 = cosTheta;
  m12 = y - x * sinTheta - y * cosTheta;
  return this;
}