Changeset 3990 for trunk/psLib/src/astro/psCoord.c
- Timestamp:
- May 19, 2005, 1:57:37 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psCoord.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r3977 r3990 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.6 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-05-19 05:18:20$12 * @version $Revision: 1.68 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-05-19 23:57:36 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 89 89 (Y2 * (1.0 / (F - ((C*E)/B)))); 90 90 91 XXX: Since th re is now a general psPlaneTransformInvert() function, we91 XXX: Since there is now a general psPlaneTransformInvert() function, we 92 92 should rename this. 93 93 *****************************************************************************/ … … 122 122 psPlaneTransform *out = psPlaneTransformAlloc(2, 2); 123 123 124 /* This is sample code from IfA. It didn't work initially, and I did not 125 spend any time debugging it. 126 127 psF64 a = transform->x->coeff[1][0]; 128 psF64 b = transform->x->coeff[0][1]; 129 psF64 c = transform->y->coeff[1][0]; 130 psF64 d = transform->y->coeff[0][1]; 131 psF64 e = transform->x->coeff[0][0]; 132 psF64 f = transform->y->coeff[0][0]; 133 134 psF64 invDet = 1.0 / (a * d - b * c); // Inverse of the determinant 135 136 // Not entirely sure why this works, but it appears to do so....................................! 137 out->x->coeff[1][0] = invDet * a; 138 out->x->coeff[0][1] = - invDet * b; 139 out->y->coeff[1][0] = - invDet * c; 140 out->y->coeff[0][1] = invDet * d; 141 142 out->x->coeff[0][0] = - invDet * (d * e + c * f); 143 out->y->coeff[0][0] = - invDet * (b * e + a * f); 144 */ 124 145 out->x->coeff[0][0] = (-D + ((F*A)/C)) / (E - ((F*B)/C)); 125 146 out->x->coeff[1][0] = -(F/C) / (E - ((F*B)/C)); … … 1032 1053 psS32 numCoords = PS_MIN(source->n, dest->n); 1033 1054 psS32 order = PS_MAX(trans->x->nX, trans->x->nY); 1055 order = PS_MAX(order, trans->y->nX); 1056 order = PS_MAX(order, trans->y->nY); 1034 1057 1035 1058 // … … 1133 1156 psPlaneTransform *psPlaneTransformInvert(psPlaneTransform *out, 1134 1157 const psPlaneTransform *in, 1135 psRegion region,1158 psRegion *region, 1136 1159 int nSamples) 1137 1160 { … … 1151 1174 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Input transformation must have same nX==nY."); 1152 1175 } 1153 psS32 order = PS_MAX(in->x->nX, in->x->nY);1176 psS32 order = in->x->nX; 1154 1177 1155 1178 psPlaneTransform *myPT = NULL; … … 1197 1220 1198 1221 // 1199 // Initialize the grid. 1222 // Initialize the grid. Since we want the inverse of the transformation, the 1223 // inCoords are written to the outData vector, and the outCoords are written 1224 // to the inData vector. 1200 1225 // 1201 1226 psS32 cnt = 0; … … 1205 1230 inCoord->x = region.x0 + ((psF32) xint) * ((region.x1 - region.x0) / ((psF32) nSamples)); 1206 1231 (void)psPlaneTransformApply(outCoord, in, inCoord); 1207 1208 1232 ((psPlane *) outData->data[cnt])->x = inCoord->x; 1209 1233 ((psPlane *) outData->data[cnt])->y = inCoord->y; … … 1214 1238 } 1215 1239 } 1240 // XXX: what values should be used here? 1216 1241 bool rc = psPlaneTransformFit(myPT, inData, outData, 10, 100.0); 1217 1242
Note:
See TracChangeset
for help on using the changeset viewer.
