transformPosition static method

Offset transformPosition(
  1. Matrix4? transform,
  2. Offset position

Returns the transformation of position into the coordinate system described by transform.

The z-value of position is assumed to be 0.0. If transform is null, position is returned as-is.


static Offset transformPosition(Matrix4? transform, Offset position) {
  if (transform == null) {
    return position;
  final Vector3 position3 = Vector3(position.dx, position.dy, 0.0);
  final Vector3 transformed3 = transform.perspectiveTransform(position3);
  return Offset(transformed3.x, transformed3.y);