localToGlobal method

Vector2 localToGlobal(
  1. Vector2 point, {
  2. Vector2? output,
})

Transform point from local coordinates into the parent coordinate space. Effectively, this function applies the current transform to point.

Use output to send in a Vector2 object that will be used to avoid creating a new Vector2 object in this method.

Implementation

Vector2 localToGlobal(Vector2 point, {Vector2? output}) {
  final storage = transformMatrix.storage;
  final pointX = point.x;
  final pointY = point.y;
  final x = storage[0] * pointX + storage[4] * pointY + storage[12];
  final y = storage[1] * pointX + storage[5] * pointY + storage[13];
  return (output?..setValues(x, y)) ?? Vector2(x, y);
}