Changeset 2984
- Timestamp:
- Jan 13, 2005, 12:53:37 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psCoord.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psCoord.c
r2983 r2984 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-01-13 22: 45:40$8 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-01-13 22:53:37 $ 10 10 * 11 11 * XXX: Must test psSpherePrecess. … … 60 60 }; 61 61 62 #define ARCSEC_TO_RAD (M_PI / (180.0 * 60.0 * 60.0))63 #define ARCMIN_TO_RAD (M_PI / (180.0 * 60.0))64 #define MY_DEG_TO_RAD (M_PI / 180.0)65 #define MY_RAD_TO_DEG (180.0 / M_PI)66 #define RAD_TO_ARCMIN ((180.0 * 60.0) / M_PI)67 #define RAD_TO_ARCSEC ((180.0 * 60.0 * 60.0) / M_PI)68 69 70 62 psS32 main( psS32 argc, char* argv[] ) 71 63 { … … 1026 1018 offset = psSphereGetOffset(&position1, &position2, 1027 1019 PS_SPHERICAL, PS_ARCMIN); 1028 offset->r = offset->r * ARCMIN_TO_RAD;1029 offset->d = offset->d * ARCMIN_TO_RAD;1020 offset->r = MIN_TO_RAD(offset->r); 1021 offset->d = MIN_TO_RAD(offset->d); 1030 1022 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->r, (position2.r - position1.r), 2); 1031 1023 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->d, (position2.d - position1.d), 3); … … 1034 1026 offset = psSphereGetOffset(&position1, &position2, 1035 1027 PS_SPHERICAL, PS_ARCSEC); 1036 offset->r = offset->r * ARCSEC_TO_RAD;1037 offset->d = offset->d * ARCSEC_TO_RAD;1028 offset->r = SEC_TO_RAD(offset->r); 1029 offset->d = SEC_TO_RAD(offset->d); 1038 1030 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->r, (position2.r - position1.r), 2); 1039 1031 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->d, (position2.d - position1.d), 3); … … 1130 1122 psFree(position2); 1131 1123 1132 tmpOffset.r = offset.r * RAD_TO_ARCMIN;1133 tmpOffset.d = offset.d * RAD_TO_ARCMIN;1124 tmpOffset.r = RAD_TO_MIN(offset.r); 1125 tmpOffset.d = RAD_TO_MIN(offset.d); 1134 1126 tmpOffset.rErr = 0.0; 1135 1127 tmpOffset.dErr = 0.0; … … 1140 1132 psFree(position2); 1141 1133 1142 tmpOffset.r = offset.r * RAD_TO_ARCSEC;1143 tmpOffset.d = offset.d * RAD_TO_ARCSEC;1134 tmpOffset.r = RAD_TO_SEC(offset.r); 1135 tmpOffset.d = RAD_TO_SEC(offset.d); 1144 1136 tmpOffset.rErr = 0.0; 1145 1137 tmpOffset.dErr = 0.0; … … 1244 1236 } 1245 1237 1238 bool testNonEqualF32(psF32 num1, psF32 num2) 1239 { 1240 if ((fabs(num1) <= FLT_EPSILON) && (fabs(num2) <= FLT_EPSILON)) { 1241 return(false); 1242 } 1243 1244 if (fabs((num2 - num1) / num1) <= ERROR_PERCENT) { 1245 return(false); 1246 } 1247 return(false); 1248 } 1249 1246 1250 #define NUM_DEGREES 5 1247 1251 /****************************************************************************** … … 1274 1278 1275 1279 #define RADIUS_DEG 30.0 1276 #define NUM_ANGLES 201280 #define NUM_ANGLES 30 1277 1281 #define MY_DEG_INC ((2.0 * RADIUS_DEG) / NUM_ANGLES) 1278 1282 … … 1291 1295 endCoords = psDeproject(planeCoords, &myProj); 1292 1296 1293 if ( (fabs((endCoords->r - startCoords.r) / startCoords.r) > ERROR_PERCENT) ||1294 (fabs((endCoords->d - startCoords.d) / startCoords.d) > ERROR_PERCENT)) {1297 if (testNonEqualF32(endCoords->r, startCoords.r) || 1298 testNonEqualF32(endCoords->d, startCoords.d)) { 1295 1299 printf("ERROR: \n"); 1296 1300 printf(" startCoords (R, D) is (%f, %f)\n", startCoords.r, startCoords.d); … … 1307 1311 1308 1312 // This code will ... 1313
Note:
See TracChangeset
for help on using the changeset viewer.
