Changeset 3559
- Timestamp:
- Mar 29, 2005, 4:21:53 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 3 edited
-
src/astronomy/psAstrometry.c (modified) (7 diffs)
-
src/astronomy/psAstrometry.h (modified) (2 diffs)
-
test/astronomy/tst_psAstrometry01.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/psAstrometry.c
r3540 r3559 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.6 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-03- 29 19:41:56$10 * @version $Revision: 1.62 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-03-30 02:21:14 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 62 62 PS_PTR_CHECK_NULL(transform->y, 0); 63 63 64 int i;65 66 for (i=2;i<(transform->x->nX);i++) {67 if (transform->x->coeff[i][0] != 0.0) {68 return(0);69 }70 }71 for (i=2;i<(transform->x->nY);i++) {72 if (transform->x->coeff[0][i] != 0.0) {73 return(0);74 }75 } 76 77 for (i=2;i<(transform->y->nX);i++) {78 if (transform->y->coeff[i][0] != 0.0) {79 return(0);80 }81 }82 for (i=2;i<(transform->y->nY);i++) {83 if (transform->y->coeff[0][i] != 0.0) {84 return(0);64 for (psS32 i=0;i<(transform->x->nX);i++) { 65 for (psS32 j=0;j<(transform->x->nY);j++) { 66 if (transform->x->coeff[i][j] != 0.0) { 67 if (!(((i == 0) && (j == 0)) || 68 ((i == 0) && (j == 1)) || 69 ((i == 1) && (j == 0)))) { 70 return(0); 71 } 72 } 73 } 74 } 75 76 for (psS32 i=0;i<(transform->y->nX);i++) { 77 for (psS32 j=0;j<(transform->y->nY);j++) { 78 if (transform->y->coeff[i][j] != 0.0) { 79 if (!(((i == 0) && (j == 0)) || 80 ((i == 0) && (j == 1)) || 81 ((i == 1) && (j == 0)))) { 82 return(0); 83 } 84 } 85 85 } 86 86 } … … 108 108 (Y2 * (1.0 / (F - ((C*E)/B)))); 109 109 110 XXX: Since thre is now a general psPlaneTransformInvert Tmp() function, we110 XXX: Since thre is now a general psPlaneTransformInvert() function, we 111 111 should rename this. 112 112 113 *****************************************************************************/ 113 114 static psPlaneTransform *invertPlaneTransform(psPlaneTransform *transform) … … 117 118 PS_PTR_CHECK_NULL(transform->y, 0); 118 119 119 double A = transform->x->coeff[0][0]; 120 double B = transform->x->coeff[1][0]; 121 double C = transform->x->coeff[0][1]; 122 double D = transform->y->coeff[0][0]; 123 double E = transform->y->coeff[1][0]; 124 double F = transform->y->coeff[0][1]; 120 psF64 A = 0.0; 121 psF64 B = 0.0; 122 psF64 C = 0.0; 123 psF64 D = 0.0; 124 psF64 E = 0.0; 125 psF64 F = 0.0; 126 127 // XXX: Test this for correctness. 128 A = transform->x->coeff[0][0]; 129 if (transform->x->nX >= 2) { 130 B = transform->x->coeff[1][0]; 131 } 132 if (transform->x->nY >= 2) { 133 C = transform->x->coeff[0][1]; 134 } 135 D = transform->y->coeff[0][0]; 136 if (transform->y->nX >= 2) { 137 E = transform->y->coeff[1][0]; 138 } 139 if (transform->y->nY >= 2) { 140 F = transform->y->coeff[0][1]; 141 } 125 142 126 143 // XXX: Use the constructor here. 127 psPlaneTransform *out = ps Alloc(sizeof(psPlaneTransform));144 psPlaneTransform *out = psPlaneTransformAlloc(2, 2); 128 145 129 146 out->x->coeff[0][0] = -D + ((F*A)/C) / (E - ((F*B)/C)); … … 1092 1109 1093 1110 /***************************************************************************** 1094 psPlaneTran formFit(trans, source, dest, nRejIter, sigmaClip)1111 psPlaneTransformFit(trans, source, dest, nRejIter, sigmaClip) 1095 1112 1096 1113 XXX: What about nRejIter? Iterations? 1097 1114 XXX: Use static vectors for internal data. 1098 1115 *****************************************************************************/ 1099 bool psPlaneTran formFit(psPlaneTransform *trans,1100 const psArray *source,1101 const psArray *dest,1102 int nRejIter,1103 float sigmaClip)1116 bool psPlaneTransformFit(psPlaneTransform *trans, 1117 const psArray *source, 1118 const psArray *dest, 1119 int nRejIter, 1120 float sigmaClip) 1104 1121 { 1105 1122 PS_PTR_CHECK_NULL(trans, NULL); 1106 1123 PS_PTR_CHECK_NULL(source, NULL); 1107 1124 PS_PTR_CHECK_NULL(dest, NULL); 1108 1109 // Ensure that the input transformation is symmetrical.1110 if ((trans->x->nX != trans->x->nY) ||1111 (trans->y->nX != trans->y->nY) ||1112 (trans->x->nX != trans->y->nX)) {1113 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Input transformation must have same nX==nY.");1114 }1115 1125 1116 1126 psS32 numCoords = PS_MIN(source->n, dest->n); … … 1226 1236 // 1227 1237 if (isProjectionLinear((psPlaneTransform *) in)) { 1238 printf("COOL: is linear\n"); 1228 1239 return(invertPlaneTransform((psPlaneTransform *) in)); 1229 1240 } 1230 1241 PS_PTR_CHECK_NULL(region, NULL); 1231 PS_INT_COMPARE( 0, nSamples, NULL);1242 PS_INT_COMPARE(1, nSamples, NULL); 1232 1243 1233 1244 // Ensure that the input transformation is symmetrical. … … 1300 1311 } 1301 1312 } 1302 bool rc = psPlaneTran formFit(myPT, inData, outData, 10, 100.0);1313 bool rc = psPlaneTransformFit(myPT, inData, outData, 10, 100.0); 1303 1314 1304 1315 psFree(inCoord); -
trunk/psLib/src/astronomy/psAstrometry.h
r3540 r3559 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-03- 29 19:41:56$10 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-03-30 02:21:14 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 552 552 553 553 // XXX: Doxygenate. 554 bool psPlaneTran formFit(554 bool psPlaneTransformFit( 555 555 psPlaneTransform *trans, 556 556 const psArray *source, -
trunk/psLib/test/astronomy/tst_psAstrometry01.c
r3557 r3559 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-03-30 00:17:04 $ 7 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-03-30 02:21:53 $ 9 * 10 * XXX: Must test 11 * pmSourceAddModel 12 * pmSourceSubModel 13 * pmSourceFitModel 14 * pmSourceContour 15 * pmSourceModelGuess 16 * pmSourceRoughClass 17 * pmSourceMoments 18 * pmSourceLocalSky 19 * 9 20 * 10 21 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
Note:
See TracChangeset
for help on using the changeset viewer.
