| 1 | /*
|
|---|
| 2 | *+
|
|---|
| 3 | * Name:
|
|---|
| 4 | * palPcd
|
|---|
| 5 |
|
|---|
| 6 | * Purpose:
|
|---|
| 7 | * Apply pincushion/barrel distortion to a tangent-plane [x,y]
|
|---|
| 8 |
|
|---|
| 9 | * Language:
|
|---|
| 10 | * Starlink ANSI C
|
|---|
| 11 |
|
|---|
| 12 | * Type of Module:
|
|---|
| 13 | * Library routine
|
|---|
| 14 |
|
|---|
| 15 | * Invocation:
|
|---|
| 16 | * palPcd( double disco, double * x, double * y );
|
|---|
| 17 |
|
|---|
| 18 | * Arguments:
|
|---|
| 19 | * disco = double (Given)
|
|---|
| 20 | * Pincushion/barrel distortion coefficient.
|
|---|
| 21 | * x = double * (Given & Returned)
|
|---|
| 22 | * On input the tangent-plane X coordinate, on output
|
|---|
| 23 | * the distorted X coordinate.
|
|---|
| 24 | * y = double * (Given & Returned)
|
|---|
| 25 | * On input the tangent-plane Y coordinate, on output
|
|---|
| 26 | * the distorted Y coordinate.
|
|---|
| 27 |
|
|---|
| 28 | * Description:
|
|---|
| 29 | * Applies pincushion and barrel distortion to a tangent
|
|---|
| 30 | * plane coordinate.
|
|---|
| 31 |
|
|---|
| 32 | * Authors:
|
|---|
| 33 | * PTW: Pat Wallace (RAL)
|
|---|
| 34 | * TIMJ: Tim Jenness
|
|---|
| 35 | * {enter_new_authors_here}
|
|---|
| 36 |
|
|---|
| 37 | * Notes:
|
|---|
| 38 | * - The distortion is of the form RP = R*(1 + C*R**2), where R is
|
|---|
| 39 | * the radial distance from the tangent point, C is the DISCO
|
|---|
| 40 | * argument, and RP is the radial distance in the presence of
|
|---|
| 41 | * the distortion.
|
|---|
| 42 | *
|
|---|
| 43 | * - For pincushion distortion, C is +ve; for barrel distortion,
|
|---|
| 44 | * C is -ve.
|
|---|
| 45 | *
|
|---|
| 46 | * - For X,Y in units of one projection radius (in the case of
|
|---|
| 47 | * a photographic plate, the focal length), the following
|
|---|
| 48 | * DISCO values apply:
|
|---|
| 49 | *
|
|---|
| 50 | * Geometry DISCO
|
|---|
| 51 | *
|
|---|
| 52 | * astrograph 0.0
|
|---|
| 53 | * Schmidt -0.3333
|
|---|
| 54 | * AAT PF doublet +147.069
|
|---|
| 55 | * AAT PF triplet +178.585
|
|---|
| 56 | * AAT f/8 +21.20
|
|---|
| 57 | * JKT f/8 +13.32
|
|---|
| 58 | *
|
|---|
| 59 | * See Also:
|
|---|
| 60 | * - There is a companion routine, palUnpcd, which performs the
|
|---|
| 61 | * inverse operation.
|
|---|
| 62 |
|
|---|
| 63 | * History:
|
|---|
| 64 | * 2000-09-03 (PTW):
|
|---|
| 65 | * SLALIB implementation.
|
|---|
| 66 | * 2015-01-01 (TIMJ):
|
|---|
| 67 | * Initial version. Ported from Fortran.
|
|---|
| 68 | * {enter_further_changes_here}
|
|---|
| 69 |
|
|---|
| 70 | * Copyright:
|
|---|
| 71 | * Copyright (C) 2000 Rutherford Appleton Laboratory.
|
|---|
| 72 | * Copyright (C) 2015 Tim Jenness
|
|---|
| 73 | * All Rights Reserved.
|
|---|
| 74 |
|
|---|
| 75 | * Licence:
|
|---|
| 76 | * This program is free software; you can redistribute it and/or modify
|
|---|
| 77 | * it under the terms of the GNU General Public License as published by
|
|---|
| 78 | * the Free Software Foundation; either version 3 of the License, or
|
|---|
| 79 | * (at your option) any later version.
|
|---|
| 80 | *
|
|---|
| 81 | * This program is distributed in the hope that it will be useful,
|
|---|
| 82 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 83 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 84 | * GNU General Public License for more details.
|
|---|
| 85 | *
|
|---|
| 86 | * You should have received a copy of the GNU General Public License
|
|---|
| 87 | * along with this program (see SLA_CONDITIONS); if not, write to the
|
|---|
| 88 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|---|
| 89 | * Boston, MA 02110-1301 USA
|
|---|
| 90 |
|
|---|
| 91 | * Bugs:
|
|---|
| 92 | * {note_any_bugs_here}
|
|---|
| 93 | *-
|
|---|
| 94 | */
|
|---|
| 95 |
|
|---|
| 96 | #include "pal.h"
|
|---|
| 97 |
|
|---|
| 98 | void palPcd( double disco, double *x, double *y ) {
|
|---|
| 99 | double f;
|
|---|
| 100 |
|
|---|
| 101 | f = 1.0 + disco * ( (*x) * (*x) + (*y) * (*y) );
|
|---|
| 102 | *x *= f;
|
|---|
| 103 | *y *= f;
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|