Transform3D.copy constructor

Transform3D.copy(
  1. Transform3D other
)

This class describes a generic 3D transform, which is a combination of translations, rotations and scaling. These transforms are combined into a single matrix, that can be either applied to a graphical device like the canvas, composed with another transform, or used directly to convert coordinates.

The transform can be visualized as 2 reference frames: a "global" and a "local". At first, these two reference frames coincide. Then, the following sequence of transforms is applied:

  • translation to point position;
  • rotate using the rotation;
  • scaling in X, Y and Z directions by scale factors.

The class is optimized for repeated use: the transform matrix is cached and then recalculated only when the underlying properties change. Moreover, recalculation of the transform is postponed until the matrix is actually requested by the user. Thus, modifying multiple properties at once does not incur the penalty of unnecessary recalculations.

This class implements the ChangeNotifier API, allowing you to subscribe for notifications whenever the transform matrix changes. In addition, you can subscribe to get notified when individual components of the transform change: position, scale, and rotation.

Create a copy of the other transform.

Implementation

factory Transform3D.copy(Transform3D other) => Transform3D()..setFrom(other);