Calculate relative matrix transformations.