globalToLocal method

GPoint globalToLocal(
  1. GPoint globalPoint, [
  2. GPoint? out
])

Converts the given point from global coordinates to local coordinates.

If out is non-null, the resulting point will be stored in that object and returned, otherwise a new GPoint object will be created and returned.

Implementation

GPoint globalToLocal(GPoint globalPoint, [GPoint? out]) {
  // Get the transformation matrix from the base object to this object.
  getTransformationMatrix(base, _sHelperMatrixAlt);
  // Invert the matrix to go from global coordinates to local coordinates.
  _sHelperMatrixAlt.invert();
  // Transform the point using the inverted matrix to get the local
  // coordinates.
  return _sHelperMatrixAlt.transformPoint(globalPoint, out);
}