Changeset 5455
- Timestamp:
- Nov 1, 2005, 3:07:25 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 8 edited
-
src/astro/psEarthOrientation.c (modified) (10 diffs)
-
src/astro/psEarthOrientation.h (modified) (3 diffs)
-
src/types/psMetadata.h (modified) (2 diffs)
-
test/astro/tst_psEarthOrientation.c (modified) (6 diffs)
-
test/astro/tst_psSphereOps.c (modified) (3 diffs)
-
test/astro/verified/tst_psEarthOrientation.stderr (modified) (2 diffs)
-
test/astro/verified/tst_psEarthOrientation.stdout (modified) (1 diff)
-
test/astro/verified/tst_psSphereOps.stderr (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psEarthOrientation.c
r5450 r5455 9 9 * @author Robert Daniel DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-1 0-28 02:25:22$11 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-11-02 01:07:25 $ 13 13 * 14 14 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 54 54 static bool eocInit() 55 55 { 56 int nFail = 0;56 unsigned int nFail = 0; 57 57 58 58 // Read config file … … 158 158 } 159 159 160 psSphere *psAberration(psSphere *a ctual,161 const psSphere *a pparent,160 psSphere *psAberration(psSphere *apparent, 161 const psSphere *actual, 162 162 const psSphere *direction, 163 163 double speed) 164 164 { 165 PS_ASSERT_PTR_NON_NULL(a pparent, NULL);165 PS_ASSERT_PTR_NON_NULL(actual, NULL); 166 166 PS_ASSERT_PTR_NON_NULL(direction, NULL); 167 167 if (fabs(speed) < DBL_EPSILON) { … … 171 171 } 172 172 173 if (a ctual== NULL) {174 a ctual= psSphereAlloc();173 if (apparent == NULL) { 174 apparent = psSphereAlloc(); 175 175 } else { 176 a ctual->r = 0.0;177 a ctual->d = 0.0;178 a ctual->rErr = 0.0;179 a ctual->dErr = 0.0;176 apparent->r = 0.0; 177 apparent->d = 0.0; 178 apparent->rErr = 0.0; 179 apparent->dErr = 0.0; 180 180 } 181 181 psSphere *rp = psSphereAlloc(); … … 188 188 // mu = apparent->r * direction->r + apparent->d * direction->d; 189 189 psCube* directionVector = psSphereToCube(direction); 190 psCube* a pparentVector = psSphereToCube(apparent);191 mu = acos(directionVector->x*a pparentVector->x +192 directionVector->y*a pparentVector->y +193 directionVector->z*a pparentVector->z);190 psCube* actualVector = psSphereToCube(actual); 191 mu = acos(directionVector->x*actualVector->x + 192 directionVector->y*actualVector->y + 193 directionVector->z*actualVector->z); 194 194 195 195 //rp = apparent - mu * direction; 196 rp->r = a pparent->r - mu * direction->r;197 rp->d = a pparent->d - mu * direction->d;196 rp->r = actual->r - mu * direction->r; 197 rp->d = actual->d - mu * direction->d; 198 198 199 199 mu_p = mu + speed * ((mu * mu - 1.0) / (1.0 - speed * mu)); … … 210 210 r_p->d = mu_p * direction->d + a * rp->d; 211 211 212 *a ctual= *r_p;212 *apparent = *r_p; 213 213 /* 214 214 psSphereRot *rot = NULL; … … 218 218 double sinD = sin(direction->d); 219 219 rot = psSphereRotQuat(cosR*cosD, sinR*cosD, sinD, speed); 220 220 221 221 actual = psSphereRotApply(actual, rot, apparent); 222 222 */ … … 224 224 psFree(r_p); 225 225 psFree(directionVector); 226 psFree(a pparentVector);226 psFree(actualVector); 227 227 psFree(rpVector); 228 return a ctual;229 } 230 231 psSphere *psGravityDeflection(psSphere *a ctual,232 psSphere *a pparent,228 return apparent; 229 } 230 231 psSphere *psGravityDeflection(psSphere *apparent, 232 psSphere *actual, 233 233 psSphere *sun) 234 234 { 235 PS_ASSERT_PTR_NON_NULL(a pparent, NULL);235 PS_ASSERT_PTR_NON_NULL(actual, NULL); 236 236 PS_ASSERT_PTR_NON_NULL(sun, NULL); 237 237 238 // calculating the a ctual angle from the apparentangle and the sun position239 240 // first, calculate the angle between the sun vector and the a pparentvector238 // calculating the apparent angle from the actual angle and the sun position 239 240 // first, calculate the angle between the sun vector and the actual vector 241 241 242 242 // Moving to cartesian first: XXX -- is this required? 243 243 psCube* sunVector = psSphereToCube(sun); 244 psCube* a pparentVector = psSphereToCube(apparent);244 psCube* actualVector = psSphereToCube(actual); 245 245 246 246 // use dot product to calculate the angle of separation 247 247 // N.B., assuming the psSphereToCube function returns a unit vector. 248 double theta = acos(sunVector->x*a pparentVector->x +249 sunVector->y*a pparentVector->y +250 sunVector->z*a pparentVector->z);248 double theta = acos(sunVector->x*actualVector->x + 249 sunVector->y*actualVector->y + 250 sunVector->z*actualVector->z); 251 251 252 252 double r0 = PS_AU * tan(theta); … … 259 259 //if deflection is greater than limit, the light rays will hit the sun 260 260 psWarning("Invalid positions. Light ray will not be seen on earth.\n"); 261 psFree(a pparentVector);261 psFree(actualVector); 262 262 psFree(sunVector); 263 return a ctual;264 } 265 266 if (a ctual== NULL) {267 a ctual= psSphereAlloc();263 return apparent; 264 } 265 266 if (apparent == NULL) { 267 apparent = psSphereAlloc(); 268 268 } else { 269 a ctual->r = 0.0;270 a ctual->d = 0.0;271 a ctual->rErr = 0.0;272 a ctual->dErr = 0.0;273 } 274 275 // bend the a pparentvector away from the sun vector by deflection angle.269 apparent->r = 0.0; 270 apparent->d = 0.0; 271 apparent->rErr = 0.0; 272 apparent->dErr = 0.0; 273 } 274 275 // bend the actual vector away from the sun vector by deflection angle. 276 276 // XXX: Not sure how to do this. Dave thinks the formula should be: 277 277 // theta = atan(r0/d)*tan(deflection), phi = thete/tan(deflection) … … 281 281 theta = atan(r0/PS_AU) * tan(deflection); 282 282 phi = sqrt( deflection*deflection - theta*theta ); 283 a ctual->r = theta;284 a ctual->d = phi;285 psFree(a pparentVector);283 apparent->r = theta; 284 apparent->d = phi; 285 psFree(actualVector); 286 286 psFree(sunVector); 287 return a ctual;287 return apparent; 288 288 } 289 289 -
trunk/psLib/src/astro/psEarthOrientation.h
r5450 r5455 9 9 * @author Robert Daniel DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-1 0-28 02:25:22$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-11-02 01:07:25 $ 13 13 * 14 14 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 56 56 */ 57 57 psSphere *psAberration( 58 psSphere *a ctual, ///< actualposition of star59 const psSphere *a pparent, ///< apparentposition of star58 psSphere *apparent, ///< apparent position of star 59 const psSphere *actual, ///< actual position of star 60 60 const psSphere *direction, ///< direction of motion of observer 61 61 double speed ///< speed of motion of observer … … 72 72 */ 73 73 psSphere *psGravityDeflection( 74 psSphere *apparent, ///< apparent position of star 74 75 psSphere *actual, ///< actual position of star 75 psSphere *apparent, ///< apparent position of star76 76 psSphere *sun ///< position of the sun 77 77 ); -
trunk/psLib/src/types/psMetadata.h
r5454 r5455 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 69$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-1 0-29 00:05:53$13 * @version $Revision: 1.70 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-11-02 01:07:25 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 709 709 * returned. 710 710 * 711 * @return char*: Value of metadata item.711 * @return psString: Value of metadata item. 712 712 */ 713 713 psString psMetadataLookupStr( -
trunk/psLib/test/astro/tst_psEarthOrientation.c
r5450 r5455 1 1 /** @file tst_psEarthOrientation.c 2 2 * 3 * @brief The code will go on ... 4 * 3 * @brief The code will perform earth orientation calculations and sphere rotations. 5 4 * 6 5 * @author d-Rob, MHPCC 7 6 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-1 0-28 02:25:22$7 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-11-02 01:07:25 $ 10 9 * 11 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 43 42 psS32 testAberration(void) 44 43 { 45 psSphere *a ctual= NULL;46 psSphere *a pparent= psSphereAlloc();44 psSphere *apparent = NULL; 45 psSphere *actual = psSphereAlloc(); 47 46 psSphere *direction = psSphereAlloc(); 48 47 psSphere *empty = NULL; 49 48 50 a pparent->r = 0.2;51 a pparent->d = 0.2;49 actual->r = 0.2; 50 actual->d = 0.2; 52 51 direction->r = 0.2035; 53 52 direction->d = 0.2035; 54 53 55 empty = psAberration(empty, a ctual, direction, 0.1);54 empty = psAberration(empty, apparent, direction, 0.1); 56 55 if (empty != NULL) { 57 56 psError(PS_ERR_BAD_PARAMETER_NULL, false, 58 "psAberration failed to return NULL for NULL a pparentinput.\n");57 "psAberration failed to return NULL for NULL actual input.\n"); 59 58 return 1; 60 59 } 61 empty = psAberration(empty, a pparent, actual, 0.1);60 empty = psAberration(empty, actual, apparent, 0.1); 62 61 if (empty != NULL) { 63 62 psError(PS_ERR_BAD_PARAMETER_NULL, false, … … 66 65 } 67 66 68 a ctual = psAberration(actual, apparent, direction, 0.4);69 printf("\na ctual = r,d = %.8g, %.8g\n", actual->r, actual->d);67 apparent = psAberration(apparent, actual, direction, 0.4); 68 printf("\napparent = r,d = %.8g, %.8g\n", apparent->r, apparent->d); 70 69 70 psFree(apparent); 71 71 psFree(actual); 72 psFree(apparent);73 72 psFree(direction); 74 73 … … 79 78 { 80 79 81 psSphere *actual = NULL;82 psSphere *apparent = psSphereAlloc();80 psSphere *actual = psSphereAlloc(); 81 psSphere *apparent = NULL; 83 82 psSphere *sun = psSphereAlloc(); 84 83 psSphere *empty = NULL; … … 86 85 sun->r = 0.2; 87 86 sun->d = 0.2; 88 a pparent->r = 0.2035;89 a pparent->d = 0.2035;87 actual->r = 0.2035; 88 actual->d = 0.2035; 90 89 91 empty = psGravityDeflection( empty, actual, sun);90 empty = psGravityDeflection(apparent, empty, sun); 92 91 if (empty != NULL) { 93 92 psError(PS_ERR_BAD_PARAMETER_NULL, true, 94 "psGravityDeflection Failed to return NULL for NULL a pparentinput sphere.\n");93 "psGravityDeflection Failed to return NULL for NULL actual input sphere.\n"); 95 94 return 1; 96 95 } 97 empty = psGravityDeflection( empty, apparent, actual);96 empty = psGravityDeflection(apparent, actual, empty); 98 97 if (empty != NULL) { 99 98 psError(PS_ERR_BAD_PARAMETER_NULL, true, … … 102 101 } 103 102 104 a ctual = psGravityDeflection(actual, apparent, sun);105 psSphere *result = psSphereSetOffset(a pparent, actual, PS_SPHERICAL, PS_RADIAN);106 printf("\nA pparent r,d = %.13g,%.13g Actualr,d = %.13g, %.13g \n",107 a pparent->r, apparent->d, result->r, result->d);103 apparent = psGravityDeflection(apparent, actual, sun); 104 psSphere *result = psSphereSetOffset(actual, apparent, PS_SPHERICAL, PS_RADIAN); 105 printf("\nActual r,d = %.13g,%.13g Apparent r,d = %.13g, %.13g \n", 106 actual->r, actual->d, result->r, result->d); 108 107 psFree(result); 109 108 psFree(actual); -
trunk/psLib/test/astro/tst_psSphereOps.c
r5450 r5455 1 1 /** @file tst_psSphereOps.c 2 2 * 3 * @brief The code will ..... Work .... 4 * 3 * @brief The code will perform sphere rotations and transformations. 5 4 * 6 5 * @author d-Rob, MHPCC 7 6 * 8 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-1 0-28 02:25:22$7 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-11-02 01:07:25 $ 10 9 * 11 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 14 13 #include "psTest.h" 15 14 #include "pslib_strict.h" 15 16 16 static psS32 testSphereRotAlloc(void); 17 17 static psS32 testSphereRotQuat(void); … … 275 275 RAD_TO_DEG(galactic->r),RAD_TO_DEG(galactic->d), 276 276 l[x], b[x]); 277 printf("togal- %lf,%lf,%lf,%lf fromgal- %lf,%lf,%lf,%lf\n",278 toGalactic->q0, toGalactic->q1, toGalactic->q2, toGalactic->q3,279 fromGalactic->q0, fromGalactic->q1, fromGalactic->q2, fromGalactic->q3);280 277 return 3; 281 278 } 282 if (fabs(RAD_TO_DEG(icrsFromGalactic->r) - alpha[x]) > TOLERANCE || 279 if ( (fabs(RAD_TO_DEG(icrsFromGalactic->r) - alpha[x]) > TOLERANCE && 280 fabs(RAD_TO_DEG(icrsFromGalactic->d) - 90.0) > TOLERANCE ) || 283 281 fabs(RAD_TO_DEG(icrsFromGalactic->d) - delta[x]) > TOLERANCE) { 284 282 psError(PS_ERR_UNKNOWN, false, -
trunk/psLib/test/astro/verified/tst_psEarthOrientation.stderr
r5450 r5455 6 6 7 7 <DATE><TIME>|<HOST>|E|psAberration (FILE:LINENO) 8 Unallowable operation: a pparentis NULL.8 Unallowable operation: actual is NULL. 9 9 <DATE><TIME>|<HOST>|E|psAberration (FILE:LINENO) 10 10 Unallowable operation: direction is NULL. … … 19 19 20 20 <DATE><TIME>|<HOST>|E|psGravityDeflection (FILE:LINENO) 21 Unallowable operation: a pparentis NULL.21 Unallowable operation: actual is NULL. 22 22 <DATE><TIME>|<HOST>|E|psGravityDeflection (FILE:LINENO) 23 23 Unallowable operation: sun is NULL. -
trunk/psLib/test/astro/verified/tst_psEarthOrientation.stdout
r5450 r5455 1 1 2 a ctual= r,d = 0.10218436, 0.102184362 apparent = r,d = 0.10218436, 0.10218436 3 3 4 A pparent r,d = 0.2035,0.2035 Actualr,d = 0.2035000000002, 0.20350000003914 Actual r,d = 0.2035,0.2035 Apparent r,d = 0.2035000000002, 0.2035000000391 -
trunk/psLib/test/astro/verified/tst_psSphereOps.stderr
r5437 r5455 1 1 /***************************** TESTPOINT ******************************************\ 2 2 * TestFile: tst_psSphereOps.c * 3 * TestPoint: ps Coord{psSphereRotAlloc()}*3 * TestPoint: psSphereOps{psSphereRotAlloc()} * 4 4 * TestType: Positive * 5 5 \**********************************************************************************/ 6 6 7 7 8 ---> TESTPOINT PASSED (ps Coord{psSphereRotAlloc()} | tst_psSphereOps.c)8 ---> TESTPOINT PASSED (psSphereOps{psSphereRotAlloc()} | tst_psSphereOps.c) 9 9 10 10 /***************************** TESTPOINT ******************************************\ 11 11 * TestFile: tst_psSphereOps.c * 12 * TestPoint: ps Coord{psSphereRotQuat()}*12 * TestPoint: psSphereOps{psSphereRotQuat()} * 13 13 * TestType: Positive * 14 14 \**********************************************************************************/ 15 15 16 16 17 ---> TESTPOINT PASSED (ps Coord{psSphereRotQuat()} | tst_psSphereOps.c)17 ---> TESTPOINT PASSED (psSphereOps{psSphereRotQuat()} | tst_psSphereOps.c) 18 18 19 19 /***************************** TESTPOINT ******************************************\ 20 20 * TestFile: tst_psSphereOps.c * 21 * TestPoint: ps Coord{psSphereRotApply()}*21 * TestPoint: psSphereOps{psSphereRotApply()} * 22 22 * TestType: Positive * 23 23 \**********************************************************************************/ … … 32 32 Unallowable operation: coord is NULL. 33 33 34 ---> TESTPOINT PASSED (ps Coord{psSphereRotApply()} | tst_psSphereOps.c)34 ---> TESTPOINT PASSED (psSphereOps{psSphereRotApply()} | tst_psSphereOps.c) 35 35 36 36 /***************************** TESTPOINT ******************************************\ 37 37 * TestFile: tst_psSphereOps.c * 38 * TestPoint: ps Coord{psSphereRotApplyCel()}*38 * TestPoint: psSphereOps{psSphereRotApplyCel()} * 39 39 * TestType: Positive * 40 40 \**********************************************************************************/ 41 41 42 <DATE><TIME>|<HOST>|E|testSphereRotApplyCelestial (FILE:LINENO)43 ICRS for Galactic tranformation incorrect. Result is (180,90), expected (0,90)44 42 45 ---> TESTPOINT PASSED (ps Coord{psSphereRotApplyCel()} | tst_psSphereOps.c)43 ---> TESTPOINT PASSED (psSphereOps{psSphereRotApplyCel()} | tst_psSphereOps.c) 46 44 47 45 /***************************** TESTPOINT ******************************************\ 48 46 * TestFile: tst_psSphereOps.c * 49 * TestPoint: ps Coord{psSphereRotPrecess()}*47 * TestPoint: psSphereOps{psSphereRotPrecess()} * 50 48 * TestType: Positive * 51 49 \**********************************************************************************/ … … 64 62 Unallowable operation: coords is NULL. 65 63 66 ---> TESTPOINT PASSED (ps Coord{psSphereRotPrecess()} | tst_psSphereOps.c)64 ---> TESTPOINT PASSED (psSphereOps{psSphereRotPrecess()} | tst_psSphereOps.c) 67 65 68 66 /***************************** TESTPOINT ******************************************\ 69 67 * TestFile: tst_psSphereOps.c * 70 * TestPoint: ps Coord{testSphereToFromCube()} *68 * TestPoint: psSphereOps{testSphereOffset()} * 71 69 * TestType: Positive * 72 70 \**********************************************************************************/ 73 71 72 <DATE><TIME>|<HOST>|E|psSphereSetOffset (FILE:LINENO) 73 Unallowable operation: position is NULL. 74 <DATE><TIME>|<HOST>|E|psSphereSetOffset (FILE:LINENO) 75 Unallowable operation: offset is NULL. 76 <DATE><TIME>|<HOST>|E|psSphereGetOffset (FILE:LINENO) 77 Unallowable operation: position1 is NULL. 78 <DATE><TIME>|<HOST>|E|psSphereGetOffset (FILE:LINENO) 79 Unallowable operation: position2 is NULL. 74 80 75 ---> TESTPOINT PASSED (ps Coord{testSphereToFromCube()} | tst_psSphereOps.c)81 ---> TESTPOINT PASSED (psSphereOps{testSphereOffset()} | tst_psSphereOps.c) 76 82 77 /***************************** TESTPOINT ******************************************\78 * TestFile: tst_psSphereOps.c *79 * TestPoint: psCoord{testSphereOffset()} *80 * TestType: Positive *81 \**********************************************************************************/82 83 84 ---> TESTPOINT PASSED (psCoord{testSphereOffset()} | tst_psSphereOps.c)85
Note:
See TracChangeset
for help on using the changeset viewer.
