anchorTransformRelativeTo function
Computes the transform from anchorBox's local coordinate space into
source's local coordinate space, for two render objects that aren't
necessarily ancestor/descendant of each other.
Implementation
Matrix4 anchorTransformRelativeTo(RenderBox anchorBox, RenderObject source) {
final Matrix4 anchorToGlobal = anchorBox.getTransformTo(null);
final Matrix4 sourceToGlobal = source.getTransformTo(null);
final Matrix4 globalToSource = Matrix4.copy(sourceToGlobal)..invert();
return globalToSource.multiplied(anchorToGlobal);
}