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 m = transformMatrix.storage;
  final x = m[0] * point.x + m[4] * point.y + m[12];
  final y = m[1] * point.x + m[5] * point.y + m[13];
  return (output?..setValues(x, y)) ?? Vector2(x, y);
}