| 1 | #include "slalib.h" | 
|---|
| 2 | #include "slamac.h" | 
|---|
| 3 | void slaUnpcd ( double disco, double *x, double *y ) | 
|---|
| 4 | /* | 
|---|
| 5 | **  - - - - - - - - - | 
|---|
| 6 | **   s l a U n p c d | 
|---|
| 7 | **  - - - - - - - - - | 
|---|
| 8 | ** | 
|---|
| 9 | **  Remove pincushion/barrel distortion from a distorted [x,y] | 
|---|
| 10 | **  to give tangent-plane [x,y]. | 
|---|
| 11 | ** | 
|---|
| 12 | **  Given: | 
|---|
| 13 | **     disco    double      pincushion/barrel distortion coefficient | 
|---|
| 14 | **     x,y      double*     distorted coordinates | 
|---|
| 15 | ** | 
|---|
| 16 | **  Returned: | 
|---|
| 17 | **     x,y      double*     tangent-plane coordinates | 
|---|
| 18 | ** | 
|---|
| 19 | **  Notes: | 
|---|
| 20 | ** | 
|---|
| 21 | **   1)  The distortion is of the form rp = r*(1 + c*r**2), where r is | 
|---|
| 22 | **       the radial distance from the tangent point, c is the disco | 
|---|
| 23 | **       argument, and rp is the radial distance in the presence of | 
|---|
| 24 | **       the distortion. | 
|---|
| 25 | ** | 
|---|
| 26 | **   2)  For pincushion distortion, c is +ve; | 
|---|
| 27 | **       For barrel distortion, c is -ve. | 
|---|
| 28 | ** | 
|---|
| 29 | **   3)  For x,y in "radians" - units of one projection radius, | 
|---|
| 30 | **       which in the case of a photograph is the focal length of | 
|---|
| 31 | **       the camera - the following disco values apply: | 
|---|
| 32 | ** | 
|---|
| 33 | **           geometry          disco | 
|---|
| 34 | ** | 
|---|
| 35 | **           astrograph         0.0 | 
|---|
| 36 | **           schmidt           -0.3333 | 
|---|
| 37 | **           AAT PF doublet  +147.069 | 
|---|
| 38 | **           AAT PF triplet  +178.585 | 
|---|
| 39 | **           AAT f/8          +21.20 | 
|---|
| 40 | **           JKT f/8          +13.32 | 
|---|
| 41 | ** | 
|---|
| 42 | **    4)  The present routine is an approximate inverse to the | 
|---|
| 43 | **        companion routine slaPcd, obtained from two iterations | 
|---|
| 44 | **        of Newton's method.  The mismatch between the slaPcd and | 
|---|
| 45 | **        slaUnpcd routines is negligible for astrometric applications; | 
|---|
| 46 | **        To reach 1 milliarcsec at the edge of the AAT triplet or | 
|---|
| 47 | **        Schmidt field would require field diameters of 2.4 degrees | 
|---|
| 48 | **        and 42 degrees respectively. | 
|---|
| 49 | ** | 
|---|
| 50 | **  Last revision:   11 June 1997 | 
|---|
| 51 | ** | 
|---|
| 52 | **  Copyright P.T.Wallace.  All rights reserved. | 
|---|
| 53 | */ | 
|---|
| 54 | { | 
|---|
| 55 | double cr2, a, cr2a2, f; | 
|---|
| 56 |  | 
|---|
| 57 | cr2 = disco * ( *x * *x + *y * *y ); | 
|---|
| 58 | a = ( 2.0 * cr2 + 1.0 ) / ( 3.0 * cr2 + 1.0 ); | 
|---|
| 59 | cr2a2 = cr2 * a * a; | 
|---|
| 60 | f = ( 2.0 * cr2a2 * a + 1.0 ) / ( 3.0 * cr2a2 + 1.0 ); | 
|---|
| 61 | *x *= f; | 
|---|
| 62 | *y *= f; | 
|---|
| 63 | } | 
|---|