Here is my use case: I am developing a batch application for generating high-quality stylized sky maps. To this end, I overlap distorted images of constellations and exactly positioned stars. Here is an example:

PerspectiveDistortion maps the points of my source Ursa Major image with labels 1-4 to their exact target positions. I know this from Hevelius’ original drawing:

Since PerspectiveDistortion is only an approximation of a spherical projection and since Hevelius took some liberties with star positions, other points of the image might not be mapped where they should. For instance, Ursa’s tail should pass through Alioth and her right rear leg should include Tania Australis (see both images above). Fixing these imperfections looks like a perfect job for ShepardsDistortion but I can’t figure out how to compute its source coordinates after a PerspectiveDistortion with dynamic coefficients. Without PerspectiveDistortion, ShepardsDistortion only makes a swirly mess out of Ursa since it is more of a displacement than a distortion. PolynomialDistortion produces bad results, too: the required local moves have global effects, which makes the resulting Ursa dissimilar to herself.
I cannot see a viable solution now (am I missing something?). As a humble feature request for future releases, I can see two ways:
1. Either expose the coefficients computed internally by PerspectiveDistortion so that one can proceed in three steps: apply PerspectiveDistortion, calculate the coordinates of one's control points after it, pass them as source coordinates to ShepardsDistortion.
2. Or expose a combined Perspective + Shepards distortion. The first step would map the control points close to their final positions by the least squares fit, the second step would perform local adjustments.
Cheers,
Marcin