Changeset 5559
- Timestamp:
- Nov 21, 2005, 9:53:01 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astro/tst_psCoord01.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tst_psCoord01.c
r5095 r5559 6 6 * @author Eric Van Alst, MHPCC 7 7 * 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2005- 09-22 22:24:58$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-11-21 19:53:01 $ 10 10 * 11 11 * Copyright 2005 Maui High Performance Computing Center, Univ. of Hawaii … … 30 30 static psS32 testGetOffsetSphere(void); 31 31 static psS32 testGetOffsetLinear(void); 32 static psS32 testProjectTanDeProjectTan(void); 32 33 33 34 testDescription tests[] = { … … 47 48 {testGetOffsetSphere, 0000, "psSphereGetOffset",0,false}, 48 49 {testGetOffsetLinear, 0000, "psSphereGetOffset",0,false}, 50 {testProjectTanDeProjectTan, 0000, "psProject(TAN) -> psDeproject(TAN)",0,false}, 49 51 {NULL} 50 52 }; … … 198 200 return 0; 199 201 } 200 202 //HEY 201 203 psS32 testProjectTan(void) 202 204 { 203 205 psPlane* out = NULL; 204 206 psSphere* in = psSphereAlloc(); 207 psSphere* inTest = NULL; 205 208 psProjection* myProjection = psProjectionAlloc(0.0,0.0,1.0,1.0,PS_PROJ_TAN); 206 209 … … 218 221 // Perform projection 219 222 out = psProject(in, myProjection); 223 inTest = psDeproject(out, myProjection); 220 224 221 225 // Verify output not NULL … … 236 240 return i*10+2; 237 241 } 242 243 // Verify output is as expected 244 if(fabs(in->r - inTest->r) > ERROR_TOL) { 245 printf("TEST ER (in->r, inTest->r) (%.2f %.2f)\n", in->r, inTest->r); 246 return i*10+1; 247 } 248 if(fabs(in->d - inTest->d) > ERROR_TOL) { 249 printf("TEST ERROR: (in->d, inTest->d) (%.2f %.2f)\n", in->d, inTest->d); 250 return i*10+1; 251 } 252 253 psFree(inTest); 238 254 psFree(out); 239 255 } … … 916 932 } 917 933 918 934 #define DEG_INC2 15.0 935 #define VERBOSE 0 936 psS32 testProjectTanDeProjectTan() 937 { 938 psS32 rc = 0; 939 // 940 // I'm not convinced that the p_psProject() and p_psDeproject() functions work 941 // correctly. If we project a set of coordinates over a wide range of (R, D) 942 // values, then deproject them, the original (R, D) values are only produced 943 // when D is larger than 0. This code demonstrates that. 944 // 945 psProjection *tmpProj = psProjectionAlloc(0.0,0.0,10.0,10.0,PS_PROJ_TAN); 946 if (1) { //HEY 947 psPlane planeCoord01; 948 psSphere skyCoord01; 949 psSphere skyCoord02; 950 for (psF32 R = -90.0 ; R <= 90.0 ; R+= DEG_INC2) { 951 for (psF32 D = -90.0 ; D <= 90.0 ; D+= DEG_INC2) { 952 if ((fabs(R) != 90.0) && (fabs(D) != 90.0)) { 953 skyCoord01.r = DEG_TO_RAD(R); 954 skyCoord01.d = DEG_TO_RAD(D); 955 p_psProject(&planeCoord01, &skyCoord01, tmpProj); 956 p_psDeproject(&skyCoord02, &planeCoord01, tmpProj); 957 if ((fabs(skyCoord01.r - skyCoord02.r) < FLT_EPSILON) && 958 (fabs(skyCoord01.d - skyCoord02.d) < FLT_EPSILON)) { 959 if (VERBOSE) { 960 printf("CORRECT: (%.2fr %.2fd) (%.2fr %.2fd) -> (%.2f %.2f) -> (%.2fr %.2fd)\n", R, D, 961 skyCoord01.r, skyCoord01.d, 962 planeCoord01.x, planeCoord01.y, 963 skyCoord02.r, skyCoord02.d); 964 } 965 rc = 1; 966 } else { 967 printf("TEST ERROR: (%.2fr %.2fd) (%.2fr %.2fd) -> (%.2f %.2f) -> (%.2fr %.2fd)\n", R, D, 968 skyCoord01.r, skyCoord01.d, 969 planeCoord01.x, planeCoord01.y, 970 skyCoord02.r, skyCoord02.d); 971 rc = 1; 972 } 973 } 974 } 975 } 976 } 977 return(rc); 978 } 979 980 981
Note:
See TracChangeset
for help on using the changeset viewer.
