transformInverseCoords method

GPoint transformInverseCoords(
  1. double x,
  2. double y, [
  3. GPoint? out
])

Transforms the given coordinates x and y from the global coordinate space to the local coordinate space of this matrix. The transformed coordinates are stored in the out point object if provided, or a new GPoint object is created and returned. The original point object is not modified.

To transform a point from the local coordinate space of this matrix to the global coordinate space, use transformPoint.

If the out parameter is null, a new GPoint object is created and returned with the transformed coordinates. Otherwise, the transformed coordinates are stored in the out object and returned.

Implementation

GPoint transformInverseCoords(double x, double y, [GPoint? out]) {
  out ??= GPoint();
  final id = 1 / ((a * d) + (c * -b));
  out.x = (d * id * x) + (-c * id * y) + (((ty * c) - (tx * d)) * id);
  out.y = (a * id * y) + (-b * id * x) + (((-ty * a) + (tx * b)) * id);
  return out;
}